ubi文件系统问题,麻烦解答一下,谢谢。
问题一
[ 1.257385] UBI: attaching mtd7 to ubi0
[ 1.537597] UBI: MTD device size: 50 MiB
[ 1.542694] UBI: number of good PEBs: 100
[ 1.547515] UBI: number of bad PEBs: 0
[ 3.200927] UBI error: do_sync_erase: cannot erase PEB 99, error -5
[ 3.207489] UBI error: erase_worker: failed to erase PEB 99, error -5
[ 3.214202] UBI: mark PEB 99 as bad
//MTD 控件的倒数第二个PEB;原先为30M(60PEB),此时打印擦除PEB 59失败。
为何擦除块会跟着调整大小跑?
[ 3.850250] nand_erase_nand: attempt to erase a bad block at page 0x00002800
[ 3.857666] UBI error: do_sync_erase: cannot erase PEB 61, error -5
[ 3.864227] UBI error: erase_worker: failed to erase PEB 61, error -5
[ 3.870941] UBI: mark PEB 61 as bad
[ 3.874633] UBI warning: erase_worker: last PEB from the reserved pool was used
问题二
mount: mounting /dev/mtdblock9 on /usr_data failed: Invalid argument
[ 4.199310] UBI: VID header offset: 2048 (aligned 2048)
[ 4.205566] UBI: data offset: 4096
[ 4.212005] UBI error: validate_ec_hdr: bad VID header offset 4096, expected 2048
文件系统分为两部分,ubi.img和sys_data.img,第一部分的VID header offset是在u-boot的evnpara中定义的,请问第二部分的VID header offset在哪儿定义的?
Flash分区如下:
[ 1.083770] 0x000000000000-0x000000080000 : "SPL"
[ 1.090148] 0x000000080000-0x000000100000 : "SPL.backup1"
[ 1.097167] 0x000000100000-0x000000180000 : "SPL.backup2"
[ 1.104125] 0x000000180000-0x000000200000 : "SPL.backup3"
[ 1.111022] 0x000000200000-0x000000400000 : "U-Boot"
[ 1.117584] 0x000000400000-0x000000480000 : "U-Boot Env"
[ 1.124389] 0x000000480000-0x000000980000 : "Kernel"
[ 1.131286] 0x000000980000-0x000003b80000 : "File System" //ubi.img分区
[ 1.143371] 0x000003b80000-0x00000ef80000 : "App data" //sys_data.img分区
[ 1.168640] 0x00000ef80000-0x000040000000 : "User data"
制作ubi相关定义如下:
mkubi.sh
sudo mkfs.ubifs -r ../rootfs -F -o ubifs.img -m 4096 -e 516096 -c 50
sudo ubinize -o ubi.img -m 4096 -p 512KiB -s 512 -O 4096 rootfs.cfg
rootfs.cfg
vol_size=24MiB
附部分串口记录:
[ 2.927642] UBIFS: free space fixup complete
[ 3.059417] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 3.065795] UBIFS: file system size: 22708224 bytes (22176 KiB, 21 MiB, 44 LEBs)
[ 3.073699] UBIFS: journal size: 5160960 bytes (5040 KiB, 4 MiB, 10 LEBs)
[ 3.081329] UBIFS: media format: w4/r0 (latest is w4/r0)
[ 3.087402] UBIFS: default compressor: lzo
[ 3.091674] UBIFS: reserved for root: 0 bytes (0 KiB)
[ 3.105102] VFS: Mounted root (ubifs filesystem) on device 0:13.
[ 3.113067] Freeing init memory: 988K
[ 3.151397] nand_erase_nand: attempt to erase a bad block at page 0x00002700
[ 3.168457] nand_erase_nand: attempt to erase a bad block at page 0x00002700
[ 3.183349] nand_erase_nand: attempt to erase a bad block at page 0x00002700
[ 3.203765] nand_erase_nand: attempt to erase a bad block at page 0x00002700
[ 3.211120] UBI error: do_sync_erase:cannot erase PEB 59, error -5
[ 3.217681] UBI error: erase_worker: failed to erase PEB 59, error -5
[ 3.224426] UBI: mark PEB 59 as bad
[ 3.228088] UBI: 1 PEBs left in the reserve
Mounting /proc and /sys
Starting the hotplug events dispatcher mdev
Mounting filesystems
[ 3.797668] nand_erase_nand: attempt to erase a bad block at page 0x00002200
[ 3.815277] nand_erase_nand: attempt to erase a bad block at page 0x00002200
[ 3.824645] nand_erase_nand: attempt to erase a bad block at page 0x00002200
[ 3.851196] nand_erase_nand: attempt to erase a bad block at page 0x00002200
[ 3.858642] UBI error: do_sync_erase: cannot erase PEB 49, error -5
[ 3.865173] UBI error: erase_worker: failed to erase PEB 49, error -5
[ 3.871887] UBI: mark PEB 49 as bad
[ 3.875610] UBI warning: erase_worker: last PEB from the reserved pool was used
mount: mounting /dev/mtdblock9 on /usr_data failed: Invalid argument
Jian Zhou:
用的是什么型号的NAND FLASH,感觉参数设的不对啊
leo chen:
回复 Jian Zhou:
最好把linux启动部分的log也贴上来
这个大多是参数被设置好,ubifs制作的有问题
Yu Gang:
回复 leo chen:
1、NAND相关信息
NAND FLASH :Micron MT29F8G08ABABAWP
Page size x8:4320 bytes(4096 + 224 bytes)
Block size:128 pages(512K + 28K bytes)
Plane size:2 planes x 1024 blocks per plane
Device size:8Gb:2048 Blocks
Minimum required ECC:4-bit ECC per 540 bytes of data
2、文件系统制作相关信息
1)ubi.img
mkubi.sh:
sudo mkfs.ubifs -r ../rootfs -F -o ubifs.img -m 4096 -e 516096 -c 99
sudo ubinize -o ubi.img -m 4096 -p 512KiB -s 4096 -O 4096 rootfs.cfg
rootfs.cfg:
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=40MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
2)sys_data.img
mksys.sh:
sudo mkfs.ubifs -r ../rootfs/sys_data -F -o sys_datafs.img -m 4096 -e 516096 -c 300
sudo ubinize -o ubi.img -m 4096 -p 512KiB -s 4096 -O 4096 sys_data.cfg
sys_data.cfg:
[ubifs]
mode=ubi
image=sys_datafs.img
vol_id=0
vol_size=144MiB
vol_type=dynamic
vol_name=sys_data
vol_flags=autoresize
3、NAND FLASH分区信息
[ 1.083770] 0x000000000000-0x000000080000 : "SPL"
[ 1.090148] 0x000000080000-0x000000100000 : "SPL.backup1"
[ 1.097167] 0x000000100000-0x000000180000 : "SPL.backup2"
[ 1.104125] 0x000000180000-0x000000200000 : "SPL.backup3"
[ 1.111022] 0x000000200000-0x000000400000 : "U-Boot"
[ 1.117584] 0x000000400000-0x000000480000 : "U-Boot Env"
[ 1.124389] 0x000000480000-0x000000980000 : "Kernel"
[ 1.131286] 0x000000980000-0x000003b80000 : "File System" //ubi.img分区
[ 1.143371] 0x000003b80000-0x00000ef80000 : "App data" //sys_data.img分区
[ 1.168640] 0x00000ef80000-0x000040000000 : "User data"
4、u-boot中paraevn 参数信息
root=ubi0:rootfs rw ubi.mtd=7,4096 noinitrd rootfstype=ubifs rootwait=1 ip=none
5、启动信息见附件。
Yu Gang:
回复 Jian Zhou:
Jian Zhou , 麻烦帮忙看看这个问题呢。
Jian Zhou:
回复 Yu Gang:
用这个命令试下:
mkfs.ubifs -F -q -r ../rootfs -F -o ubifs.img -m 4096 -e 522240 -c 4095 -o ubifs.img
jialin huang:
回复 Jian Zhou:
您好!jian zhou ,
nor flash只有32M,现在已经可以启动了。请问怎么可以下载到一个小点文件系统,以便烧写到nor flash中呢!
Jian Zhou:
回复 jialin huang:
我们的SDK本身就带有一个10几兆的小文件系统,你可以试下。
Jian Zhou:
回复 Jian Zhou:
另外看你说的Nor Flash可以启动了,是UbiFS可以挂载上了么?你修改了哪些参数可以共享下么?
jialin huang:
回复 Jian Zhou:
您好!我说的可以启动的意思是 :可以从nor flash 中的uboot起来,也可以引导nor flash内存储的内核了。挂在tf卡上的文件系统是可以的,但是没有找到可以烧写进nor flash的文件系统。
还有您说的那个十几兆的文件系统方便发给我一下吗,我找到的最小是二十多兆,谢谢您!
我的邮箱是874706726@qq.com
Jian Zhou:
回复 jialin huang:
你有下载我们官方的SDK么?里面有带2个压缩好的文件系统,一个200多M,另外一个十几兆