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

Wolfgang Denk wd at denx.de
Mon Mar 23 09:15:32 CET 2009


Dear Jon,

in message <9e4733910903222001h54568fao2f96dcbdc8925df5 at mail.gmail.com> you wrote:
>
> >> > 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().

I see. You are right.

> > Please note that this was just a quick way for us to make things work
> > and I never considered this a fix for mainline.
> 
> What is your fix for mainline?

We cannot run env_relocate() before flash_init(), as  (with  environ-
ment  stored  in flash) we need an initialized flash memory to do so.
Consequently, we indeed have to use getenv_r() instead of getenv().


Stefan, will you pick up the original patch, please:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/56275

Hm, you might want to change "char s[4];" into "char s[256];" or
similar, though, to make buffer overflows less likely.

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
I used to be indecisive, now I'm not sure.


More information about the U-Boot mailing list