Hello Leo Tao,
Please refer to the following procedure and check whether you missed something.
1. Kernel configuration
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
< > Parallel port support --->
<*> Enable UBI - Unsorted block images --->
<*> NAND Device Support --->
File systems --->
[*] Miscellaneous filesystems --->
[*] Network File Systems --->
<*> UBIFS file system support
2. Please check whether ubi filesystem has been formatted and deployed correctly.
Format the mtd balock to UBI
root@p1010rdb-pb:ram# ubiformat /dev/mtdXX --yes
Where "XX" is the MTD device num
E.g:
root@p1010rdb-pb:ram# ubiformat /dev/mtd7 --yes
ubiformat: mtd7 (nand), size 58720256 bytes (56.0 MiB), 112 eraseblocks of 524288 bytes (512.0 KiB), min. I/O size 4096 bytes
libscan: scanning eraseblock 111 -- 100 % complete
ubiformat: 110 eraseblocks are supposedly empty
ubiformat: 2 bad eraseblocks found, numbers: 74, 75
ubiformat: formatting eraseblock 111 -- 100 % complete
Flash the ubi image into mtd block:
root@p1010rdb-pb:ram# ubiformat /dev/mtdXX -f ./rootfs.ubi
Where "XX" is the MTD device num
E.g:
ubiformat: mtd7 (nand), size 58720256 bytes (56.0 MiB), 112 eraseblocks of 524288 bytes (512.0 KiB), min. I/O size 4096 bytes
libscan: scanning eraseblock 111 -- 100 % complete
ubiformat: 110 eraseblocks have valid erase counter, mean value is 0
ubiformat: 2 bad eraseblocks found, numbers: 74, 75
ubiformat: flashing eraseblock 22 -- 100 % complete
ubiformat: formatting eraseblock 111 -- 100 % complete
3. Please check whether the ubi partition can be attached successfully.
root@p1021rdb:~# ubiattach /dev/ubi_ctrl -m XX
Where "XX" is the MTD device num
E.g:
root@p1010rdb-pb:ram# ubiattach /dev/ubi_ctrl -m 7
UBI: attaching mtd7 to ubi0
UBI: scanning is finished
UBI: volume 0 ("p1010rdb-rootfs") re-sized from 21 to 28 LEBs
UBI: attached mtd7 (name "NAND Compressed RFS Image", size 56 MiB) to ubi0
UBI: PEB size: 524288 bytes (512 KiB), LEB size: 516096 bytes
UBI: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
UBI: VID header offset: 4096 (aligned 4096), data offset: 8192
UBI: good PEBs: 110, bad PEBs: 2, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/1, WL threshold: 4096, image sequence number: 1063368973
UBI: available PEBs: 0, total reserved PEBs: 110, PEBs reserved for bad PEB handling: 78
UBI: background thread "ubi_bgt0d" started, PID 2504
Check the ubi partition:
root@p1010rdb-pb:ram# mount -t ubifs ubi0_0 /mnt
UBIFS: background thread "ubifs_bgt0_0" started, PID 2507
UBIFS: mounted UBI device 0, volume 0, name "p1010rdb-rootfs"
UBIFS: LEB size: 516096 bytes (504 KiB), min./max. I/O unit sizes: 4096 bytes/4096 bytes
UBIFS: FS size: 9289728 bytes (8 MiB, 18 LEBs), journal size 4644865 bytes (4 MiB, 8 LEBs)
UBIFS: reserved for root: 0 bytes (0 KiB)
UBIFS: media format: w4/r0 (latest is w4/r0), UUID 9709D18F-23C6-4A52-9BF1-03EAB33C0B87, small LPT model
root@p1010rdb-pb:ram# mount
...
ubi0_0 on /mnt type ubifs (rw,relatime)
root@p1010rdb-pb:ram# ls /mnt/
bin boot dev etc home lib linuxrc media mnt proc run sbin sys tmp usr var
4. Please check ubi rootfs bootarts
=>setenv bootargs ubi.mtd=<MTD_num> root=ubi0_0 rw rootfstype=ubifs console=ttyS0,115200 init=/init
=>tftpboot $loadaddr uImage-ubi.bin
=>tftpboot $fdtaddr l <dtb_file>
=>bootm $loadaddr - $fdtaddr
Have a great day,
Yiping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------