Booting from the flash

Bill Roman roman at
Wed Mar 1 17:09:14 EST 2000

Dvir Oren wrote:
> It appears that nftl_format deletes M-Systems' firmware.  I
> remember that David wrote something about fixing that.
> doc_loadbios seems to destroy the partition entirely.  Neither M-
> Systems' drivers nor MTD drivers can recognize anything on the
> flash after doc_loadbios.
> Is there a way to boot from a DOC2000 flash using MTD drivers?

Yes, I've just gone through this.  I've had mixed results resurrecting devices
after destroying their firmware this way: a 4 MB DiskOnChip 2000 was
recoverable, while a 2 MB unit was not.

What I learned is that doc_loadbios seems to need an image captured by "dd
if=/dev/mtd0 ...".  Given this, I was able to destroy and reload the M-Systems
firmware on the 4 MB device.  I confess, after the lack of success with the 2 MB
unit, I didn't try too hard to explore the failure modes in this process, so I'm
not promising it's foolproof.

Of course if that firmware is already gone, you can't capture an image of it!  I
managed to get out of this situation by using the DOS utilities from M-Systems'
web site, and thrashing around booting Linux and DOS from a floppy.  First, I
used the firmware image (DOC121.EXB) and doc_loadbios to load it.  This isn't
enough to make the firmware work, but it's enough to persuade DUPDATE.EXE
(running under DOS, I didn't try dosemu) that the DiskOnChip is present so it
would write the firmware the right way.

After you've succeeded in restoring the boot code (or, preferably, before you've
destroyed it), dd it off of /dev/mtd0 to make an image that works with

You avoid getting into this mess in the first place by supplying an offset of
49152 (48 * 1024) when doing nftl_format.  For example:

    nftl_format /dev/mtd0 49152

This leaves the firmware intact.  Then insmod nftl.o, run fdisk to create a
partition, make a DOS filesystem on it with mkdosfs, and use syslinux to boot.  

I put the necessary modules (doc2000.o, mtd.o, and nftl.o) on an initial RAM
disk image.  This way I can access the flash to update the RAM disk image stored

To unsubscribe, send "unsubscribe mtd" to majordomo at

More information about the linux-mtd mailing list