Reading from a Ubifs filesystem on LS1046 Freeway

Jan Hoogerbrugge jan.hoogerbrugge at gmail.com
Tue Oct 27 15:13:17 CET 2020


Hi,

I am using a NXP LS1046 Freeway board. I want to create a Ubifs file
system on the NAND flash and write to it from Linux and read from it
in Uboot.

I create a Ubifs file system and a dummy file on it as follows:

root at localhost:~# ubiformat /dev/mtd0
ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096
eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4095 -- 100 % complete
ubiformat: 4092 eraseblocks have valid erase counter, mean value is 1
ubiformat: 4 bad eraseblocks found, numbers: 4092, 4093, 4094, 4095
ubiformat: formatting eraseblock 4095 -- 100 % complete
root at localhost:~# ubiattach -p /dev/mtd0
UBI device number 0, total 4092 LEBs (519585792 bytes, 495.5 MiB),
available 4012 LEBs (509427712 bytes, 485.8 MiB), LEB size 126976
bytes (124.0 KiB)
root at localhost:~# ubimkvol /dev/ubi0 -N failsafe -s 32MiB
Volume ID 0, size 265 LEBs (33648640 bytes, 32.1 MiB), LEB size 126976
bytes (124.0 KiB), dynamic, name "failsafe", alignment 1
root at localhost:~# ubiupdatevol -t /dev/ubi0_0
root at localhost:~# mount -t ubifs ubi0:failsafe ff
root at localhost:~# echo "Hello World" > ff/hello
root at localhost:~# sync

Next, I try to use the created file system from Uboot as follows.

=> setenv mtdids nand0=7e800000.flash
=> setenv mtdparts mtdparts=7e800000.flash:32m(failsafe)
=> mtdparts

device nand0 <7e800000.flash>, # parts = 1

 #: name                size            offset          mask_flags
 0: failsafe            0x02000000      0x00000000      0

active partition: nand0,0 - (failsafe) 0x02000000 @ 0x00000000

defaults:
mtdids  :
mtdparts: mtdparts=1550000.spi:1m(rcw),15m(u-boot),48m(kernel.itb);7e800000.flash:16m(nand_uboot),48m(nand_kernel),448m(nand_free)
=> ubi part failsafe
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0 error: ubi_read_volume_table: the layout volume was not found
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22
UBI error: cannot attach mtd1
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
=>


If I use 'ubi part nand0' instead of 'ubi part failsafe' then the
error message is the same except that error code 12 is reported
instead of 22.

Can anybody help me with the uboot commands to read from the Ubifs file system?

Regards,
Jan.


More information about the U-Boot mailing list