Skip to contentSkip to conversation

NOR sectors are not all protected as they should be.

U-Boot Alexandre Gambier 2 participants 5 messages Feb 9, 2011 – Feb 10, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

I'm using U-Boot with a NOR and a NAND Flash.

U-Boot is stored into the NOR flash.
The NOR flash is setup as :

0xA0000000 -> 0xA0080000 -> 512k -> 8 sectors -> reserved for U-Boot.bin 0xA0080000 -> 0xA00A0000 -> 128k -> 2 sectors -> reserved for U-Boot environment

If I use the command flinfo to see which sectors are protected I see this...

Sector Start Addresses:
A0000000 RO A0010000 RO A0020000 RO A0030000 RO
A0040000 E
A0050000 E A0060000 E A0070000 E A0080000 RO
A0090000 E RO
A00A0000 E A00B0000 E A00C0000 E A00D0000 E
A00E0000 E
A00F0000 E A0100000 E A0110000 E A0120000 E
A0130000 E
A0140000 E A0150000 E A0160000 E A0170000 E
A0180000 E
A0190000 E A01A0000 E A01B0000 E A01C0000 E
A01D0000 E
A01E0000 E A01F0000 E A0200000 E A0210000 E
A0220000 E
A0230000 E A0240000 E A0250000 E A0260000 E
A0270000 E
A0280000 E A0290000 E A02A0000 E A02B0000 E
A02C0000 E
A02D0000 E A02E0000 E A02F0000 E A0300000 E
A0310000 E
A0320000 E A0330000 E A0340000 E A0350000 E
A0360000 E
A0370000 E A0380000 E A0390000 E A03A0000 E
A03B0000 E
A03C0000 E A03D0000 E A03E0000 E A03F0000 E
A0400000 E
A0410000 E A0420000 E A0430000 E A0440000 E
A0450000 E
A0460000 E A0470000 E A0480000 E A0490000 E
A04A0000 E
A04B0000 E A04C0000 E A04D0000 E A04E0000 E
A04F0000 E
A0500000 E A0510000 E A0520000 E A0530000 E
A0540000 E
A0550000 E A0560000 E A0570000 E A0580000 E
A0590000 E
A05A0000 E A05B0000 E A05C0000 E A05D0000 E
A05E0000 E
A05F0000 E A0600000 E A0610000 E A0620000 E
A0630000 E
A0640000 E A0650000 E A0660000 E A0670000 E
A0680000 E
A0690000 E A06A0000 E A06B0000 E A06C0000 E
A06D0000 E
A06E0000 E A06F0000 E A0700000 E A0710000 E
A0720000 E
A0730000 E A0740000 E A0750000 E A0760000 E
A0770000 E
A0780000 E A0790000 E A07A0000 E A07B0000 E
A07C0000 E
A07D0000 E A07E0000 E A07F0000 E

The first sectors #0,1,2,3 are protected and sectors #8,9 (U-Boot environment) are protected.
It should be sectors #0,1,2,3,4,5,6,7 and sectors #8,9.

I had a looked into U-Boot source to find a constant that defines how many sectors should be protected for the monitor but I didn't find it. I guess U-Boot protect these sectors during the boot sequence. What constant must be defined to protect all of the sectors (#0,1,2,3,4,5,6,7) ?

thanks in advance.
Alex

#1 lore raw

Dear Alexandre Gambier,

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

Hello,

I'm using U-Boot with a NOR and a NAND Flash.

U-Boot is stored into the NOR flash.
The NOR flash is setup as :

0xA0000000 -> 0xA0080000 -> 512k -> 8 sectors -> reserved for U-Boot.bin 0xA0080000 -> 0xA00A0000 -> 128k -> 2 sectors -> reserved for U-Boot environment

If I use the command flinfo to see which sectors are protected I see this...

Sector Start Addresses:

   A0000000   RO   A0010000   RO   A0020000   RO   A0030000   RO   A0040000 E
   A0050000 E      A0060000 E      A0070000 E      A0080000   RO   A0090000 E RO
   A00A0000 E      A00B0000 E      A00C0000 E      A00D0000 E      A00E0000 E
   A00F0000 E      A0100000 E      A0110000 E      A0120000 E      A0130000 E

...

Quoted 4 lines

The first sectors #0,1,2,3 are protected and sectors #8,9 (U-Boot environment) are protected.
It should be sectors #0,1,2,3,4,5,6,7 and sectors #8,9.

No, it should not. Only the sectors that actually contain the U-Boot code and environment are protected. Obviously your image is small enough to fit in the first 4 sectors (= 256 KiB). Actually this is a perfectly normal size, and your reservation of 512 KiB was just a waste of memory. You can see that the following sectors are unused from the 'E' (= empty) flag.

When they don't contain any code, there is also no need to pretect them, right?

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
What about WRITING it first and rationalizing it afterwords?  :-)
                       - Larry Wall in <[email protected]>
#2 lore raw

Dear Wolfgang,

Thanks for your reply and your help.

Quoted 10 lines · Wolfgang Denk
Quoted 4 lines

The first sectors #0,1,2,3 are protected and sectors #8,9 (U-Boot environment) are protected.
It should be sectors #0,1,2,3,4,5,6,7 and sectors #8,9.

No, it should not. Only the sectors that actually contain the U-Boot code and environment are protected. Obviously your image is small enough to fit in the first 4 sectors (= 256 KiB). Actually this is a perfectly normal size, and your reservation of 512 KiB was just a waste of memory. You can see that the following sectors are unused from the 'E' (= empty) flag.

Even if the first 4 sectors are empty they are protected (see below). So the protected sectors are not selected depending on if U-Boot is burnt in them, isn't it ?

Sector Start Addresses:
A0000000 E RO A0010000 E RO A0020000 E RO A0030000 E RO
A0040000 E
A0050000 E A0060000 E A0070000 E A0080000 RO
A0090000 E RO
A00A0000 E A00B0000 E A00C0000 E A00D0000 E
A00E0000 E
A00F0000 E A0100000 E A0110000 E A0120000 E
A0130000 E
A0140000 E A0150000 E A0160000 E A0170000 E
A0180000 E
A0190000 E A01A0000 E A01B0000 E A01C0000 E
A01D0000 E
A01E0000 E A01F0000 E A0200000 E A0210000 E
A0220000 E

I know my image fit in 256KiB, my image is 220KiB that I reserved more space just in case for the future releases.

Quoted 2 lines

When they don't contain any code, there is also no need to pretect them, right?

It should be, but it's not completely true.

Best regards.

Quoted 5 lines

Best regards,

Wolfgang Denk

#3 lore raw

Dear Alexandre Gambier,

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

waste of memory. You can see that the following sectors are unused from the 'E' (= empty) flag.

Even if the first 4 sectors are empty they are protected (see below). So the protected sectors are not selected depending on if U-Boot is burnt in them, isn't it ?

No, they are selected based on the real size of the (running) U-Boot image.

Best regards,

Wolfgang Denk

Signature · 4 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
Of course there's no reason for it, it's just our policy.
#4 lore raw

Ok.

Thank you very much.

Quoted 15 lines · Wolfgang Denk

Dear Alexandre Gambier,

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

waste of memory. You can see that the following sectors are unused from the 'E' (= empty) flag.

Even if the first 4 sectors are empty they are protected (see below). So the protected sectors are not selected depending on if U-Boot is burnt in them, isn't it ?

No, they are selected based on the real size of the (running) U-Boot image.

Best regards,

Wolfgang Denk