mtdparts howto required!!
Greetings
I'm trying to map 3 partitions into a single flash device using the mtdparts command line stuff. I'm using a 2.4.22 kernel cross compiled from i686 to PowerPC with mtd patches from CVS as of 19th Feb.
My Linux config is:
# Memory Technology Devices (MTD)CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not setCONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_CONCAT is not set
# CONFIG_MTD_REDBOOT_PARTS is not setCONFIG_MTD_CMDLINE_PARTS=yCONFIG_MTD_CHAR=yCONFIG_MTD_BLOCK=yCONFIG_MTD_CFI=y
# CONFIG_MTD_JEDECPROBE is not setCONFIG_MTD_GEN_PROBE=y
# CONFIG_MTD_CFI_ADV_OPTIONS is not setCONFIG_MTD_CFI_INTELEXT=y
# CONFIG_MTD_CFI_AMDSTD is not set
# CONFIG_MTD_CFI_STAA is not setCONFIG_MTD_CFI_UTIL=y
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
# CONFIG_MTD_OBSOLETE_CHIPS is not set
# CONFIG_MTD_AMDSTD is not set
# CONFIG_MTD_SHARP is not set
# CONFIG_MTD_JEDEC is not set
# CONFIG_MTD_COMPLEX_MAPPINGS is not setCONFIG_MTD_PHYSMAP=yCONFIG_MTD_PHYSMAP_START=40000000CONFIG_MTD_PHYSMAP_LEN=400000CONFIG_MTD_PHYSMAP_BUSWIDTH=2
# CONFIG_MTD_CFI_FLAGADM is not set
# CONFIG_MTD_PCI is not set
# CONFIG_MTD_PCMCIA is not set
# Self-contained MTD device drivers
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_MTDRAM is not set
# CONFIG_MTD_BLKMTD is not set
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOC2001PLUS is not set
# CONFIG_MTD_DOCPROBE is not set
# CONFIG_MTD_NAND is not set
My Linux boot command line is:
mtdparts=phys:7M(jffs2),256K(u-boot),-(kernel)
and when I turn on debugging in cmdlineparts I see:
DEBUG-CMDLINE-PART: parsing <7M(jffs2),256K(u-Boot),-(kernel)>
DEBUG-CMDLINE-PART: partition 2: name <kernel>, offset 0, size ffffffff, mask flags 0
DEBUG-CMDLINE-PART: partition 1: name <u-Boot>, offset 0, size 40000, mask flags 0
DEBUG-CMDLINE-PART: partition 0: name <jffs2>, offset 0, size 700000, mask flags 0
DEBUG-CMDLINE-PART: mtdid=<phys> num_parts=<3>
So what happened to the offsets? Shouldn't they allow for the size of the previous partition? and when I look in /proc/mtd I see:
/ # cat /proc/mtd
dev: size erasesize name
mtd0: 00800000 00010000 "Physically mapped flash"
So what happened to the partitions I just parsed?
Other information reported at boot (note: RedBoot not enabled) is:
physmap flash device: 400000 at 40000000
Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit mode
Intel/Sharp Extended Query Table at 0x0035cfi_cmdset_0001: Erase suspend on write enabled
Using buffer write method
kmod: failed to exec /sbin/modprobe -s -k RedBoot, errno = 2 RedBoot partition parsing not available
Signature · 5 lines
Robin Gilks Senior Design Engineer Phone: (+64)(3) 357 1569 Tait Electronics Fax : (+64)(3) 359 4632 PO Box 1645 Christchurch Email : [email protected] New Zealand
Don't you just love it when someone replies to their own post!!
Problem solved - it would be nice if it were written down somewhere that the physmap.c example is only that - a non-working example in that it doesn't define a master mtd device which means you can't define the partitions on it!!
Also, when a master device is defined there is nothing to indicate that the mtdparts command line has to use the same name as the mtd_id - in fact I've found nothing that defines what mtd_id is. Who would have believed that I needed a command line of the form mtdparts=phys_mapped_flash:7M(jffs2),256K(u-boot),-(kernel)
in order to use the default name (which doesn't work for reasons above anyway!!)
Oh well - its kept me entertained for 3 days instead of doing real work...
Quoted 4 lines · Robin Gilks
Greetings
I'm trying to map 3 partitions into a single flash device using the mtdparts command line stuff. I'm using a 2.4.22 kernel cross compiled from i686 to PowerPC with mtd patches from CVS as of 19th Feb.
[snip]
Signature · 5 lines
Robin Gilks Senior Design Engineer Phone: (+64)(3) 357 1569 Tait Electronics Fax : (+64)(3) 359 4632 PO Box 1645 Christchurch Email : [email protected] New Zealand
Quoted 1 line · Robin Gilks
Don't you just love it when someone replies to their own post!!
I do when they've solved their own problem. :)
Quoted 4 lines
Problem solved - it would be nice if it were written down somewhere that the
physmap.cexample is only that - a non-working example in that it doesn't define a master mtd device which means you can't define the partitions on it!!
I'm not sure I understand this. What does physmap.c need to do other than passing in the 'master' mtd device as the first argument to parse_mtd_partitions()?
Quoted 3 lines
Also, when a master device is defined there is nothing to indicate that the mtdparts command line has to use the same name as the
mtd_id- in fact I've found nothing that defines whatmtd_idis.
cmdlinepart.c line 13:
* <mtd-id> := unique name used in mapping driver/device
I'll add '(mtd->name)' to that in the hope of making it clearer.
Quoted 1 line
Oh well - its kept me entertained for 3 days instead of doing real work...
Patches to improve documentation are always welcome :)
Signature · 1 line
dwmw2
Quoted 1 line · David Woodhouse
On Thu, 2004-03-18 at 12:30 +1300, Robin Gilks wrote:
[snip]
Quoted 4 lines
I'm not sure I understand this. What does
physmap.cneed to do other than passing in the 'master' mtd device as the first argument toparse_mtd_partitions()?
The ioremap fails before it can get this far because there is no start address or size defined for the default device. I've patched in a generic map as follows and its then fine.
struct map_info physmap_map = {
.name = "phys_mapped_flash",
.size = CONFIG_MTD_PHYSMAP_LEN,
.buswidth = CONFIG_MTD_PHYSMAP_BUSWIDTH,
.phys = CONFIG_MTD_PHYSMAP_START,
};
I may have missed something here - perhaps something is supposed to set these values by probing but if thats the case I've missed it I'm afraid!!
Signature · 5 lines
Robin Gilks Senior Design Engineer Phone: (+64)(3) 357 1569 Tait Electronics Fax : (+64)(3) 359 4632 PO Box 1645 Christchurch Email : [email protected] New Zealand