On Tuesday 02 June 2009, Bansal, Prateek wrote:
> Hi,
> 
> I have a few questions on bad block management on NAND device as done
> by u-boot (2009-03) and kernel (2.6.30-rc6) and would appreciate any
> responses to help in my understanding.  
> 
> a) I have seen u-boot stores the bad block table (BBT) in the last
> two blocks. Is this Linux community wide convention on using the
> last two blocks to store BBT?  

Yes, Linux and U-Boot agree on those things.  Though saying "last
two blocks" isn't quite accurate ... if one of those is bad, the
code which creates the BBT will keep counting down.

In both cases, you have to *tell* the code to expect a NAND-resident
BBT ... otherwise it will (veeerrrrryyyyy sloooowly, for big chips)
scan for bad blocks as part of chip init.


> c) What happens if the last two blocks or blocks reserved for BBT
> are bad? Should we store additional copies of BBT in other blocks? 

See above (or the source code).  Counting down from the end, the
first good block is used for the primary BBT, and the next is for
a secondary.  And somewhat incautiously, when the BBT needs to be
updated it ignores the many unused pages in the BBT blocks; instead
of using those first, it erases the BBT then rewrites the first few
pages.  Seems to me that might matter with MLC chips, which (as I
understand) generate bad blocks faster.


> d)  In linux kernel, we have mtd/flash partitioning.
>               ... deletia ...

The *current* U-Boot code (2009-06 RCs) has similar support.


> As per the partition table above, the filesystem will occupy
> the last blocks of the NAND.

Actually, that's not what it *means* ... only blocks marked as
"good" will ever be used by the filesystem code (e.g. UBIFS).

But the BBT blocks are marked (in the BBT) as "reserved",
neither "good" nor "bad".  So the filesystem code won't try
to use them.


> Does it mean the filesystem can overwrite the last two blocks
> reserved for bad block table or is there a protection built
> in the linux kernel to avoid such overwrites?    

See above.  Each block has two bits in the BBT, so the possible
markings include "good", "bad", and two flavors of "reserved".

- Dave



_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to