diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-06-18 15:12:05 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-11-06 10:58:54 +0100 |
commit | 3249006a2facd31a072fd2808991697b4727643e (patch) | |
tree | ec4e5dd4fbd1ea124349a23cb3664bda4ba2e1aa /Documentation/user | |
parent | fe39e8aadc3e2f3d87bb5b6f8c6ebb4fb1a84253 (diff) | |
download | barebox-3249006a2facd31a072fd2808991697b4727643e.tar.gz barebox-3249006a2facd31a072fd2808991697b4727643e.tar.xz |
Add support for non volatile variables
This adds (back) support for non volatile variables. Non volatile
variables are variables which are stored in the environment over
reboot. They are used in the same way as the global variables, but
with a 'nv' command and device. The variables are stored under
/env/nv/, one variable per file. Adding a nv variable automatically
adds a global variable with the same name. Changing a nv variable
also changes the same global variable, but not the other way round.
This allows for example to configure the username as:
nv user=sha; saveenv
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'Documentation/user')
-rw-r--r-- | Documentation/user/variables.rst | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Documentation/user/variables.rst b/Documentation/user/variables.rst index a13de1b22c..974ab88221 100644 --- a/Documentation/user/variables.rst +++ b/Documentation/user/variables.rst @@ -25,6 +25,47 @@ other variable. You can also directly assign a value during creation:: to assigning a value with ``global.myvar1=foobar``, but the latter fails when a variable has not been created before. +.. _config_device: + +Non volatile variables +---------------------- + +Additionally to global variables barebox also has non volatile (nv) variables. +Unlike the global variables the config variables are persistent over reboots. + +Each nv variable is linked with the global variable of the same name. +Whenever the nv variable changes its value the corresponding global +variable also changes its value. The other way round though is not true: +Changing a global variable does not change the corresponding nv variable. +This means that changing a global variable changes the behaviour for the +currently running barebox, while changing a nv variable changes the +behaviour persistently over reboots. + +nv variables can be created or removed with the :ref:`command_nv` +command. The nv variables are made persistent using the environment +facilities of barebox, so a :ref:`saveenv` must be issued to store the actual +values. + +examples: + +.. code-block:: sh + + barebox@Phytec phyCARD-i.MX27:/ devinfo nv + barebox@Phytec phyCARD-i.MX27:/ nv model=myboard + barebox@myboard:/ devinfo nv + Parameters: + model: myboard + barebox@myboard:/ devinfo global + Parameters: + [...] + model: myboard + [...] + barebox@myboard:/ global.model=yourboard + barebox@yourboard:/ devinfo nv + Parameters: + model: myboard + barebox@yourboard:/ + .. _magicvars: Magic variables |