T1040RDB Failed to mount UBIFS

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

T1040RDB Failed to mount UBIFS

Jump to solution
10,467 Views
leotao
Contributor I

I am trying to boot T1040 from nand and use UBIFS. when booting from Nand, it boots well until the point of "mounting UBIFS". below is the error:

UBI: attaching mtd7 to ubi0

UBI error: validate_ec_hdr: bad VID header offset 512, expected 4096

UBI error: validate_ec_hdr: bad EC header

Erase counter header dump:

        magic          0x55424923

        version        1

        ec             0

        vid_hdr_offset 512

        data_offset    1024

        image_seq      2076921562

        hdr_crc        0x951adef

erase counter header hexdump:

CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.12.19-rt30-QorIQ-SDK-V1.7+g6619b8b #6

Call Trace:

[c9081cd0] [c0006f50] show_stack+0x40/0x150 (unreliable)

[c9081d10] [c06e9a20] dump_stack+0x78/0xa0

[c9081d20] [c03a56ac] validate_ec_hdr+0xac/0x120

[c9081d30] [c03a6104] ubi_io_read_ec_hdr+0x184/0x240

[c9081d60] [c03aaf00] ubi_attach+0x180/0x14d0

[c9081de0] [c039fdf8] ubi_attach_mtd_dev+0x688/0xc80

[c9081e30] [c08e9348] ubi_init+0x274/0x30c

[c9081e80] [c00021a8] do_one_initcall+0x158/0x1b0

[c9081ef0] [c08cb8d0] kernel_init_freeable+0x134/0x1d0

[c9081f20] [c0002808] kernel_init+0x18/0x170

[c9081f40] [c000fe0c] ret_from_kernel_thread+0x5c/0x64

UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0

UBI error: ubi_attach_mtd_dev: failed to attach mtd7, error -22

UBI error: ubi_init: cannot attach mtd7

UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", error -19

VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19

Please append a correct "root=" boot option; here are the available partitions:

1f00          131072 mtdblock0  (driver?)

1f01            1536 mtdblock1  (driver?)

1f02            1024 mtdblock2  (driver?)

1f03            1024 mtdblock3  (driver?)

1f04           24576 mtdblock4  (driver?)

1f05           10240 mtdblock5  (driver?)

1f06            1024 mtdblock6  (driver?)

1f07          409600 mtdblock7  (driver?)

1f08           98304 mtdblock8  (driver?)

1f09          524288 mtdblock9  (driver?)

1f0a           65536 mtdblock10  (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.12.19-rt30-QorIQ-SDK-V1.7+g6619b8b #6

Call Trace:

[c9081dd0] [c0006f50] show_stack+0x40/0x150 (unreliable)

[c9081e10] [c06e9a20] dump_stack+0x78/0xa0

[c9081e20] [c06e7c9c] panic+0xd8/0x1fc

[c9081e70] [c08cbce4] mount_block_root+0x1b0/0x248

[c9081ed0] [c08cc064] prepare_namespace+0xa0/0x1d0

[c9081ef0] [c08cb958] kernel_init_freeable+0x1bc/0x1d0

[c9081f20] [c0002808] kernel_init+0x18/0x170

[c9081f40] [c000fe0c] ret_from_kernel_thread+0x5c/0x64

Rebooting in 180 seconds..

what I did was:

1.build  kernel to support support UBIFS

2. build uboot to support UBIFS

3. set boot cmd to :

bootcmd=setenv bootargs noinitrd ip=off mem=256M rootwait=1 rw ubi.mtd=7,4096 rootfstype=ubifs root=ubi0:rootfs console=$consoledev,$baudrate $othbootargs;nand read.e $loadaddr $kernel_addr $kernel_size;nand read.e $fdtaddr $fdt_addr $fdt_size;bootm $loadaddr - $fdtaddr

4. modify fsl-image-core.bb script

add image file type:

  IMAGE_FSTYPES = "ubi"

build rootfs: I got 2 images:

fsl-image-core-t1040rdb-20150408204106.rootfs.ubi

fsl-image-core-t1040rdb-20150408204106.rootfs.ubifs

I update rootfs partition mtdblock7 with  " fsl-image-core-t1040rdb-20150408204106.rootfs.ubifs"

Is the anything else need to set up to make it work?

Thanks

leo

Labels (1)
0 Kudos
1 Solution
4,634 Views
yipingwang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

4 Replies
4,635 Views
yipingwang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

4,634 Views
leotao
Contributor I

Hello YiPing,

Thank you very much for your detailed information.

I understand you try to burn rootfs.ubi to Flash properly by using “ubiformat” from Liunx shell instead of using u-boot command “nand write”.

But I am not able to run the instruction below:

root@p1010rdb-pb:ram# ubiformat /dev/mtdXX -f ./rootfs.ubi

The problem is when I transfer rootfs.ubi from my host machine to target board T1040RDB, the rootfs image can’t be transferred completely.

Maximum size of file can be copied to Linux directory is about 23MB while the size of rootfs.ubi is about 50MB.

Is there anyway to enlarge linux directory size limit in bitbake?

Below is the error, after copy 23MB file to Linux, you don’t even have any room to create a mount point.

Thanks

Leo

root@t1040rdb:~# tftp 192.168.0.1

tftp> get /tftpboot/root.ubifs /home/root.ubifs

root@t1040rdb:~# ls -al /home

total 23924

drwxr-sr-x 3 root root 1024 Mar 27 19:22 .

drwxr-xr-x 18 root root 1024 Jan 1 1970 ..

drwxr-xr-x 2 root root 1024 Mar 25 22:55 root

-rw-rr 1 root root 24397824 Mar 27 19:25 root.ubifs

root@t1040rdb:~# mkdir /var/nfs

mkdir: cannot create directory '/var/nfs': No space left on device

0 Kudos
4,634 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello leo tao,

When ramdisk rootfs is generated, there is no much spare space allocated for /dev/root, you could copy a larger file  into “/tmp” folder.


In addition, there is a limitation with tftp command, it cannot download a file over 32M, please try to use the following command instead.


busybox tftp -g -r /tftpboot/root.ubi 192.168.2.1


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
4,634 Views
leotao
Contributor I

Hello Yiping,

Your solution works.

I am able to boot T1040RDB mounting rootfs as UBIFS.

Thanks a lot for your support!

Leo Tao

0 Kudos