mtd_debug usage
Ricard Wanderlof
ricard.wanderlof at axis.com
Fri Nov 24 04:57:02 EST 2006
On Wed, 22 Nov 2006, Duke wrote:
> However, What does the following mean?
>
> #mtd_debug write /dev/mtd2 0x0 0x600000 testfs_cramfs
> file_to_flash: fread, size 0x600000, n 0x600000
> fread(): Success
>
> Does that mean it will write to mtd2 which starts at physical address
> 0x200000 (to 0x800000) or does it actually start at physical address
> 0x0?
> what does the n means?
> I'm not writing to flash correctly so maybe I'm missing something.
Your mtd2 partition starts at physical 0x200000, which means that when
writing to offset 0 of that partition, you write to physical address
0x200000.
The output from mtd_debug is not terribly lucid. It is after all more of a
debugging tool. When it says 'file_to_flash:...' it means it didn't think
the file was read properly. How big is your file (testfs_cramfs)? If you
specify a size of 0x600000 then mtd_debug write will try to read 0x600000
bytes from the file, and fail like it does above if it cannot find it all.
The 'fread(): Success' line indicates that the read actually went well,
but bumped into an end-of-file before all data could be read.
I would suggest using the flash_eraseall tool to first erase the
partition, e.g. flash_eraseall /dev/mtd2, followed by a simple cat or dd
of the image file to the device, e.g. cat testfs_cramfs > /dev/mtd2 .
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
More information about the linux-mtd
mailing list