From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sascha Hauer Date: Sun, 22 Mar 2009 23:59:04 +0100 Subject: [U-Boot] [PATCH] Make flash protection work, when the environment is in EEPROM In-Reply-To: <20090321202405.A557B832E406@gemini.denx.de> References: <20090321135934.12464.65400.stgit@localhost> <20090321195213.17AA7832E406@gemini.denx.de> <9e4733910903211308v63878fabx19f3327371db56c6@mail.gmail.com> <20090321202405.A557B832E406@gemini.denx.de> Message-ID: <20090322225904.GD20099@pengutronix.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Wolgang, On Sat, Mar 21, 2009 at 09:24:05PM +0100, Wolfgang Denk wrote: > Dear Jon Smirl, > > In message <9e4733910903211308v63878fabx19f3327371db56c6@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 |