nv: Save nv variables on shutdown
With this patch nv variables are automatically saved whenever barebox
shuts down (that is 'reset' is executed or a kernel is started). With
this the additional 'saveenv' step becomes unnecessary.

The nv variables are stored in the environment and the estasblished
behaviour is that files in the environment must be manually saved
using 'saveenv'. This behaviour shall be kept for now, so this patch
cannot just call 'saveenv' since that would save the modified
environment files aswell. Instead we read the environment from the
device, modifiy the nv variables and save the environment back.

Since this changes a long existing behaviour messages are printed the
first time a nv variable is modified and during shutdown when the
variables are actually saved.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent b9ac9a9 commit 3fadbdae1fd5fb3d9a078f29bf2fb6f14d808c00
@Sascha Hauer Sascha Hauer authored on 21 Jul 2016
Showing 3 changed files
View
common/environment.c
View
common/globalvar.c
View
include/globalvar.h