| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
We have the split by '=' snippet at multiple locations that parse
key=value pairs. Consolidate them to a single location. This makes code
a bit easier to read at the cost of an extra 8 bytes (LZO-compressed
THUMB2 barebox, static inline version is bigger).
No functional change.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Setting a variable via the nv command results in the call chain
nvar_add() -> nv_save() -> __nv_save().
__nv_save isn't supposed to be called with val=NULL argument however:
dprintf(fd, "%s", val);
Avoid this from happening by translating NULL into the empty string.
This aligns nv with the behavior of hush and setenv (but not global,
this will need to be looked at separately).
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Multiple nonopt arguments seems to have never worked, because the value
was always extracted out of the first non-opt argument. After the first
iteration, it'll have it's '=' stripped and thus value == NULL for all i
> 0. Fix this.
Before:
$ nv a=1 b=2 c=3
$ echo "[$nv.a $nv.b $nv.c]"
[1 ]
After:
$ nv a=1 b=2 c=3
$ echo "[$nv.a $nv.b $nv.c]"
[1 2 3]
Fixes: 0c2fccceb625 ("nv: Allow to set/remove multiple variables with one command")
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While at it also drop references to the non-existing CREDITS file and do
some small rearrangements for some uniform formatting.
(SPDX-License-Identifier first, then copyright texts and then an empty
line.)
The advantage is that these specifiers are machine-parseable which helps
license conformance.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, the default environment is only used when the
barebox environment on the persistent store is not valid
or when ENVFS_FLAGS_FORCE_BUILT_IN is set in the super block.
However, ENVFS_FLAGS_FORCE_BUILT_IN can be cleared and the
environmnet variables in the persistent store will be
used again. This may not be desirable.
This patch allows building CONFIG_DEFAULT_ENVIRONMENT
independent of CONFIG_ENV_HANDLING. This can be useful
if you never want to load or write values from the
persistent store and you only need to read environment variables
from your default environment.
If CONFIG_ENV_HANDLING is not set, a message will be printed to the
user indicating that changes to non-volatile variables won't be
persisted.
Move envfs functions that are needed when CONFIG_DEFAULT_ENVIRONMENT
and/or CONFIG_ENV_HANDLING is set to a new file common/envfs-core.c.
Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
nv variables in the form dev.<devname>.* can be used to make device
parameters persistent. Add these to the completion list to make setting
these variables more convenient.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
Just let the help text appear a bit more aligned.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
Help did not point out that -r option requires n arguments and did not
mention support for removing variables in help text.
Also introduce and consistently reuse 'NV' as abbreviation for 'non volatile'.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to iteration over possibly multiple variables, the return value of
an individual call to nvvar_remove() / nvvar_add() gets lost.
This will result in do_nv() returning success (0) if any variable
processing failed as long as processing of the last variable succeeded.
Processing will not be aborted on individual errors, such as the 'cp'
handles it for invalid files.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
Printing the nv variables (before performing any modification!) is useless
and irritating.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
| |
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
The 'nv' command is often used to create a nv variable
for an existing global variable, so add a command completion
function for this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
It's convenient to set/remove multiple nv variables in one go. With
this patch we iterate over the remaining nonopts instead of expecting
exactly one nonopt.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
We now have code to save the nv variables without saving the
rest of the environment. This gives us the possibility to explicitly
save the nv variables. This patch adds an option to the 'nv' command
for this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
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>
|