public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Dvir Oren <dviro@ibm.net>
Cc: mtd@infradead.org
Subject: Re: Questions about MTD
Date: Tue, 21 Mar 2000 09:01:08 +0000	[thread overview]
Message-ID: <30814.953629268@devel2.axiom.internal> (raw)
In-Reply-To: <E12X9bX-00042l-00@infradead.org>


dviro@ibm.net 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.


> 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.


dviro@ibm.net said:
> 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. 

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.


dviro@ibm.net 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 majordomo@infradead.org

  reply	other threads:[~2000-03-21  9:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-20 19:34 Questions about MTD Dvir Oren
2000-03-21  9:01 ` David Woodhouse [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-03-21 12:36 Oron Ogdan
2000-03-20 20:51 Oron Ogdan
2000-03-20 20:51 Oron Ogdan
2000-03-21  2:59 ` Kyle Harris
2000-03-20 14:11 Oron Ogdan
2000-03-20 16:17 ` Kyle Harris
2000-03-20 11:17 Oron Ogdan
2000-03-20 13:51 ` Kyle Harris
2000-03-18 20:05 Dvir Oren
2000-03-20  9:41 ` David Woodhouse
2000-03-20 18:06 ` Bill Roman
2000-03-20 18:49   ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30814.953629268@devel2.axiom.internal \
    --to=dwmw2@infradead.org \
    --cc=dviro@ibm.net \
    --cc=mtd@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox