Skip to contentSkip to conversation

Can't erase or read NOR using mtd part-id

U-Boot Alexandre Gambier 3 participants 6 messages Feb 9, 2011 – Feb 10, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

I'm using u-boot to boot a Linux-based device.
I created some MTD partitions for my NOR and NAND flashes.

Here is the configuration:

device nor0 <NOR>, # parts = 4
#: name size offset mask_flags

  0: U-Boot              0x00080000      0x00000000      0
  1: Environment         0x00020000      0x00080000      0
  2: Kernel              0x00400000      0x000a0000      0
  3: FreeNOR             0x00360000      0x004a0000      0

device nand0 <NAND>, # parts = 2
#: name size offset mask_flags

  0: FS                  0x02000000      0x00000000      0
  1: FreeNAND            0x06000000      0x02000000      0

active partition: nor0,0 - (U-Boot) 0x00080000 @ 0x00000000

defaults:
mtdids : nor0=NOR,nand0=NAND
mtdparts:
mtdparts=NOR:512k(U-Boot),128k(Environment),4M(Kernel),-(FreeNOR);NAND:32M(FS),-(FreeNAND)

When I want to erase the U-Boot partition I can't use the command erase U-Boot, the following error occurs : "incorrect device type in U-Boot". I must use the command erase 1:0-7.

Is-it normal ?

My second question is when I try to read the Environment partition with the command md.b Environment 128 I get the following dump (which is not correct).

0000000e: 0e 40 ff e0 18 40 c0 cb 18 40 18 40 0c cb 03 61 . at ...@... at [email protected]
0000001e: a5 e0 18 40 01 21 1f e0 18 40 ff cb 18 40 ff cb ... at .!... at ...@..
0000002e: 18 40 ff cb 03 64 b5 c7 03 69 92 6a a8 39 b4 da . at ...d...i.j.9..
0000003e: b6 db 90 3a 29 08 49 29 f6 e0 18 40 10 cb 18 40 ...:).I)... at ...@
0000004e: 18 40 03 61 00 e2 01 e3 18 43 01 e0 3c 31 22 21 . at .a.....C..<1"!
0000005e: 0f 88 fb 8f 01 70 80 e0 18 40 18 40 18 40 03 61 .....p... at .@. at .a
0000006e: f6 e0 18 40 10 cb 18 40 18 40 12 20 40 e0 18 40 ... at ...@. at .
@..@
0000007e: 18 40 03 cb 18 40 80 cb 03 61 f7 e0 18 40 10 cb . at [email protected]... at ..
0000008e: 18 40 18 40 12 20 90 e0 18 40 18 40 18 40 03 61 . at .@.
... at .@. at .a
0000009e: f6 e0 18 40 10 cb 18 40 02 cb 18 40 12 20 40 e0 ... at ...@... at . @.
000000ae: 18 40 18 40 03 cb 18 40 80 cb 03 61 f7 e0 18 40 . at .@... at ...a...@
000000be: 10 cb 18 40 02 cb 18 40 12 20 88 e0 18 40 18 40 ... at ...@.
... at .@
000000ce: 18 40 03 61 f6 e0 18 40 10 cb 18 40 01 cb 18 40 . at .a...@... at ...@
000000de: 12 20 48 e0 18 40 18 40 03 cb 18 40 80 cb 03 61 .
H.. at .@... at ...a
000000ee: f7 e0 18 40 10 cb 18 40 01 cb 18 40 12 20 98 e0 ... at ...@... at . ..
000000fe: 18 40 18 40 18 40 03 61 f6 e0 18 40 10 cb 18 40 . at .@. at .a...@...@
0000010e: 03 cb 18 40 12 20 48 e0 18 40 18 40 03 cb 18 40 ... at .
H.. at .@...@
0000011e: 80 cb 03 61 f7 e0 18 40 10 cb 18 40 03 cb 18 40 ...a... at ...@...@
0000012e: 12 20 a0 e0 18 40 18 40 . ...@.@

If use the command md.b 0xA0080000 128 I get the right dump...

a0080000: 0e c8 12 74 62 6f 6f 74 64 65 6c 61 79 3d 31 30 ...tbootdelay=10
a0080010: 00 62 61 75 64 72 61 74 65 3d 31 31 35 32 30 30 .baudrate=115200
a0080020: 00 62 6f 61 72 64 3d 73 6b 79 77 6f 72 74 68 00 .board=skyworth.
a0080030: 6d 6f 6e 69 74 6f 72 5f 62 61 73 65 3d 30 78 41 monitor_base=0xA
a0080040: 30 30 30 30 30 30 30 00 6d 6f 6e 69 74 6f 72 5f 0000000.monitor_
a0080050: 6c 65 6e 3d 30 78 30 30 30 38 30 30 30 30 00 6d len=0x00080000.m
a0080060: 6f 6e 69 74 6f 72 5f 73 65 63 3d 31 3a 30 2d 37 onitor_sec=1:0-7
a0080070: 00 6c 6f 61 64 5f 61 64 64 72 3d 30 78 38 30 30 .load_addr=0x800
a0080080: 30 30 30 30 30 00 65 74 68 61 64 64 72 3d 30 30 00000.ethaddr=00
a0080090: 3a 30 65 3a 65 62 3a 30 30 3a 33 34 3a 62 63 00 :0e:eb:00:34:bc.
a00800a0: 73 65 72 76 65 72 69 70 3d 31 39 32 2e 31 36 38 serverip=192.168
a00800b0: 2e 31 2e 36 30 00 69 70 61 64 64 72 3d 31 39 32 .1.60.ipaddr=192
a00800c0: 2e 31 36 38 2e 31 2e 31 31 30 00 66 69 72 73 74 .168.1.110.first
a00800d0: 5f 69 6e 69 74 3d 6d 74 64 20 64 65 6c 20 61 6c _init=mtd
del al
a00800e0: 6c 3b 72 75 6e 20 65 72 61 73 65 5f 6e 6f 72 3b l;run
erase_nor;
a00800f0: 6d 74 64 20 64 65 66 61 75 6c 74 3b 73 61 76 65 mtd
default;save
a0080100: 65 6e 76 3b 72 75 6e 20 75 70 64 61 74 65 5f 75 env;run
update_u
a0080110: 62 6f 6f 74 00 65 72 61 73 65 5f 6e 6f 72 3d 70 boot.erase_nor=p
a0080120: 72 6f 74 65 63 74 20 6f rotect o

Is-it normal as well ?

Thanls in advance for your help.
Alex.

#1 lore raw

Hello,

Quoted 1 line · On Wednesday 09 February 2011, 16:52:35 Alexandre Gambier wrote:

I'm using u-boot to boot a Linux-based device.

Which version og u-boot are you running?

Quoted 24 lines

I created some MTD partitions for my NOR and NAND flashes.

Here is the configuration:

device nor0 <NOR>, # parts = 4
#: name size offset mask_flags

  0: U-Boot              0x00080000      0x00000000      0
  1: Environment         0x00020000      0x00080000      0
  2: Kernel              0x00400000      0x000a0000      0
  3: FreeNOR             0x00360000      0x004a0000      0

device nand0 <NAND>, # parts = 2
#: name size offset mask_flags

  0: FS                  0x02000000      0x00000000      0
  1: FreeNAND            0x06000000      0x02000000      0

active partition: nor0,0 - (U-Boot) 0x00080000 @ 0x00000000

defaults:
mtdids : nor0=NOR,nand0=NAND
mtdparts:
mtdparts=NOR:512k(U-Boot),128k(Environment),4M(Kernel),-(FreeNOR);NAND:32M( FS),-(FreeNAND)

Quoted 5 lines

When I want to erase the U-Boot partition I can't use the command erase U-Boot, the following error occurs : "incorrect device type in U-Boot". I must use the command erase 1:0-7.

Is-it normal ?

Some old version also had to set CONFIG_JFFS2 to get erase & friends to accept mtdparts.

HTH
Alexander

#2 lore raw

Hello,

thanks for your reply.
I'm running u-boot 1.3.1. I got it from STLinux.

I will try to set CONFIG_JFFS2.
But does it mean it will erase the partition using JFFS2 ? Will it support to read and write the environment settings with this file format ?

Alex

Quoted 41 lines · Alexander Stein

Hello,

Quoted 1 line · On Wednesday 09 February 2011, 16:52:35 Alexandre Gambier wrote:

I'm using u-boot to boot a Linux-based device.

Which version og u-boot are you running?

Quoted 24 lines

I created some MTD partitions for my NOR and NAND flashes.

Here is the configuration:

device nor0<NOR>, # parts = 4
#: name size offset mask_flags

   0: U-Boot              0x00080000      0x00000000      0
   1: Environment         0x00020000      0x00080000      0
   2: Kernel              0x00400000      0x000a0000      0
   3: FreeNOR             0x00360000      0x004a0000      0

device nand0<NAND>, # parts = 2
#: name size offset mask_flags

   0: FS                  0x02000000      0x00000000      0
   1: FreeNAND            0x06000000      0x02000000      0

active partition: nor0,0 - (U-Boot) 0x00080000 @ 0x00000000

defaults:
mtdids : nor0=NOR,nand0=NAND
mtdparts:
mtdparts=NOR:512k(U-Boot),128k(Environment),4M(Kernel),-(FreeNOR);NAND:32M( FS),-(FreeNAND)

Quoted 5 lines

When I want to erase the U-Boot partition I can't use the command erase U-Boot, the following error occurs : "incorrect device type in U-Boot". I must use the command erase 1:0-7.

Is-it normal ?

Some old version also had to set CONFIG_JFFS2 to get erase& friends to accept mtdparts.

HTH
Alexander

#3 lore raw

Hello,

Quoted 2 lines · On Wednesday 09 February 2011, 17:16:37 Alexandre Gambier wrote:

thanks for your reply.
I'm running u-boot 1.3.1. I got it from STLinux.

ouch, that's pretty old.

Quoted 2 lines

I will try to set CONFIG_JFFS2.
But does it mean it will erase the partition using JFFS2 ?

No, the feature depended on both MTDPARTS and JFFS2 which has changed by now. If this doesn't work. I can't help you (see above)

Alexander

#4 lore raw
In reply to Alexandre Gambier

Dear Alexandre Gambier,

Quoted 13 lines · In message <[email protected]> you wrote:

I'm using u-boot to boot a Linux-based device.
I created some MTD partitions for my NOR and NAND flashes.

Here is the configuration:

device nor0 <NOR>, # parts = 4
#: name size offset mask_flags

  0: U-Boot              0x00080000      0x00000000      0
  1: Environment         0x00020000      0x00080000      0
  2: Kernel              0x00400000      0x000a0000      0
  3: FreeNOR             0x00360000      0x004a0000      0

...

Quoted 5 lines

When I want to erase the U-Boot partition I can't use the command erase U-Boot, the following error occurs : "incorrect device type in U-Boot". I must use the command erase 1:0-7.

Is-it normal ?

There are many ways to specify a flash area. When referring to MTD partitions, the synatx is "<device name>,<partition number>", i. e. for the partition named "U-Boot" above you use

erase nor0,0

So yes, the behaviour is normal.

Quoted 6 lines

My second question is when I try to read the Environment partition with the command md.b Environment 128 I get the following dump (which is not correct).

0000000e: 0e 40 ff e0 18 40 c0 cb 18 40 18 40 0c cb 03 61 . at ...@... at [email protected]

...

Only very few commands (and only flash related ones) accept MTD partition specifications for addresses. "md" does not. What happpens here is that the argument "Environment" gets parsed as a hex number. Only the first character, 'E', can successfully be converted, then the conversion stops (without error message). Then you get the dump starting at 0x0000000E.

Quoted 1 line

Is-it normal as well ?

Yes, it is.

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
There are certain things men must do to remain men.
	-- Kirk, "The Ultimate Computer", stardate 4929.4
#5 lore raw

Dear Wolfgang,

Thanks for this explanation.

Best regards
Alex

Quoted 51 lines · Wolfgang Denk

Dear Alexandre Gambier,

Quoted 12 lines · In message<[email protected]> you wrote:

I'm using u-boot to boot a Linux-based device.
I created some MTD partitions for my NOR and NAND flashes.

Here is the configuration:

device nor0<NOR>, # parts = 4
#: name size offset mask_flags

   0: U-Boot              0x00080000      0x00000000      0
   1: Environment         0x00020000      0x00080000      0
   2: Kernel              0x00400000      0x000a0000      0
   3: FreeNOR             0x00360000      0x004a0000      0

...

Quoted 5 lines

When I want to erase the U-Boot partition I can't use the command erase U-Boot, the following error occurs : "incorrect device type in U-Boot". I must use the command erase 1:0-7.

Is-it normal ?

There are many ways to specify a flash area. When referring to MTD partitions, the synatx is "<device name>,<partition number>", i. e. for the partition named "U-Boot" above you use

erase nor0,0

So yes, the behaviour is normal.

Quoted 6 lines

My second question is when I try to read the Environment partition with the command md.b Environment 128 I get the following dump (which is not correct).

0000000e: 0e 40 ff e0 18 40 c0 cb 18 40 18 40 0c cb 03 61 . at ...@... at [email protected]

...

Only very few commands (and only flash related ones) accept MTD partition specifications for addresses. "md" does not. What happpens here is that the argument "Environment" gets parsed as a hex number. Only the first character, 'E', can successfully be converted, then the conversion stops (without error message). Then you get the dump starting at 0x0000000E.

Quoted 1 line

Is-it normal as well ?

Yes, it is.

Best regards,

Wolfgang Denk