summaryrefslogtreecommitdiffstats
path: root/common/environment.c
diff options
context:
space:
mode:
authorJuergen Borleis <jbe@pengutronix.de>2014-07-31 12:39:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-08-01 08:24:00 +0200
commitc4c7b16588d22d99b7b9047fa0d0e1d8cb530774 (patch)
treee3bae7e92912bbe825bbda687a0e4aa7c6f90197 /common/environment.c
parent1b937547b9b1cbc20cfa87f762bf22bc08d4610e (diff)
downloadbarebox-c4c7b16588d22d99b7b9047fa0d0e1d8cb530774.tar.gz
barebox-c4c7b16588d22d99b7b9047fa0d0e1d8cb530774.tar.xz
envfs: provide an intentional way to ignore an existing external environment
Add a simple flag to envfs to be able to mark an external environment as "not to be used". This change should not affect existing systems, because the current envfs implementation ensures the 'flags' member in the envfs master block is always zeroed. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/environment.c')
-rw-r--r--common/environment.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/environment.c b/common/environment.c
index 2d1edf8381..8c4882c59b 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -447,6 +447,15 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
if (ret)
goto out;
+ if (super.flags & ENVFS_FLAGS_FORCE_BUILT_IN) {
+ printf("found force-builtin environment, using defaultenv\n");
+ ret = defaultenv_load(dir, 0);
+ if (ret)
+ printf("failed to load default environment: %s\n",
+ strerror(-ret));
+ goto out;
+ }
+
buf = xmalloc(size);
rbuf = buf;