[U-Boot-Users] NAND and bad blocks

MatthewLCreech at eaton.com MatthewLCreech at eaton.com
Tue Sep 18 18:55:07 CEST 2007


Hi,

I'm trying to figure out what my options are for booting a system
completely from NAND flash.  Googling around hasn't yielded much info,
but browsing "drivers/nand/" I've gathered that U-Boot handles bad
blocks (factory or worn-out) & bit-flips to some degree.  It's not
entirely clear how things work by glancing at the code, though, so I
have a few questions:

1. How does U-Boot handle a bad block in the area where the environment
is stored?  I can create a second environment via CFG_ENV_OFFSET_REDUND,
but that's not very flexible (what if the primary and the backup are
both bad blocks?)  I also need to write to the environment from within
Linux via the "fw_setenv" utility, but it doesn't seem to have any NAND
awareness.

2. It's not obvious to me how U-Boot reacts when it encounters a bad
block.  If I'm copying a kernel image out of NAND, and a bad block is
encountered, does it skip to the next block?  If so, do I need to
compensate by padding each partition with unused blocks, or how else
does addressing work?  Similarly for writes - if I do "nand write
<memaddr> <location> 100000", and the first block is bad, will U-Boot
write all 0x100000 bytes _after_ that block?

3. Can Linux handle bad blocks in the same manner?  Specifically, I need
to use 'nandwrite' to copy a kernel image to an MTD partition from
within Linux, and have U-Boot read the image correctly on bootup, both
in the presence of bad blocks and bit-flips.

The only references I found were at the openmoko site, but I'm not sure
how much of what they discuss is native in U-Boot & Linux, vs. being
added on for openmoko.  Thanks in advance for the help!

-- 
Matthew L. Creech
 




More information about the U-Boot mailing list