[U-Boot] where *precisely* is u-boot's environment stored?

Robert P. J. Day rpjday at crashcourse.ca
Wed Jul 6 12:31:30 CEST 2016


On Wed, 6 Jul 2016, Måns Rullgård wrote:

> "Robert P. J. Day" <rpjday at crashcourse.ca> writes:
>
> > On Wed, 6 Jul 2016, Måns Rullgård wrote:
> >
> >> "Robert P. J. Day" <rpjday at crashcourse.ca> writes:
> >
> >> > p.s. how does the default environment get to the
> >> > CONFIG_ENV_ADDR defined in the board header file? is that done
> >> > automatically when u-boot starts to run and notices that there
> >> > is no valid environment info at that address, and therefore
> >> > copies it for you?
> >>
> >> If the stored environment is invalid (e.g. uninitialised), the
> >> built-in default is used.  Nothing is written until you issue a
> >> saveenv command. This saves a copy of the live environment to the
> >> configured location.
> >
> >   ah, that's the final bit of the puzzle i was looking for ... the
> > first time a "saveenv" is done is when the configured location is
> > examined and, if uninitialized, the env is copied there and is
> > used from then on.
>
> saveenv always writes whatever is in memory to the permanent location,

  and by "permanent location", you mean CONFIG_ENV_ADDR as defined in
the board definition file, yes?

> overwriting anything that was previously there.  On startup, u-boot
> checks if the saved environment is valid and uses it if it is.  If

  and, again, by "saved environment", i assume you mean what is at
CONFIG_ENV_ADDR. it's all a matter of terminology -- switching back
and forth can make things confusing.

  not to be overly pedantic (too late!), but is there a preferred
expression for the environment stored at CONFIG_ENV_ADDR? is it
"permanent environment" or "saved environment" or what?

> not, the defaults (as configured for the board) are used.  Only the
> saveenv command writes anything to nonvolatile storage.

  ok, i think i have a handle on this now, thanks.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


More information about the U-Boot mailing list