public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] NOR sectors are not all protected as they should be.
@ 2011-02-09 16:02 Alexandre Gambier
  2011-02-09 18:50 ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Gambier @ 2011-02-09 16:02 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] NOR sectors are not all protected as they should be.
  2011-02-09 16:02 [U-Boot] NOR sectors are not all protected as they should be Alexandre Gambier
@ 2011-02-09 18:50 ` Wolfgang Denk
  2011-02-10  8:12   ` Alexandre Gambier
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2011-02-09 18:50 UTC (permalink / raw)
  To: u-boot

Dear Alexandre Gambier,

In message <4D52BA80.4060405@ftemaximal.fr> 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
...
> 
> 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

-- 
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 <8162@jpl-devvax.JPL.NASA.GOV>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] NOR sectors are not all protected as they should be.
  2011-02-09 18:50 ` Wolfgang Denk
@ 2011-02-10  8:12   ` Alexandre Gambier
  2011-02-10  9:48     ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Gambier @ 2011-02-10  8:12 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang,

Thanks for your reply and your help.

On 02/09/2011 07:50 PM, Wolfgang Denk wrote:
>
>> 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.

> 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.
>
> Best regards,
>
> Wolfgang Denk
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] NOR sectors are not all protected as they should be.
  2011-02-10  8:12   ` Alexandre Gambier
@ 2011-02-10  9:48     ` Wolfgang Denk
  2011-02-10  9:52       ` Alexandre Gambier
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2011-02-10  9:48 UTC (permalink / raw)
  To: u-boot

Dear Alexandre Gambier,

In message <4D539E01.6070500@ftemaximal.fr> you wrote:
> 
> > 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

-- 
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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] NOR sectors are not all protected as they should be.
  2011-02-10  9:48     ` Wolfgang Denk
@ 2011-02-10  9:52       ` Alexandre Gambier
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Gambier @ 2011-02-10  9:52 UTC (permalink / raw)
  To: u-boot

Ok.

Thank you very much.

On 02/10/2011 10:48 AM, Wolfgang Denk wrote:
> Dear Alexandre Gambier,
>
> In message<4D539E01.6070500@ftemaximal.fr>  you wrote:
>>> 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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-10  9:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-09 16:02 [U-Boot] NOR sectors are not all protected as they should be Alexandre Gambier
2011-02-09 18:50 ` Wolfgang Denk
2011-02-10  8:12   ` Alexandre Gambier
2011-02-10  9:48     ` Wolfgang Denk
2011-02-10  9:52       ` Alexandre Gambier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox