Reading from a Ubifs filesystem on LS1046 Freeway

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading from a Ubifs filesystem on LS1046 Freeway

2,182 Views
nlv17327
NXP Employee
NXP Employee

Hi,

I am using a 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@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@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@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@localhost:~# ubiupdatevol -t /dev/ubi0_0

root@localhost:~# mount -t ubifs ubi0:failsafe ff

root@localhost:~# echo "Hello World" > ff/hello

root@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.

0 Kudos
8 Replies

975 Views
williawh
Contributor III

Greetings @nlv17327 and @yipingwang,

This sounds very similar to what I would like to do on ls1046afrwy since this model does not boot from NAND flash.

I want to boot from NOR which holds the boot-loader code, and transfer run-time firmware from NAND to external RAM (DRAM in this case). I want to use ECC in boot-block code since the NAND can have defects. I already see bad blocks in the NAND on my FRWY-ls1046a EVK.

The run-time firmware in NAND flash would be placed there by a previous SD boot-loader code or Code Warrior that transferred the openWRT rfs to NAND.

Is this possible to do?

We also will need to update the WAP's periodically from time to time. We will have a UART, USB, and Eth but no SD on the board being developed.

I assume we can use tftp to flash NOR and NAND, is that correct?

Thanks,

William

Tags (4)
0 Kudos

2,164 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Jan,

 

Please refer to the following thread to setup and configure UBIFS.

https://community.nxp.com/t5/T-Series/T1040RDB-Failed-to-mount-UBIFS/m-p/398737#M113

 

Thanks,

Yiping

0 Kudos

2,156 Views
nlv17327
NXP Employee
NXP Employee

Hi Yiping,

In the thread that you refer to the Ubifs file system is passed via command line arguments to Linux and then Linux uses the Ubifs file system as root file system.

I want to read in Uboot a file from the Ubifs file system. So I want to use the ubifsload command. But before I can use this command I need to give a few other uboot commands. I would like to know which ones. The documentation in Uboot's README.ubi is not clear.

Jan.

0 Kudos

2,145 Views
yipingwang
NXP TechSupport
NXP TechSupport

You need to define the following in include/configs/ls1046afrwy.h

# define CONFIG_CMD_UBI

#define CONFIG_CMD_UBIFS

 

=>ubifsmount ubi0:rootfs

=>ubifsload 0xa0000000 /boot/Image

0 Kudos

2,137 Views
nlv17327
NXP Employee
NXP Employee

The two configs are set. In Linux I created a volume named 'rootfs' using the steps listed above. If I try to mount the volume in uboot I get:

=> ubifsmount ubi0:rootfs
UBIFS error (pid: 1): cannot open "ubi0:rootfs", error -19
Error reading superblock on volume 'ubi0:rootfs' errno=-19!
ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
- mount 'volume-name' volume

 

So that does not work. README.ubi in the Uboot doc directory tell me that I have to use 'ubi part' before you can use 'ubifsmount' but that also does not work for me.

0 Kudos

2,085 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please try whether you could mount ubifs in Linux with the following command.

$ mount -t ubifs ubi0:rootfs /mnt

$ ls /mnt

For detailed procedure, please refer to the following thread.

https://community.nxp.com/t5/T-Series/T1040RDB-Failed-to-mount-UBIFS/m-p/398737#M113

 

0 Kudos

2,072 Views
nlv17327
NXP Employee
NXP Employee

That also does not work....

root@localhost:~# mount -t ubifs ubi0:rootfs /mnt
mount: /mnt: unknown filesystem type 'ubifs'.
root@localhost:~# mount -t ubifs ubi0:rootfs /mnt
[ 27.333563] UBIFS error (pid: 1067): cannot open "ubi0:rootfs", error -19
mount: /mnt: unknown filesystem type 'ubifs'.

Notice that after the first command, I repeat it and then it gives another message.

Also notice that in uboot I created a volume named rootfs with 'ubi create rootfs'.

In the meantime one of your colleagues created Jira ticket QSDK-7141.

0 Kudos

2,053 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the procedure provided in "https://community.nxp.com/t5/T-Series/T1040RDB-Failed-to-mount-UBIFS/m-p/398737#M113" to format and deploy ubi filesystem.

0 Kudos