summaryrefslogtreecommitdiff
path: root/tools/env/fw_env_main.c
diff options
context:
space:
mode:
authorMichael Heimpold <mhei@heimpold.de>2015-10-27 22:34:49 +0100
committerTom Rini <trini@konsulko.com>2015-11-18 08:47:02 -0500
commit9884f44cab5d1ce944b1dc087c9bb8db0efb5160 (patch)
treeb1b94bc3ff057b4226ddd2530db2f2bd11abb7e6 /tools/env/fw_env_main.c
parentf5b76de4403881940a3ef57f9b6e9fa5b3433070 (diff)
downloadu-boot-imx-9884f44cab5d1ce944b1dc087c9bb8db0efb5160.zip
u-boot-imx-9884f44cab5d1ce944b1dc087c9bb8db0efb5160.tar.gz
u-boot-imx-9884f44cab5d1ce944b1dc087c9bb8db0efb5160.tar.bz2
tools/env: allow config filename to be passed via command line argument
When for example generating/manipulating SD card/eMMC images which contain U-Boot and its environment(s), it is handy to use a given configuration file instead of the compiled-in default one. And since the default configuration file is expected under /etc it's hard for an usual linux user account without special permissions to use fw_printenv/fw_setenv for this purpose. So allow to pass an optional filename via a new '-c' command line argument. Example: $ ln -s fw_printenv tools/env/fw_setenv $ cat fw_env.config test.img 0x20000 0x20000 test.img 0x40000 0x20000 $ tools/env/fw_printenv -c ./fw_env.config fdt_file fdt_file=imx28-duckbill.dtb $ tools/env/fw_setenv -c ./fw_env.config fdt_file imx28-duckbill-spi.dtb $ tools/env/fw_printenv -c ./fw_env.config fdt_file fdt_file=imx28-duckbill-spi.dtb Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Diffstat (limited to 'tools/env/fw_env_main.c')
-rw-r--r--tools/env/fw_env_main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
index ce50d58..234c061 100644
--- a/tools/env/fw_env_main.c
+++ b/tools/env/fw_env_main.c
@@ -50,8 +50,13 @@ void usage(void)
fprintf(stderr, "fw_printenv/fw_setenv, "
"a command line interface to U-Boot environment\n\n"
+#ifndef CONFIG_FILE
"usage:\tfw_printenv [-a key] [-n] [variable name]\n"
"\tfw_setenv [-a key] [variable name] [variable value]\n"
+#else
+ "usage:\tfw_printenv [-c /my/fw_env.config] [-a key] [-n] [variable name]\n"
+ "\tfw_setenv [-c /my/fw_env.config] [-a key] [variable name] [variable value]\n"
+#endif
"\tfw_setenv -s [ file ]\n"
"\tfw_setenv -s - < [ file ]\n\n"
"The file passed as argument contains only pairs "
@@ -98,12 +103,15 @@ int main(int argc, char *argv[])
cmdname = p + 1;
}
- while ((c = getopt_long (argc, argv, "a:ns:h",
+ while ((c = getopt_long (argc, argv, "a:c:ns:h",
long_options, NULL)) != EOF) {
switch (c) {
case 'a':
/* AES key, handled later */
break;
+ case 'c':
+ /* handled later */
+ break;
case 'n':
/* handled in fw_printenv */
break;