Skip to contentSkip to conversation

no mtdparted from U-Boot> prompt

U-Boot johns at msli.com 5 participants 7 messages Dec 20, 2012 – Dec 22, 2012

lore
Share & tools
lore
#0 lore raw

This is my first post to the list.
I am using u-boot-1.3.4 in buildroot-2011.11 My device is a at91sam9g20-ek
I have a patch adding: include/configs/at91sam9g20ek.h which I gather acts as a config file for u-boot.

U-Boot> help
does not list mtdparts

But my bootargs does use it:
bootargs=mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2

Is there a trick to add the mtdparts command? Or is there supposed to be a command?

I unsuccessfully added to include/configs/at91sam9g20ek.h #define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2 1 // Required to include cmd_jffs2.c which did not result in adding the command line.

NOTICE: This email may contain confidential information. Please see http://www.meyersound.com/confidential/ for our complete policy.

#1 lore raw

Hi Johns,

Quoted 11 lines · johns at msli.com

This is my first post to the list.
I am using u-boot-1.3.4 in buildroot-2011.11 My device is a at91sam9g20-ek
I have a patch adding: include/configs/at91sam9g20ek.h which I gather acts as a config file for u-boot.

U-Boot> help
does not list mtdparts

But my bootargs does use it:
bootargs=mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2

This mtdparts is defined for Linux kernel NAND driver.

Quoted 2 lines

Is there a trick to add the mtdparts command?

Yes, you need to add "#define CONFIG_CMD_MTDPARTS" in

include/configs/at91sam9g20ek.h

Quoted 16 lines

Or is there supposed to be a command?

I unsuccessfully added to include/configs/at91sam9g20ek.h #define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2 1 // Required to include cmd_jffs2.c which did not result in adding the command line.

NOTICE: This email may contain confidential information. Please see http://www.meyersound.com/confidential/ for our complete policy.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw
Quoted 9 lines · Bo Shen

Hi Johns,

Quoted 6 lines · johns at msli.com

This is my first post to the list.
I am using u-boot-1.3.4 in buildroot-2011.11 My device is a at91sam9g20-ek
I have a patch adding: include/configs/at91sam9g20ek.h which I gather acts as a config file for u-boot.

Quoted 7 lines
Quoted 5 lines

U-Boot> help
does not list mtdparts

But my bootargs does use it:
bootargs=mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2

This mtdparts is defined for Linux kernel NAND driver.

I had the impression there was also an interactive command-line tool for mtdparts, from the u-boot prompt.

Quoted 5 lines
Quoted 2 lines

Is there a trick to add the mtdparts command?

Yes, you need to add "#define CONFIG_CMD_MTDPARTS" in

I added this to include/configs/at91sam9g20ek.h

Now it contains:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_MTDPARTS"

NOTICE: This email may contain confidential information. Please see http://www.meyersound.com/confidential/ for our complete policy.

#3 lore raw
Quoted 13 lines · johns at msli.com
Quoted 12 lines · Bo Shen

Hi Johns,

Quoted 9 lines · johns at msli.com

This is my first post to the list.
I am using u-boot-1.3.4 in buildroot-2011.11 My device is a at91sam9g20-ek
I have a patch adding: include/configs/at91sam9g20ek.h which I gather acts as a config file for u-boot.

U-Boot> help
does not list mtdparts

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

But my bootargs does use it:
bootargs=mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2

This mtdparts is defined for Linux kernel NAND driver.

I had the impression there was also an interactive command-line tool for mtdparts, from the u-boot prompt.

This post give me the impression that there should be a uboot mtdparts command in addtion to the kernel option.
http://stackoverflow.com/questions/8585864/nand-partitioning-in-u-boot

Quoted 20 lines
Quoted 5 lines
Quoted 2 lines

Is there a trick to add the mtdparts command?

Yes, you need to add "#define CONFIG_CMD_MTDPARTS" in

I added this to include/configs/at91sam9g20ek.h

Now it contains:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_MTDPARTS"

NOTICE: This email may contain confidential information. Please see http://www.meyersound.com/confidential/ for our complete policy.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

Dear John Stile,

Quoted 7 lines · In message <1356130404.28896.135.camel@genx> you wrote:
Quoted 3 lines

I had the impression there was also an interactive command-line tool for mtdparts, from the u-boot prompt.

This post give me the impression that there should be a uboot mtdparts command in addtion to the kernel option.
http://stackoverflow.com/questions/8585864/nand-partitioning-in-u-boot

Yes, there is.

For example:

=> mtdparts -?
mtdparts - define flash/nand partitions

Usage:
mtdparts
- list partition table
mtdparts delall
- delete all partitions
mtdparts del part-id
- delete partition (e.g. part-id = nand0,1)
mtdparts add <mtd-dev> <size>[@<offset>] [<name>] [ro]
- add partition
mtdparts default
- reset partition table to defaults

-----

this command uses three environment variables:

'partition' - keeps current partition identifier

partition := <part-id>
<part-id> := <dev-id>,part_num

'mtdids' - linux kernel mtd device id <-> u-boot device id mapping

mtdids=<idmap>[,<idmap>,...]

<idmap>    := <dev-id>=<mtd-id>
<dev-id>   := 'nand'|'nor'|'onenand'<dev-num>
<dev-num>  := mtd device number, 0...
<mtd-id>   := unique device tag used by linux kernel to find mtd device (mtd->name)

'mtdparts' - partition list

mtdparts=mtdparts=<mtd-def>[;<mtd-def>...]

<mtd-def> := <mtd-id>:<part-def>[,<part-def>...]
<mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name)
<part-def> := <size>[@<offset>][<name>][<ro-flag>]

<size>     := standard linux memsize OR '-' to denote all remaining space
<offset>   := partition start offset within the device
<name>     := '(' NAME ')'
<ro-flag>  := when set to 'ro' makes partition read-only (not used, passed to kernel)

=> mtdparts

device nor0 <fc000000.flash>, # parts = 7

 #: name                size            offset          mask_flags
 0: firmware            0x00100000      0x00000000      0
 1: dtb                 0x00040000      0x00100000      0
 2: kernel              0x00240000      0x00140000      0
 3: small-fs            0x00280000      0x00380000      0
 4: initrd              0x00200000      0x00600000      0
 5: misc                0x00800000      0x00800000      0
 6: big-fs              0x01000000      0x01000000      0

active partition: nor0,0 - (firmware) 0x00100000 @ 0x00000000

defaults:
mtdids : nor0=fc000000.flash
mtdparts: mtdparts=fc000000.flash:1m(firmware),256k(dtb),2304k(kernel),2560k(small-fs),2m(initrd),8m(misc),16m(big-fs) =>

Quoted 5 lines
Quoted 5 lines

Now it contains:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_MTDPARTS"

If this is an exact copy, then please remove this '"'

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If you're not part of the solution, then you're part of the  precipi-
tate.
#5 lore raw
Quoted 82 lines · Wolfgang Denk

Dear John Stile,

Quoted 7 lines · In message <1356130404.28896.135.camel@genx> you wrote:
Quoted 3 lines

I had the impression there was also an interactive command-line tool for mtdparts, from the u-boot prompt.

This post give me the impression that there should be a uboot mtdparts command in addtion to the kernel option.
http://stackoverflow.com/questions/8585864/nand-partitioning-in-u-boot

Yes, there is.

For example:

=> mtdparts -?
mtdparts - define flash/nand partitions

Usage:
mtdparts
- list partition table
mtdparts delall
- delete all partitions
mtdparts del part-id
- delete partition (e.g. part-id = nand0,1)
mtdparts add <mtd-dev> <size>[@<offset>] [<name>] [ro]
- add partition
mtdparts default
- reset partition table to defaults

-----

this command uses three environment variables:

'partition' - keeps current partition identifier

partition := <part-id>
<part-id> := <dev-id>,part_num

'mtdids' - linux kernel mtd device id <-> u-boot device id mapping

mtdids=<idmap>[,<idmap>,...]

<idmap>    := <dev-id>=<mtd-id>
<dev-id>   := 'nand'|'nor'|'onenand'<dev-num>
<dev-num>  := mtd device number, 0...
<mtd-id>   := unique device tag used by linux kernel to find mtd device (mtd->name)

'mtdparts' - partition list

mtdparts=mtdparts=<mtd-def>[;<mtd-def>...]

<mtd-def> := <mtd-id>:<part-def>[,<part-def>...]
<mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name)
<part-def> := <size>[@<offset>][<name>][<ro-flag>]

<size>     := standard linux memsize OR '-' to denote all remaining space
<offset>   := partition start offset within the device
<name>     := '(' NAME ')'
<ro-flag>  := when set to 'ro' makes partition read-only (not used, passed to kernel)

=> mtdparts

device nor0 <fc000000.flash>, # parts = 7

 #: name                size            offset          mask_flags
 0: firmware            0x00100000      0x00000000      0
 1: dtb                 0x00040000      0x00100000      0
 2: kernel              0x00240000      0x00140000      0
 3: small-fs            0x00280000      0x00380000      0
 4: initrd              0x00200000      0x00600000      0
 5: misc                0x00800000      0x00800000      0
 6: big-fs              0x01000000      0x01000000      0

active partition: nor0,0 - (firmware) 0x00100000 @ 0x00000000

defaults:
mtdids : nor0=fc000000.flash
mtdparts: mtdparts=fc000000.flash:1m(firmware),256k(dtb),2304k(kernel),2560k(small-fs),2m(initrd),8m(misc),16m(big-fs) =>

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

Now it contains:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_MTDPARTS"

If this is an exact copy, then please remove this '"'

It actually reads this:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2 1 // Required to include cmd_jffs2.c #define CONFIG_CMD_MTDPARTS 1 // Required for mtdparts command in uboot

But the command is not available on my system. Would it help to post my .h or maybe my build log?

#6 lore raw

Hi,

On Fri, 21 Dec 2012 16:00:46 -0800
John Stile <[email protected]> wrote:
...

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

Now it contains:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_MTDPARTS"

Quoted 8 lines
Quoted 2 lines

If this is an exact copy, then please remove this '"'

It actually reads this:
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_CMD_JFFS2 1 // Required to include cmd_jffs2.c #define CONFIG_CMD_MTDPARTS 1 // Required for mtdparts command in uboot

Adding CONFIG_CMD_MTDPARTS won't work, this option is not available in this very old U-Boot v1.3.4. CONFIG_JFFS2_CMDLINE should add mtdparts command. Please double check where you add this option and ensure that it is not added in some #ifdef ... #elif ... #endif construct. Depending on the CFG_USE_* build options some options in the config file may have no effect at all.

Quoted 2 lines

But the command is not available on my system. Would it help to post my .h or maybe my build log?

It might help.

Thanks,
Anatolij