Nandwrite is a program which is used to flash a Neo directly on the phone from a system already running on it.
If you have a system running from a different partition that you intend to flash (for example sd card), you can use nandwrite to do the work, which is much faster (it takes about 30s to write a 59MB jffs2 image).
Make sure you have nandwrite installed (on gentoo, it's in sys-fs/mtd-utils package)
Also make sure that the host system has received correct partition list, for example for my stock Neo Freerunner partition list:
#cat /proc/mtd dev: size erasesize name mtd0: 00200000 00010000 "physmap-flash.0" mtd1: 00040000 00020000 "u-boot" mtd2: 00040000 00020000 "u-boot_env" mtd3: 00800000 00020000 "kernel" mtd4: 000a0000 00020000 "splash" mtd5: 00040000 00020000 "factory" mtd6: 0f6a0000 00020000 "rootfs"
In this case, we're looking for rootfs which according to above is mtd6. If you have it somewhere else, substitute mtd6 with whatever you have in the remainder of this section.
Beware of flashing the u-boot partition, probably you'll have to recreate mtdparts configuration for u-boot from u-boot console. Probably this is due to some kind of bug in nandwrite.
dynpart dynenv set u-boot_env
You can test your nand for bad blocks by issuing nandtest /dev/mtd6 (this is a data destructive test !)
First, put your .jffs2 file somewhere the phone system can read it
Second, write the desired image into the nand this way:
flash_eraseall /dev/mtd6 nandwrite -p /dev/mtd6 /path/to/image.jffs2
- The -m flag can be used to tell nandwrite to mark blocks it detects bad as bad, so if nandwrite is bugged, your entire partition will be marked as bad. See NAND_bad_blocks#Clearing_BadBlocks if this happened to you.
You're all done!