Flashing NAND from NAND

Werner Almesberger werner at openmoko.org
Mon Oct 19 20:52:36 CEST 2009


Matthias Huber wrote:
> No, erasing seemed not to be necessary.
> why should i erase it ?

Because a write to NAND normally only clears bits but never sets them:

# flash_eraseall /dev/mtd4
# hexdump -C /dev/mtd4
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
# echo -en '\x0f' | dd bs=1024 count=1 conv=sync >/dev/mtd4
# hexdump -C /dev/mtd4
00000000  0f 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |?...............|
# echo -en '\xff' | dd bs=1024 count=1 conv=sync >/dev/mtd4
dd: writing `standard output': Input/output error
# hexdump -C /dev/mtd4
00000000  0f 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |?...............|

Here's a little brain-twister: repeat the example from the beginning,
but instead of trying to write '\xff', do this:

# echo -en '\x17' | dd bs=1024 count=1 conv=sync >/dev/mtd4
dd: writing `standard output': Input/output error
# hexdump -C /dev/mtd4
00000000  17 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Can you tell why it worked ?

- Werner



More information about the support mailing list