Skip to contentSkip to conversation

ubifs rootfs attached error

Buildroot Woody Wu 3 participants 6 messages Aug 13, 2013

lore
Share & tools
lore

Woody Wu

author
#0 lore raw

Hi,

I use buildroot created an ubifs as my rootfs, which is intended put on my ARM target with MTD partitions. In u-boot bootloader I wrote the ubi image to my NAND flash and changed kernel command line accordingly. But the kernel did not boot, the messages shown that it cannot attach the image successfully. I will describe my steps and related information in blow and hope people here can sort me out the difficulties.

Firstly, below are the kernel error messages:

------------------------------------------------------------------
NAND_ECC_NONE selected by board driver. This is not recommended !! Scanning device for bad blocks
Bad eraseblock 77 at 0x0000009a0000
Bad eraseblock 89 at 0x000000b20000
...
Bad eraseblock 2419 at 0x000012e60000
Bad eraseblock 3458 at 0x00001b040000
Creating 5 MTD partitions on "NAND":
0x000000000000-0x000000100000 : "Bootloader" 0x000000100000-0x000000300000 : "LOGO" 0x000000300000-0x000000700000 : "Kernel" 0x000000700000-0x000002700000 : "ROOTFS" 0x000002700000-0x000040000000 : "Data"
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: max. sequence number: 0
UBI error: vtbl_check: volume table check failed: record 0, error 9 UBI error: ubi_init: cannot attach mtd3
----------------------------------------------------------------------

My ubi image was create with the following buildroot configs:

BR2_TARGET_ROOTFS_UBIFS=y
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f800
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x800
BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT=2048
# BR2_TARGET_ROOTFS_UBIFS_RT_NONE is not set
# BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB is not set
BR2_TARGET_ROOTFS_UBIFS_RT_LZO=y
BR2_TARGET_ROOTFS_UBIFS_NONE=y
# BR2_TARGET_ROOTFS_UBIFS_GZIP is not set
# BR2_TARGET_ROOTFS_UBIFS_BZIP2 is not set
# BR2_TARGET_ROOTFS_UBIFS_LZMA is not set
# BR2_TARGET_ROOTFS_UBIFS_LZO is not set
# BR2_TARGET_ROOTFS_UBIFS_XZ is not set
BR2_TARGET_ROOTFS_UBIFS_OPTS=""
BR2_TARGET_ROOTFS_UBI=y
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x8000
BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
BR2_TARGET_ROOTFS_UBI_OPTS=""

I write the resulted ubi (not the ubifs) image to my nand flash using
u-boot: 'nand write memory-address my-mtd-part-start my-mtd-part-size'

Then I change my kernel command line before boot it:

ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs noinitrd ...

Can anyone please have a look at above information and give me a clue? Is that possible I setup incorrect parameters in making the UBI image? Actually I don't really understand the meanings of those parameters.

Thanks in advance.

Signature · 1 line
I can't go back to yesterday - because I was a different person then
#1 lore raw

Dear Woody Wu,

Quoted 1 line · Woody Wu

Hi,

...

Quoted 4 lines

Firstly, below are the kernel error messages:

------------------------------------------------------------------
NAND_ECC_NONE selected by board driver. This is not recommended !!

Modern flash chips actually rely on specific forms of cyclic redundancy checks in order to be able to correct for bit errors in NAND flash. Without using the proper CRC algorithm, you can never be sure to be able to read from the flash what you have written to it. Another hint at this problem are the "Bad eraseblock" messages that follow.

Check your kernel configuration and the documentation of your target for the proper ECC settings for the NAND flash.

With kind regards

Stefan Peter

author
#2 lore raw
Quoted 10 lines · Stefan Peter

Dear Woody Wu,

Quoted 1 line · Woody Wu

Hi,

...

Quoted 4 lines

Firstly, below are the kernel error messages:

------------------------------------------------------------------
NAND_ECC_NONE selected by board driver. This is not recommended !!

Quoted 8 lines

Modern flash chips actually rely on specific forms of cyclic redundancy checks in order to be able to correct for bit errors in NAND flash. Without using the proper CRC algorithm, you can never be sure to be able to read from the flash what you have written to it. Another hint at this problem are the "Bad eraseblock" messages that follow.

Check your kernel configuration and the documentation of your target for the proper ECC settings for the NAND flash.

Stefan, thanks for the hints. Yes, my kernel configuration disalbed the NAND ECC. I like to study on that. But, do you think this is reason why my ubifs did not get attached? Thanks.

Quoted 5 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 1 line
I can't go back to yesterday - because I was a different person then
#5 lore raw
In reply to Woody Wu
Quoted 38 lines · Woody Wu

Hi,

I use buildroot created an ubifs as my rootfs, which is intended put on my ARM target with MTD partitions. In u-boot bootloader I wrote the ubi image to my NAND flash and changed kernel command line accordingly. But the kernel did not boot, the messages shown that it cannot attach the image successfully. I will describe my steps and related information in blow and hope people here can sort me out the difficulties.

Firstly, below are the kernel error messages:

------------------------------------------------------------------
NAND_ECC_NONE selected by board driver. This is not recommended !! Scanning device for bad blocks
Bad eraseblock 77 at 0x0000009a0000
Bad eraseblock 89 at 0x000000b20000
...
Bad eraseblock 2419 at 0x000012e60000
Bad eraseblock 3458 at 0x00001b040000
Creating 5 MTD partitions on "NAND":
0x000000000000-0x000000100000 : "Bootloader" 0x000000100000-0x000000300000 : "LOGO" 0x000000300000-0x000000700000 : "Kernel" 0x000000700000-0x000002700000 : "ROOTFS" 0x000002700000-0x000040000000 : "Data"
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: max. sequence number: 0
UBI error: vtbl_check: volume table check failed: record 0, error 9 UBI error: ubi_init: cannot attach mtd3
----------------------------------------------------------------------

My ubi image was create with the following buildroot configs:

Quoted 16 lines

BR2_TARGET_ROOTFS_UBIFS=y
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f800
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x800
BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT=2048
# BR2_TARGET_ROOTFS_UBIFS_RT_NONE is not set
# BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB is not set
BR2_TARGET_ROOTFS_UBIFS_RT_LZO=y
BR2_TARGET_ROOTFS_UBIFS_NONE=y
# BR2_TARGET_ROOTFS_UBIFS_GZIP is not set
# BR2_TARGET_ROOTFS_UBIFS_BZIP2 is not set
# BR2_TARGET_ROOTFS_UBIFS_LZMA is not set
# BR2_TARGET_ROOTFS_UBIFS_LZO is not set
# BR2_TARGET_ROOTFS_UBIFS_XZ is not set
BR2_TARGET_ROOTFS_UBIFS_OPTS=""
BR2_TARGET_ROOTFS_UBI=y
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x8000

This looks wrong: your eraseblock size is 128K, so this should be 0x20000.

Regards,
Arnout

Quoted 17 lines

BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
BR2_TARGET_ROOTFS_UBI_OPTS=""

I write the resulted ubi (not the ubifs) image to my nand flash using
u-boot: 'nand write memory-address my-mtd-part-start my-mtd-part-size'

Then I change my kernel command line before boot it:

ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs noinitrd ...

Can anyone please have a look at above information and give me a clue? Is that possible I setup incorrect parameters in making the UBI image? Actually I don't really understand the meanings of those parameters.

Thanks in advance.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw
In reply to Woody Wu
Quoted 3 lines · Woody Wu

Stefan, thanks for the hints. Yes, my kernel configuration disalbed the NAND ECC. I like to study on that. But, do you think this is reason why my ubifs did not get attached? Thanks.

Yes, definitively. I don't want to say that there are no other problems in your setup, but as long as you can not read back exactly what you have written to the flash, there is very little chance that UBI will work. UBIFS is based upon MTD. And MTD relies on a working FLASH driver. As long as one of these layers does not work properly, the topmost (UBIFS) layer can not work properly, either.

With kind regards

Stefan Peter

author
#4 lore raw
Quoted 6 lines · Stefan Peter
Quoted 3 lines · Woody Wu

Stefan, thanks for the hints. Yes, my kernel configuration disalbed the NAND ECC. I like to study on that. But, do you think this is reason why my ubifs did not get attached? Thanks.

Quoted 7 lines

Yes, definitively. I don't want to say that there are no other problems in your setup, but as long as you can not read back exactly what you have written to the flash, there is very little chance that UBI will work. UBIFS is based upon MTD. And MTD relies on a working FLASH driver. As long as one of these layers does not work properly, the topmost (UBIFS) layer can not work properly, either.

If so, that's really wired. Since befor trying the ubifs, the same kernel was actually running jffs2 as rootfs without a sign that there is a i/o problem. Just because the performance concerns to jffs2, I decided to try ubifs.

Signature · 1 line
I can't go back to yesterday - because I was a different person then