NAND Bad Block Algorithm, JFFS2, and CRAMFS

Thomas Gleixner tglx at
Fri May 28 08:56:34 EDT 2004

On Friday 28 May 2004 13:40, Richard Schmitt wrote:
> We are using JFFS2 on NAND devices and are currently running into a
> problem that I was hoping to get some guidance on.
> We've created a 14MB partition.  We've configured the NAND driver to -
> Verify Writes
> - Enable ECC
> - Disable Bad Block Checking

Which version of NAND are you using ? Where do you disable bad block checking 
- in nand_erase I assume ?

> We've disabled Bad Block checking because as we understand it, this must
> be disabled in order to support JFFS2.  I have a question on this that
> I'll raise a bit further on.

Why so ?

> We can copy a 64K jffs2 image onto the flash and mount it without problem.
>  When we try to copy a 7MB image onto the flash, the copy will fail with a
> generic 'input/output error'.

You _CANNOT_ copy with cp xyz /dev/mtdx, therefor we have mtdutils, nandwrite 
is your friend, buit it relies on the intact bad block information.

> Our hypothesis is that there is a bad block somewhere in the flash that is
> not hit with the 64K image but is hit with the 7MB image.  Because of this
> and with Verify Writes enabled, the copy will fail.

By disabling the bad block check in erase you have managed to destroy the bad 
block info. Hopefully you remember which blocks were bad so you can try to 
mark them as bad again. 

> This brings us back to the question introduced earlier.  If we need to
> disable bad block checking with NAND in order to support JFFS2, then how
> do we copy a JFFS2 image onto the flash if the flash has a bad block in
> it?

Who said that ?

> The second piece of this question is that we really wanted to support two
> partitions, one with a JFFS2, and another with CRAMFS.  We wanted to run
> with the bad block algorithm on CRAMFS and without it on the JFFS2 one.
> We've heard rummblings that this is not supported. Is that true or is
> there some way that we can get that to work.

Trusting rumblings is almost not a good idea.

There are some efforts to make CRAMFS work on top of NAND with respect to bad 
blocks. Other efforts are on the way to provide a SSFDC compatible glue 
The recent changes in NAND provide extended bad block support including flash 
based bad block tables. I really have no clue where this information comes 

Steve Ballmer quotes the statistic that IT pros spend 70 percent of their 
time managing existing systems. That couldn’t have anything to do with 
the fact that 99 percent of these systems run Windows, could it?
linutronix - competence in embedded & realtime linux
mail: tglx at

More information about the linux-mtd mailing list