This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x 8bit NAND and SDK 06 UBIFS boot problem

Hi everyone..

First of all i have to point out, my knowledge about UBI file systems and kernel booting internlas, is very limited. I also spent significant time searching this forum.

I have custom AM335X board with 8bit NAND MT29F2G08ABAEAH4-IT:E device. Also i ported SPL/U-Boot and Linux kernel  form SDK 06.00.00.00/board-support/board-port-labs source trees. After few startup problems now i have SPL, U-Boot and kernel booting from NAND flash. Of course kernel will crash upon unsuccessful root file system probe...

In order to save some development time, i tried to use already pre-built UBI file system image, used for am335X-evm boards, and found in SDK 06.00.00.00/filesystem/arago-base-tisdk-image-am335x-evm.ubi.

The idea was simple, as supplied in here:

  •  bootargs=console=ttyO0,115200n8 noinitrd ip=off mem=128M rootdelay=5 rw ubi.mtd=7,2048 rootfstype=ubifs root=ubi0:am335x-evm-rootfs
But kernel crashes and spits this message:

13.953002] Waiting 5sec before mounting root device...
[ 25.074035] UBIFS: recovery needed
[ 25.506988] UBIFS: recovery completed
[ 25.531127] UBIFS: mounted UBI device 0, volume 0, name "am335x-evm-rootfs"
[ 25.576812] UBIFS: file system size: 30347264 bytes (29636 KiB, 28 MiB, 239 LEBs)
[ 25.626922] UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
[ 25.674713] UBIFS: media format: w4/r0 (latest is w4/r0)
[ 25.712860] UBIFS: default compressor: lzo
[ 25.739715] UBIFS: reserved for root: 0 bytes (0 KiB)
[ 25.807769] VFS: Mounted root (ubifs filesystem) on device 0:12.
[ 25.853485] Freeing init memory: 236K
[ 27.124603] UBIFS error (pid 1): ubifs_read_node: bad node type (255 but expected 1)
[ 27.175537] UBIFS error (pid 1): ubifs_read_node: bad node at LEB 22:29952, LEB mapping status 1
[ 27.233001] UBIFS error (pid 1): do_readpage: cannot read page 87 of inode 716, error -22
[ 27.319305] UBIFS error (pid 1): ubifs_read_node: bad node type (255 but expected 1)
[ 27.370117] UBIFS error (pid 1): ubifs_read_node: bad node at LEB 22:29952, LEB mapping status 1
[ 27.427551] UBIFS error (pid 1): do_readpage: cannot read page 87 of inode 716, error -22
[ 27.486145] Kernel panic - not syncing: Attempted to kill init!
[ 27.525115] Backtrace:

Now i have few simple questions:

Can I expect this pre-built file system to work 'out of the box' or with some small intervention?

Or do i need to create custom one, having in mind this tutorial, to adjust NAND flash parameters.?

Can i use arago-base-tisdk-image-am335x-evm.tar.gz as base file system, to compile my custom one, regarding the fact that i can not find any init folder or scripts, and i guess init script should be supplied with bootargs

Thanks in advance

  • Hi,

    I believe the provided pre-built UBI file system in the SDK is prepared for the NAND chips used in the official TI evaluation boards. Since you are using a different NAND flash device, you will have to build a UBIFS image taking into account the NAND chip characteristics like PEB size, LEB size, etc.

    Turorials and examples can be found here:

    http://processors.wiki.ti.com/index.php/UBIFS_Support
    http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mkfubifs

    You can also take a look at this step-by-step example I have provided here: http://e2e.ti.com/support/arm/sitara_arm/f/791/p/268305/941327.aspx#941327

    Please not that the parameters in my example vary since it is an attempt for a dual boot system.

    Best regards,
    Miroslav

  • Thanks for assistance Miroslav,

    now the situation is like this:

    1) my NAND device is MT29F2G08ABAEAH4-IT:E, 2048 page size, 128KB block size

    2) I followed links you provided, and used base file system form SDK, arago-base-tisdk-image-am335x-evm.tar.gz. Commands for UBIFS file creation (of course mtd-utils were present on my host):

    • mkfs.ubifs -r rootfs/ -F -o ubifs.img -m 2048 -e 126976 -c 242
    • ubinize -o hM01-CPUXX-ubi.img -m 2048 -p 128KiB -O 2048 ubinize.cfg

    (followed by the calculations required, and by kernel mtd partition structure, i decided to use 32MB size, (256 PEBS) and 14 PEBS as UBIFS overhead. This leads to 242.)

    ubunize.cfg contents:

    [ubifs]
    mode=ubi
    image=ubifs.img
    vol_id=0
    vol_size=30MiB
    vol_type=dynamic
    vol_name=rootfs

    Now finally, kernel can recognize file system, and i got following error log, which seems a bit unexpected for me:

     

    [ 13.772583] Waiting 5sec before mounting root device...
    [ 21.098663] UBIFS: recovery needed
    [ 22.153076] UBIFS: recovery completed
    [ 22.177246] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
    [ 22.216796] UBIFS: file system size: 29458432 bytes (28768 KiB, 28 MiB, 232 LEBs)
    [ 22.267028] UBIFS: journal size: 4190208 bytes (4092 KiB, 3 MiB, 33 LEBs)
    [ 22.314849] UBIFS: media format: w4/r0 (latest is w4/r0)
    [ 22.352905] UBIFS: default compressor: lzo
    [ 22.379791] UBIFS: reserved for root: 0 bytes (0 KiB)
    [ 22.447784] VFS: Mounted root (ubifs filesystem) on device 0:12.
    [ 22.492919] Freeing init memory: 212K
    INIT: version 2.88 booting
    [ 25.289520] UBIFS error (pid 812): ubifs_decompress: cannot decompress 3156 bytes, compressor lzo, error -22
    [ 25.354095] UBIFS error (pid 812): read_block: bad data node (block 179, inode 3241)
    [ 25.404815] UBIFS error (pid 812): do_readpage: cannot read page 179 of inode 3241, error -22
    [ 25.477416] UBIFS error (pid 812): ubifs_decompress: cannot decompress 3156 bytes, compressor lzo, error -22
    [ 25.541839] UBIFS error (pid 812): read_block: bad data node (block 179, inode 3241)
    [ 25.592437] UBIFS error (pid 812): do_readpage: cannot read page 179 of inode 3241, error -22
    [ 25.688262] UBIFS error (pid 1): ubifs_decompress: cannot decompress 3156 bytes, compressor lzo, error -22
    [ 25.751800] UBIFS error (pid 1): read_block: bad data node (block 179, inode 3241)
    [ 25.801330] UBIFS error (pid 1): do_readpage: cannot read page 179 of inode 3241, error -22
    [ 25.859008] Kernel panic - not syncing: Attempted to kill init!
    [ 25.897979] Backtrace:

    So far, seem like Linux have tried to start some etc/rcS.d init scripts, but UBI layer failed to manage underlying mtd structure. 

    Any ideas for this behavior?

    Thanks in advance