From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: non volatile variables and incremental envrironment
Date: Thu, 6 Nov 2014 13:59:27 +0100 [thread overview]
Message-ID: <1415278778-20826-1-git-send-email-s.hauer@pengutronix.de> (raw)
This series brings in two changes: non volatile variables and incremental
envrironment
Non volatile variables can be used to store informations over reboot,
they are basically a persistent variant of the globalvars. The non
volatile variables make it possible to change settings like for
example the autoboot timeout or bootsource without changing text
files. Also it makes it possible to change settings from program
code or scripts. Here is the documentation also contained in the
patches:
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:/
The second change in this series is that the environment code now
only stores the files which are changed from the default environment.
This means when an environment is unchanged, 'saveenv' will write
an empty environment. This has multiple effects:
- When scripts are unchanged (which should normally be the case in
production environments) they will never be stored on any storage
device. This means after a barebox update the (possibly updated)
scripts from the newer default environment are used while the
changes are still preserved.
- Together with non volatile variables it becomes possible to keep
the program logic (scripts) in the default environment where they
get updates while the configuration (non volatile variables) can
still be saved. Still a developer can change scripts in the
environment.
- The downside of this is that the saved scripts may not fit to
the default scripts from an updated barebox. while previously
a saved env may be incompatible with the currently running barebox
it is now possible to create an environment which is inconsistent
in itself.
Due to the last point it may be possible to convince me that the
incremental storage needs to be optional. However, it makes the
handling more complex, so I try without first ;)
Sascha
The following changes since commit 592d35a47ce4ef2ffffd9805a1a534771882f3a6:
Merge branch 'for-next/xz' (2014-11-05 15:47:39 +0100)
are available in the git repository at:
git://git.penguitronix.de/git/barebox.git
for you to fetch changes up to 7962e7a0b423a5dfba251622f64d3891f69a55c0:
defaultenv-2: Make use of nonvolatile variables (2014-11-06 12:23:12 +0100)
----------------------------------------------------------------
Sascha Hauer (11):
environment: drop unnecessary casts
environment: remove unused variable
environment: refactor saveenv
environment: Only save changes to the defaultenv
magicvar: Add support for dynamically added magicvars
Add support for non volatile variables
libfile: Add copy_recursive
cp: Add recursive copy
Add defaultenv command
globalvar: Add support for printing all global variables
defaultenv-2: Make use of nonvolatile variables
Documentation/user/variables.rst | 41 ++++
arch/arm/boards/archosg9/env/init/bootsource | 4 +
arch/arm/boards/at91sam9m10ihd/env/config | 19 --
.../boards/at91sam9m10ihd/env/init/config-board | 8 -
arch/arm/boards/at91sam9m10ihd/env/nv/boot.default | 1 +
arch/arm/boards/at91sam9m10ihd/env/nv/hostname | 1 +
.../at91sam9m10ihd/env/nv/linux.bootargs.base | 1 +
.../boards/avnet-zedboard/env/init/config-board | 6 -
.../avnet-zedboard/env/init/nv/linux.bootargs.base | 1 +
arch/arm/boards/beagle/env/config-board | 6 -
arch/arm/boards/beagle/env/nv/linux.bootargs.base | 1 +
arch/arm/boards/ccxmx51/env/config-board | 10 -
arch/arm/boards/ccxmx51/env/nv/autoboot_timeout | 1 +
arch/arm/boards/ccxmx51/env/nv/boot.default | 1 +
arch/arm/boards/ccxmx51/env/nv/linux.bootargs.base | 1 +
arch/arm/boards/clep7212/env/config-board | 12 -
arch/arm/boards/clep7212/env/init/bootsource | 9 +
arch/arm/boards/clep7212/env/nv/autoboot_timeout | 1 +
.../arm/boards/clep7212/env/nv/linux.bootargs.base | 1 +
.../boards/crystalfontz-cfa10036/env/config-board | 6 -
.../boards/crystalfontz-cfa10036/env/init/general | 12 -
.../crystalfontz-cfa10036/env/nv/boot.default | 1 +
.../env/nv/linux.bootargs.base | 1 +
arch/arm/boards/efika-mx-smartbook/env/config | 29 ---
.../boards/efika-mx-smartbook/env/init/bootsource | 4 +
.../efika-mx-smartbook/env/nv/autoboot_timeout | 1 +
.../efika-mx-smartbook/env/nv/linux.bootargs.base | 1 +
.../efika-mx-smartbook/env/nv/linux.bootargs.lpj | 1 +
.../efika-mx-smartbook/env/nv/linux.bootargs.quiet | 1 +
.../boards/embedsky-e9/defaultenv-e9/config-board | 7 -
.../embedsky-e9/defaultenv-e9/init/bootsource | 7 +
.../boards/embedsky-e9/defaultenv-e9/nv/hostname | 1 +
arch/arm/boards/gk802/env/config-board | 6 -
arch/arm/boards/guf-vincell/env/init/config-board | 7 -
arch/arm/boards/guf-vincell/env/init/nv/hostname | 1 +
.../guf-vincell/env/init/nv/linux.bootargs.base | 1 +
arch/arm/boards/highbank/env/config-board | 10 -
arch/arm/boards/highbank/env/nv/boot.default | 1 +
arch/arm/boards/highbank/env/nv/bootargs.base | 1 +
arch/arm/boards/highbank/env/nv/bootm.oftree | 1 +
arch/arm/boards/mx31moboard/env/config-board | 7 -
arch/arm/boards/mx31moboard/env/nv/boot.default | 1 +
.../boards/mx31moboard/env/nv/linux.bootargs.base | 1 +
arch/arm/boards/panda/env/config-board | 6 -
arch/arm/boards/panda/env/nv/linux.bootargs.base | 1 +
.../defaultenv-phycard-imx6/config-board | 9 -
.../defaultenv-phycard-imx6/nv/boot.default | 1 +
.../defaultenv-phycard-imx6/nv/bootargs.base | 1 +
.../defaultenv-phycard-imx6/nv/hostname | 1 +
.../{config-board => init/bootsource} | 8 +-
.../defaultenv-phycore-am335x/init/init-usbserial | 4 +
.../defaultenv-phycore-am335x/nv/bootargs.base | 1 +
.../defaultenv-phycore-am335x/nv/hostname | 1 +
.../boards/phytec-phycore-imx31/env/config-board | 6 -
.../env/nv/linux.bootargs.base | 1 +
.../boards/phytec-phycore-imx35/env/config-board | 6 -
.../env/nv/linux.bootargs.base | 1 +
.../{config-board => init/bootsource} | 8 +-
.../defaultenv-phyflex-am335x/nv/hostname | 1 +
.../nv/linux.bootargs.base | 1 +
.../defaultenv-phyflex-imx6/config-board | 9 -
.../defaultenv-phyflex-imx6/nv/boot.default | 1 +
.../defaultenv-phyflex-imx6/nv/hostname | 1 +
.../defaultenv-phyflex-imx6/nv/linux.bootargs.base | 1 +
arch/arm/boards/radxa-rock/env/config-board | 6 -
.../boards/radxa-rock/env/nv/linux.bootargs.base | 1 +
arch/arm/boards/telit-evk-pro3/env/config-board | 8 -
arch/arm/boards/telit-evk-pro3/env/nv/boot.default | 1 +
.../arm/boards/telit-evk-pro3/env/nv/bootargs.base | 1 +
arch/arm/boards/telit-evk-pro3/env/nv/hostname | 1 +
commands/Kconfig | 21 ++
commands/Makefile | 2 +
commands/cp.c | 36 +--
commands/defaultenv.c | 95 ++++++++
commands/global.c | 5 +
commands/loadenv.c | 11 +-
commands/magicvar.c | 111 ++++++++--
commands/nv.c | 84 +++++++
common/Kconfig | 1 +
common/environment.c | 246 +++++++++++++++------
common/globalvar.c | 178 +++++++++++++++
common/startup.c | 13 +-
defaultenv/defaultenv-2-base/bin/init | 3 +
defaultenv/defaultenv-2-base/config | 22 +-
defaultenv/defaultenv-2-base/nv/allow_color | 1 +
defaultenv/defaultenv-2-base/nv/autoboot_timeout | 1 +
defaultenv/defaultenv-2-base/nv/user | 1 +
include/globalvar.h | 13 ++
include/libfile.h | 2 +
lib/libfile.c | 40 ++++
90 files changed, 875 insertions(+), 332 deletions(-)
delete mode 100644 arch/arm/boards/at91sam9m10ihd/env/config
delete mode 100644 arch/arm/boards/at91sam9m10ihd/env/init/config-board
create mode 100644 arch/arm/boards/at91sam9m10ihd/env/nv/boot.default
create mode 100644 arch/arm/boards/at91sam9m10ihd/env/nv/hostname
create mode 100644 arch/arm/boards/at91sam9m10ihd/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/avnet-zedboard/env/init/config-board
create mode 100644 arch/arm/boards/avnet-zedboard/env/init/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/beagle/env/config-board
create mode 100644 arch/arm/boards/beagle/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/ccxmx51/env/config-board
create mode 100644 arch/arm/boards/ccxmx51/env/nv/autoboot_timeout
create mode 100644 arch/arm/boards/ccxmx51/env/nv/boot.default
create mode 100644 arch/arm/boards/ccxmx51/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/clep7212/env/config-board
create mode 100644 arch/arm/boards/clep7212/env/init/bootsource
create mode 100644 arch/arm/boards/clep7212/env/nv/autoboot_timeout
create mode 100644 arch/arm/boards/clep7212/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/crystalfontz-cfa10036/env/config-board
delete mode 100644 arch/arm/boards/crystalfontz-cfa10036/env/init/general
create mode 100644 arch/arm/boards/crystalfontz-cfa10036/env/nv/boot.default
create mode 100644 arch/arm/boards/crystalfontz-cfa10036/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/efika-mx-smartbook/env/config
create mode 100644 arch/arm/boards/efika-mx-smartbook/env/nv/autoboot_timeout
create mode 100644 arch/arm/boards/efika-mx-smartbook/env/nv/linux.bootargs.base
create mode 100644 arch/arm/boards/efika-mx-smartbook/env/nv/linux.bootargs.lpj
create mode 100644 arch/arm/boards/efika-mx-smartbook/env/nv/linux.bootargs.quiet
delete mode 100644 arch/arm/boards/embedsky-e9/defaultenv-e9/config-board
create mode 100644 arch/arm/boards/embedsky-e9/defaultenv-e9/init/bootsource
create mode 100644 arch/arm/boards/embedsky-e9/defaultenv-e9/nv/hostname
delete mode 100644 arch/arm/boards/gk802/env/config-board
delete mode 100644 arch/arm/boards/guf-vincell/env/init/config-board
create mode 100644 arch/arm/boards/guf-vincell/env/init/nv/hostname
create mode 100644 arch/arm/boards/guf-vincell/env/init/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/highbank/env/config-board
create mode 100644 arch/arm/boards/highbank/env/nv/boot.default
create mode 100644 arch/arm/boards/highbank/env/nv/bootargs.base
create mode 100644 arch/arm/boards/highbank/env/nv/bootm.oftree
delete mode 100644 arch/arm/boards/mx31moboard/env/config-board
create mode 100644 arch/arm/boards/mx31moboard/env/nv/boot.default
create mode 100644 arch/arm/boards/mx31moboard/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/panda/env/config-board
create mode 100644 arch/arm/boards/panda/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/config-board
create mode 100644 arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/boot.default
create mode 100644 arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base
create mode 100644 arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/hostname
rename arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/{config-board => init/bootsource} (66%)
create mode 100644 arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/init/init-usbserial
create mode 100644 arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/nv/bootargs.base
create mode 100644 arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/nv/hostname
delete mode 100644 arch/arm/boards/phytec-phycore-imx31/env/config-board
create mode 100644 arch/arm/boards/phytec-phycore-imx31/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/phytec-phycore-imx35/env/config-board
create mode 100644 arch/arm/boards/phytec-phycore-imx35/env/nv/linux.bootargs.base
rename arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/{config-board => init/bootsource} (66%)
create mode 100644 arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/nv/hostname
create mode 100644 arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/config-board
create mode 100644 arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/nv/boot.default
create mode 100644 arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/nv/hostname
create mode 100644 arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/radxa-rock/env/config-board
create mode 100644 arch/arm/boards/radxa-rock/env/nv/linux.bootargs.base
delete mode 100644 arch/arm/boards/telit-evk-pro3/env/config-board
create mode 100644 arch/arm/boards/telit-evk-pro3/env/nv/boot.default
create mode 100644 arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base
create mode 100644 arch/arm/boards/telit-evk-pro3/env/nv/hostname
create mode 100644 commands/defaultenv.c
create mode 100644 commands/nv.c
create mode 100644 defaultenv/defaultenv-2-base/nv/allow_color
create mode 100644 defaultenv/defaultenv-2-base/nv/autoboot_timeout
create mode 100644 defaultenv/defaultenv-2-base/nv/user
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2014-11-06 13:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 12:59 Sascha Hauer [this message]
2014-11-06 12:59 ` [PATCH 01/11] environment: drop unnecessary casts Sascha Hauer
2014-11-06 12:59 ` [PATCH 02/11] environment: remove unused variable Sascha Hauer
2014-11-06 12:59 ` [PATCH 03/11] environment: refactor saveenv Sascha Hauer
2014-11-06 12:59 ` [PATCH 04/11] environment: Only save changes to the defaultenv Sascha Hauer
2014-11-06 12:59 ` [PATCH 05/11] magicvar: Add support for dynamically added magicvars Sascha Hauer
2014-11-06 12:59 ` [PATCH 06/11] Add support for non volatile variables Sascha Hauer
2014-11-06 12:59 ` [PATCH 07/11] libfile: Add copy_recursive Sascha Hauer
2014-11-06 12:59 ` [PATCH 08/11] cp: Add recursive copy Sascha Hauer
2014-11-06 12:59 ` [PATCH 09/11] Add defaultenv command Sascha Hauer
2014-11-06 12:59 ` [PATCH 10/11] globalvar: Add support for printing all global variables Sascha Hauer
2014-11-06 12:59 ` [PATCH 11/11] defaultenv-2: Make use of nonvolatile variables Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415278778-20826-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox