Flashing NAND from NAND

Werner Almesberger werner at openmoko.org
Tue Oct 20 14:20:13 CEST 2009

Matthias Huber wrote:
> Werner Almesberger schrieb:
> ># echo -en '\x17' | dd bs=1024 count=1 conv=sync >/dev/mtd4
> >Can you tell why it worked ?

In the 0x17 case, we're trying to go from 0x0f to 0x17. That's
one bit set and one bit cleared. Clearing the 0x08 bit can be
done, and happend when trying to write the 0x17. However, the
0x10 bit can't be set (without invoking an erase cycle).

However, since NAND has an ECC, it can still correct a one-bit
error. As it happens, the ECC pattern that gets written, just
flips the 0x10 bit, so the byte in NAND is 0x07, but it gets
corrected to 0x17 - which just happens to be the value we want.

> i can't. it is possible that i flashed my boot with dfu-util and the
> rootfs directly.

Yes, DFU follows all the NAND erasing rituals properly. The rootfs
is very tricky, because there you also have JFFS2 that tries to
hide problems from you.

For your backup system, you should at least add flash_eraseall
to the restore procedure. To make things work also for systems
that have bad NAND blocks, you would have to use nanddump and
nandwrite. (And you still have to erase explicitly - nandwrite
won't do it for you.)

- Werner

More information about the support mailing list