Skip to contentSkip to conversation

overwrite complete flash

DISCUSSION Markus Borchers 3 participants 5 messages Jan 13, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hello everyone,

during an firmware-update-process I want to overwrite the complete flash with one image.

My system is an Intel IXP425-based custom board with RedBoot, linux version 2.4.18, root on jffs2, 5 MTD partitions on "IXP425 Flash":
0x00000000-0x00040000 : "RedBoot"
0x00040000-0x000e0000 : "kernel"
0x00100000-0x007c0000 : "root"
0x007c0000-0x007e0000 : "RedBoot config"
0x007e0000-0x00800000 : "FIS directory"

I know that I can overwrite a complete partition (e.g. /dev/mtdblock1 = kernel), but then the update-process depends on the partition table.

I miss a device-file (like /dev/hda) to have access independent of any partitions.

I found the implementation of the struct map_info ixp425_map in drivers/mtd/maps/ixp425.c with the functions

read16:     ixp425_read16,
write16:    ixp425_write16

After exporting that symbol I can use this funktions with my own kernel-modul.

The reading works but the writing not.

Any hints?

Thanks in advance!
Markus

#1 lore raw
Quoted 3 lines · Markus Borchers

I miss a device-file (like /dev/hda) to have access independent of any partitions.

Should be just like /dev/hda - look for the device with minor number 0 or create it, if you don't have it.

brw-rw----    1 root     disk       3,   0 Mar 14  2002 /dev/hda
brw-rw----    1 root     disk       3,   1 Mar 14  2002 /dev/hda1
brw-rw----    1 root     disk       3,   2 Mar 14  2002 /dev/hda2
brw-rw-rw-    1 root     root      31,   0 Jan  1  1970 /dev/mtdblock0
brw-rw-rw-    1 root     root      31,   1 Jan  1  1970 /dev/mtdblock1
brw-rw-rw-    1 root     root      31,   2 Jan  1  1970 /dev/mtdblock2

The names may not be optimal, feel free to use different ones.

Jörn

Signature · 2 lines
Do not stop an army on its way home.
-- Sun Tzu
#2 lore raw
Quoted 5 lines · Jörn Engel
Quoted 2 lines

I miss a device-file (like /dev/hda) to have access independent of any partitions.

Should be just like /dev/hda - look for the device with minor number 0 or create it, if you don't have it.

That's not normally the case. It's _possible_ for the map driver to register the whole device first, and then the partitions -- but most don't.

Signature · 1 line
dwmw2
#3 lore raw
Quoted 11 lines · David Woodhouse
Quoted 5 lines · Jörn Engel
Quoted 2 lines

I miss a device-file (like /dev/hda) to have access independent of any partitions.

Should be just like /dev/hda - look for the device with minor number 0 or create it, if you don't have it.

That's not normally the case. It's _possible_ for the map driver to register the whole device first, and then the partitions -- but most don't.

/dev/mtdblock0 (minor 0) is partition 0 (RedBoot).
If it _is_ possible to register the whole device first, what do I have to do?

#4 lore raw
Quoted 4 lines · Markus Borchers

/dev/mtdblock0 (minor 0) is partition 0 (RedBoot).
If it _is_ possible to register the whole device first, what do I have to do?

Change the code. Should be pretty simple, a couple of lines. What is your mapping driver?

BTW: Imo there is no sane reason, _not_ to register the whole device. Ever. Laziness is a reason, just not sane.

Jörn

Signature · 2 lines
Time? What's that? Time is only worth what you do with it.
-- Theo de Raadt