Questions about MTD
Quoted 8 lines
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
When I do dd if=/dev/nftla of=some_file bs=512 count=1, what do I get?
When I do dd if=/dev/mtd0 of=some_file bs=512 count=1, what do I get?
When I do dd if=/dev/nftla of=some_file bs=48k count=1, what do I get?
When I do dd if=/dev/mtd0 of=some_file bs=48k count=1, what do I get?
Quoted 6 lines
If this is after you've previously used
nftl_formatwithout 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.
Suppose I take a brand new flash, run nftl_format /dev/mtd0 49152.
I then run fdisk /dev/nftla to create the partition, and then mke2fs/dev/nftla1, and then reboot, or remove the modules, and then insert them. When I'll mount /dev/nftla1, it will be trashed. Before I took out the module, I could mount, e2fsck, or whatever, and everything was fine.
I have some other weird problems:
I run nftl_format, create a partition, remove the module, then insert it, and I get an invalid partition.
And at some point the drivers compiled into the 2.3 kernel stopped writing nftla: nftla1 after writing the partition table in fdisk. The modules still do it.
Quoted 4 lines
The firmware that comes from M-Systems isn't supposed to be just loaded directly into the flash - which is what
doc_loadbiosdoes. 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.
Then what should I pass doc_loadbios, and why not simply dd (and to where should I dd, and from where should I dd)?
Quoted 2 lines
Not yet. I have grub loading from DiskOnChip, but not then capable of getting a kernel off the NFTL.
I posted here a lilo that should work with MTD. I'll repost it.
Quoted 11 lines
--
dwmw2
To unsubscribe, send "unsubscribe mtd" to [email protected]
Quoted 2 lines · [email protected] said:
When I do dd if=/dev/nftla of=some_file bs=512 count=1, what do I
get?
This goes through the NFTL translation code, and you get the boot sector of the simulated hard disk.
Quoted 2 lines
When I do dd if=/dev/mtd0 of=some_file bs=512 count=1, what do I get?
The first 512 bytes of the raw data on the flash, which is the start of the firmware bootloader.
Quoted 6 lines · [email protected] said:
Suppose I take a brand new flash, run
nftl_format/dev/mtd049152.
I then run fdisk/dev/nftlato create the partition, and then mke2fs/dev/nftla1, and then reboot, or remove the modules, and then insert them. When I'll mount/dev/nftla1, it will be trashed. Before I took out the module, I could mount, e2fsck, or whatever, and everything was fine.
You need to remove the NFTL module before using nftl_format, and then load it again afterwards. The NFTL code caches a lot of data about what blocks are stored where on the flash, and if you reformat the NFTL while it's loaded, you're going to confuse the hell out of it.
Quoted 2 lines · [email protected] said:
Then what should I pass
doc_loadbios, and why not simply dd (and to
where should I dd, and from where should I dd)?
doc_loadbios is almost the same as dd - it just erases the blocks before writing to them.
You need to convert the DOC121.EXB file into the form in which it actually takes on the flash. It's probably easier to explain in pseudo-C than English:
u_char buf[512];
memset(buf,255,512);
/* Split up the first 4Kb of data over the first 8Kb of flash */
while (x<8192) {
read(0,buf,256);
write(1,buf,512);
x += 512;
}
/* Add the rest */
while (!eof) {
read(0,buf,512);
write(1,buf,512);
}I'm not sure if this is right, but it's something like that. Try comparing what you get by dd'ing 48Kb _from_ /dev/mtd0 with the data in the file.
--
dwmw2
To unsubscribe, send "unsubscribe mtd" to [email protected]