Questions about MTD
I'm trying to use the MTD drivers to boot off a DiskOnChip 2000, and ran into the following problems:
1. The flash has to be formatted with nftl_format in order for the MTD drivers to write successfully to the flash. However, when I run nftl_format, it destroys the bios extension that allows booting from the flash. I then try to run nftl_format /dev/mtd0 49152, to skip the first 48K, which hold the bios extension. However, this seems to cause some problems:
a. nftl_format in fact does not erase the first 48K, however it does delete the partition table. As I understand it, the disk partition is in the first 512 bytes, so how can that be?
b. When I try to create the partition, there are a lot of file system errors, possibly because I formatted starting at 49152. It seems like nftl_format doesn't set the start of the device from after the first 48k, which will then conflict.
2. doc_loadbios doesn't seem to do what it's supposed to do. However, it does destroy the flash, allowing me to docpmap /e the flash, which will lead me to the next...
3. erase seg faults. Is erase supposed to do what docpmap /e does?
4. Some odd problems when trying to dd the first 48k. The partition table is not saved after removing the nftl module. Only after writing it a second time does it get saved.
5. One thing I don't understand: even though everybody talks about the first 48k being the firmware, the firmware itself is less than 48k. How does that work? And what about the first 512bytes of the partition table?
Can anybody help?
Has anybody succeeded in booting off a DiskOnChip 2000 using the MTD drivers?
BTW: The lilo I posted here a few weeks ago which was patched to work with MTD, probably will not work correctly. I'll post here a new one soon,. if it interests anyone.
I was partially able to load LILO off /dev/nftla, however only from the MBR (not /dev/nftla1) - it seems like nftl_format destroys the MBR, or something like that. I was not able to create a full boot from the flash, since the file system keeps getting trashed.
---------
Dvir Oren <[email protected]>
Lucid VON Ltd. <http://www.lucidvon.com>
9 Saloniki St., Tel-Aviv Israel
Tel: +972 3 644 3038 Fax: +972 3 644 3039
To unsubscribe, send "unsubscribe mtd" to [email protected]
Quoted 3 lines · [email protected] said:
a.
nftl_formatin fact does not erase the first 48K, however it does delete the partition table. As I understand it, the disk partition
is in the first 512 bytes, so how can that be?
In the beginning, there was an expanse of raw flash.
We set aside 49152 bytes of that for the firmware. The firmware may not actually take up all of that space, but it's allocated anyway.
The remainder of the flash is taken up with the actual NFTL filing system. This is a kind of filesystem which emulates a block device.
Your boot sector is actually in this block device, not on the first 512 bytes of the flash itself. When you overwrite the entire contents of the block device by using nftl_format, the boot sector is overwritten too - it's just like formatting a disk drive.
Think of it like low-level format and high-level format (remember old drives where you had to do that?)
Quoted 4 lines
b. When I try to create the partition, there are a lot of file system
errors, possibly because I formatted starting at 49152. It seems
likenftl_formatdoesn't set the start of the device from after the first 48k, which will then conflict.
If this is after you've previously used nftl_format without specifying that you want it to start at byte 49152, then there's an NFTL header at the beginning of the flash which will be confusing things.
Otherwise, I'm not sure, and I'd need a complete transcript of what you did, and the errors you way.
Quoted 3 lines
2.
doc_loadbiosdoesn't seem to do what it's supposed to do.
However, it does destroy the flash, allowing me to docpmap /e the flash, which will lead me to the next...
The firmware that comes from M-Systems isn't supposed to be just loaded directly into the flash - which is what doc_loadbios does. You're supposed to spread out the first 8k of data over the first 16k of the flash, I think, putting 256 bytes of data at the beginning of each 512-byte page of flash.
Quoted 1 line · [email protected] said:
3. erase seg faults. Is erase supposed to do what docpmap /e does?
erase is supposed to completely clear the flash, and not do anything more. Isn't docpmap /e supposed to reformat it with NFTL again after doing that?
It shouldn't be segfaulting though - where's it doing it?
Quoted 3 lines
4. Some odd problems when trying to dd the first 48k. The partition table is not saved after removing the nftl module. Only after writing it a second time does it get saved.
dd from where to where? Did you use the /dev/mtd0 device or /dev/nftla ?
Quoted 3 lines · [email protected] said:
5. One thing I don't understand: even though everybody talks about the first 48k being the firmware, the firmware itself is less than 48k. How does that work?
It's not using all the flash, because the IPL ROM doesn't know how to address the second half of each page of the flash - so it's wasting 8k (I think).
Quoted 1 line
And what about the first 512bytes of the partition table?
That's somewhere in the NFTL.
Quoted 2 lines
Has anybody succeeded in booting off a DiskOnChip 2000 using the MTD drivers?
Not yet. I have grub loading from DiskOnChip, but not then capable of getting a kernel off the NFTL.
--
dwmw2
To unsubscribe, send "unsubscribe mtd" to [email protected]
Quoted 3 lines · Dvir Oren
3. erase seg faults. Is erase supposed to do what docpmap /e does?
You can supply a block number on the command line, and/or apply this patch:
util/erase.c Wed Feb 23 10:23:19 2000 renamed from util/erase.c Tue Aug 17 15:57:08 1999 +1 -1
@@ -35,7 +35,7 @@ erase.length = meminfo.erasesize; printf("Erasesize 0x%lx\n", meminfo.erasesize); - if (argc >= 2) + if (argc > 2) erase.start = atoi(argv[2]); else erase.start = 0;
Also, if you'd like nftl_format not to print gibberish for a usage message:
util/nftl_format.c Wed Feb 16 11:45:10 2000 renamed from util/nftl_format.c Fri Aug 20 08:31:01 1999 +2 -1
@@ -107,7 +107,8 @@ struct mtd_oob_buf oob = {0, 16, oobbuf}; if (argc < 2) { - fprintf(stderr,"Usage: %s <mtddevice> [<start offset> [<size>]]\n"); + fprintf(stderr,"Usage: %s <mtddevice> [<start offset> [<size>]]\n", + argv[0]); return 1; }
To unsubscribe, send "unsubscribe mtd" to [email protected]
Quoted 2 lines · [email protected] said:
You can supply a block number on the command line, and/or apply this
patch:
Committed to CVS. Sorry, that seemed to have slipped the net last time you sent it to me.
--
dwmw2
To unsubscribe, send "unsubscribe mtd" to [email protected]