diff options
author | Juergen Borleis <jbe@pengutronix.de> | 2014-07-31 12:39:03 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-01 08:24:00 +0200 |
commit | e805b7dcb02bf7d8087a13175b02758ed60c5e23 (patch) | |
tree | 717f4f9d63c41da8d9e1b244b1136871088bb2d4 /scripts | |
parent | 72ce27f8e02524170a922d2f6a6c73c5e4b5b5cd (diff) | |
download | barebox-e805b7dcb02bf7d8087a13175b02758ed60c5e23.tar.gz barebox-e805b7dcb02bf7d8087a13175b02758ed60c5e23.tar.xz |
saveenv: provide a zeroed/empty/ignore environment
If an external environment storage should be used in very rare and special cases,
the intentional behaviour should be to ignore the external environment and always
fall back to the built-in environment. By storing an empty "to be ignored" environment
into the external environment a confusing error message about invalid CRC sums will go
away and still the built-in environment is used.
With this new option we can force the intentional behaviour.
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bareboxenv.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/bareboxenv.c b/scripts/bareboxenv.c index ec6ccfeadb..249e65b251 100644 --- a/scripts/bareboxenv.c +++ b/scripts/bareboxenv.c @@ -109,6 +109,7 @@ static void usage(char *prgname) "\n" "options:\n" " -s save (directory -> environment sector)\n" + " -z force the built-in default environment at startup\n" " -l load (environment sector -> directory)\n" " -p <size> pad output file to given size\n" " -v verbose\n", @@ -120,9 +121,10 @@ int main(int argc, char *argv[]) int opt; int save = 0, load = 0, pad = 0, err = 0, fd; char *filename = NULL, *dirname = NULL; + unsigned envfs_flags = 0; int verbose = 0; - while((opt = getopt(argc, argv, "slp:v")) != -1) { + while((opt = getopt(argc, argv, "slp:vz")) != -1) { switch (opt) { case 's': save = 1; @@ -133,6 +135,10 @@ int main(int argc, char *argv[]) case 'p': pad = strtoul(optarg, NULL, 0); break; + case 'z': + envfs_flags |= ENVFS_FLAGS_FORCE_BUILT_IN; + save = 1; + break; case 'v': verbose = 1; break; @@ -181,7 +187,7 @@ int main(int argc, char *argv[]) if (verbose) printf("saving contents of %s to file %s\n", dirname, filename); - err = envfs_save(filename, dirname, 0); + err = envfs_save(filename, dirname, envfs_flags); if (verbose && err) printf("saving env failed: %d\n", err); |