
Dear Jon,
in message 9e4733910903222001h54568fao2f96dcbdc8925df5@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