[U-Boot] [PATCH] Make flash protection work, when the environment is in EEPROM

Sascha Hauer s.hauer at pengutronix.de
Sun Mar 22 23:59:04 CET 2009


Hi Wolgang,

On Sat, Mar 21, 2009 at 09:24:05PM +0100, Wolfgang Denk wrote:
> Dear Jon Smirl,
> 
> In message <9e4733910903211308v63878fabx19f3327371db56c6 at mail.gmail.com> you wrote:
> >
> > My guess is getenv() returns a pointer to the environment variable,
> > not a copy of the environment variable. getenv_r() returns a copy. How
> > can you return a pointer to the variable if the variable is in
> > something not directly addressable like EEPROM?  Does
> 
> The environment always gets copied to RAM. And it's a perfectly simple
> thing to return an adress pointing to some memory in RAM :-)
> 
> > getenv("unlock"); do what you want when the environment is in EEPROM?
> 
> getenv() always works that way, no matter which actual media is used
> for the persistent storage of the environment.

This is not quite true. In the PPC init sequence flash_init() is called
before env_relocate() and thus getenv is not available in flash_init().
Please note that this was just a quick way for us to make things work
and I never considered this a fix for mainline.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


More information about the U-Boot mailing list