This introduces some new environment variable helpers and updates
the existing ones. Newly introduced are:
getenv_bool: read a bool variable
getenv_ul: read an unsigned long variable
getenev_uint: read an unsigned int variable
getenv_nonempty: like normal getenv, but does return NULL instead of an
empty string
All new helpers take a pointer to the value. This value is only modified
when the variable exists. This allows the following programming scheme:
unsigned int myvalue = sanedefault;
getenv_uint("myvalue", &myvalue);
So without checking the return value myvalue contains the best possible
value.
getenv_ull is updated to this scheme.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds several missing includes to files under include/ which
we relied on being included implicitly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
include/environment.h is no longer necessary to build scripts/bareboxenv,
so remove its inclusion.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
environment.h is for environment variables, not for the environment
storage (envfs), so move the prototypes to envfs.h
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This implements two new options for the loadenv command:
-s: removes (scrubs) old directory contents to be able to
create a fresh environment from for example /dev/defaultenv
-n: no overwrite. Do not overwrite existing files. This allows
to keep parts of the old environment.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This switches environment variables to use linux list. This is easier
to read. An additional plus is that the environment variables no longer
need an initcall, so malloc is the only requirement for them.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Normally the default path to save the environment is /dev/env0. However,
we can't map a file in a fat filesystem to /dev/env0. So if we want to
store the environment in a file in fat we have to make it configurable.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Environment variables are only useful in interactive environments.
Make it optional on our way to support a noninteractive barebox.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The current NAND Bootloader setup forces the environment
variables to be in line with the bootloader. This change
enables the configuration to be made in the board include
file instead so that it can be individually enabled.
Signed-off-by: Nick Spence <nick.spence@freescale.com>
Signed-off-by: Stefan Roese <sr@denx.de>