DOC / NFTL problem, and fix

Wolfgang Denk wd at
Tue Aug 27 19:35:16 EDT 2002


I noticed a problem when trying to initialize a DOC  device  like  an
ordinary  harddisk,  i. e. when trying to run a command sequence like
this one:

	bash# eraseall /dev/mtdchar0
	bash# nftl_format /dev/mtdchar0 0x00300000
	bash# fdisk /dev/nftla
	(create partitions, and write partition table)
	bash# reboot

Usually the DOC would be unusable after this, with no valid partition
table at all. Depending on the timing it would sometimes work - if  I
add a long delay before the "reboot", it works.

It turns out that some internal data structures of the  NFTL  driver,
which are initialized only at boot-time, become invalid after you run

To fix this issue, we added an IOCTL  command  to  the  NFTL  driver,
which would instruct the driver to re-read appropriate meta-data from
the  DOC  device.  Nftl_format was modified to invoke this command to
accomplish its operation.

Patch attached.

Wolfgang Denk

Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at
I have made mistakes, but have never made the mistake of  claiming  I
never made one.                                     - James G. Bennet

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mtd_nftl.patch
Type: application/x-patch
Size: 6104 bytes
Desc: mtd_nftl.patch
Url : 

More information about the linux-mtd mailing list