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.

Cramfs in nand flash with bad block

Dear all,

    In my application, I used cramfs for my filesystem in the nandflash. While booting from the nand and starting the kernel, found the error logs below:

VFS: Mounted root (cramfs filesystem) readonly on device 31:4.
devtmpfs: mounted
Freeing init memory: 196K
cramfs: bad compressed blocksize 4200037437
cramfs: bad compressed blocksize 4200037437
cramfs: bad compressed blocksize 3026864299
cramfs: bad compressed blocksize 3026864299
/bin/sh: error while loading shared libraries: libm.so.6: cannot open shared object file: Input/output error
Kernel panic - not syncing: Attempted to kill init!
Backtrace:
[<c0047b70>] (dump_backtrace+0x0/0x110) from [<c0399120>] (dump_stack+0x18/0x1c)
 r7:c6420000 r6:c6420000 r5:40108000 r4:c0517050
[<c0399108>] (dump_stack+0x0/0x1c) from [<c0399184>] (panic+0x60/0x17c)
[<c0399124>] (panic+0x0/0x17c) from [<c006c240>] (do_exit+0x74/0x5e4)
 r3:c04ec318 r2:c6423f38 r1:c64200fc r0:c045efae
[<c006c1cc>] (do_exit+0x0/0x5e4) from [<c006c834>] (do_group_exit+0x84/0xb4)
[<c006c7b0>] (do_group_exit+0x0/0xb4) from [<c006c87c>] (sys_exit_group+0x18/0x20)
 r5:40108000 r4:400fd9f0
[<c006c864>] (sys_exit_group+0x0/0x20) from [<c0043da0>] (ret_fast_syscall+0x0/0x30

    As far as I know,  I guess this may caused by the bad block of nand when I flashed the filesystem to the nand using u-boot nand write command. The nand write application will auto skip the bad block by the bad block mangement function. Since the cramfs stored in the continuous memory, when the kernel mount the root filesystem it will meet some of the bad block which nand write has skipped, it seems that at this situation it wound skipped the bad block as what the nand write do. 

   So, do anyone have the idea about how to fixed the nand bad block with cramfs? Or having some PSP patchs on this?

   Thanks.

  • You can try clear flash from U-Boot, please read http://wiki.openmoko.org/wiki/NAND_bad_blocks

  • There are two options to solve your problem:

    First of all you have to know that cramfs can NOT handle Bad Blocks, so your cramfs image has to be a monolithe.

    You can achieve this in two ways: First one is to copy your cramfs image to a Ramdrive using uBoot. uBoot will skip bad Blocks and your Image will be a single Block in the Ramdrive.

    Second option is to make sure that you copy your cramfs image to a memory space where it is not broken by bad Blocks. I chose this option as it offers way better performance, but it is not easy to realize. Did this by using an externel NAND Programmer connected to JTAG.