[U-Boot] where *precisely* is u-boot's environment stored?
Måns Rullgård
mans at mansr.com
Wed Jul 6 12:21:07 CEST 2016
"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,
overwriting anything that was previously there. On startup, u-boot
checks if the saved environment is valid and uses it if it is. If not,
the defaults (as configured for the board) are used. Only the saveenv
command writes anything to nonvolatile storage.
--
Måns Rullgård
More information about the U-Boot
mailing list