diff options
author | AKASHI Takahiro <takahiro.akashi@linaro.org> | 2019-02-25 15:54:36 +0900 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-02-25 12:47:13 +0100 |
commit | 49d81fdfb8c1fc07e54c8f01fe5c5b1125f884cb (patch) | |
tree | 8d124ccf33cef115a949601d0c57a4255cdf6447 /cmd/nvedit.c | |
parent | ccecc3456a6c538626b34be40249bcf88279efcf (diff) | |
download | u-boot-49d81fdfb8c1fc07e54c8f01fe5c5b1125f884cb.tar.gz u-boot-49d81fdfb8c1fc07e54c8f01fe5c5b1125f884cb.tar.bz2 u-boot-49d81fdfb8c1fc07e54c8f01fe5c5b1125f884cb.zip |
cmd: env: add "-e" option for handling UEFI variables
"env [print|set] -e" allows for handling uefi variables without
knowing details about mapping to corresponding u-boot variables.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'cmd/nvedit.c')
-rw-r--r-- | cmd/nvedit.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/cmd/nvedit.c b/cmd/nvedit.c index ebaa16b754..24a6cf7824 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -119,6 +119,11 @@ static int do_env_print(cmd_tbl_t *cmdtp, int flag, int argc, int rcode = 0; int env_flag = H_HIDE_DOT; +#if defined(CONFIG_CMD_NVEDIT_EFI) + if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'e') + return do_env_print_efi(cmdtp, flag, --argc, ++argv); +#endif + if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'a') { argc--; argv++; @@ -216,6 +221,12 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag) ENTRY e, *ep; debug("Initial value for argc=%d\n", argc); + +#if CONFIG_IS_ENABLED(CMD_NVEDIT_EFI) + if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'e') + return do_env_set_efi(NULL, flag, --argc, ++argv); +#endif + while (argc > 1 && **(argv + 1) == '-') { char *arg = *++argv; @@ -1263,12 +1274,18 @@ static char env_help_text[] = "env import [-d] [-t [-r] | -b | -c] addr [size] [var ...] - import environment\n" #endif "env print [-a | name ...] - print environment\n" +#if defined(CONFIG_CMD_NVEDIT_EFI) + "env print -e [name ...] - print UEFI environment\n" +#endif #if defined(CONFIG_CMD_RUN) "env run var [...] - run commands in an environment variable\n" #endif #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) "env save - save environment\n" #endif +#if defined(CONFIG_CMD_NVEDIT_EFI) + "env set -e name [arg ...] - set UEFI variable; unset if 'arg' not specified\n" +#endif "env set [-f] name [arg ...]\n"; #endif @@ -1295,6 +1312,10 @@ U_BOOT_CMD_COMPLETE( printenv, CONFIG_SYS_MAXARGS, 1, do_env_print, "print environment variables", "[-a]\n - print [all] values of all environment variables\n" +#if defined(CONFIG_CMD_NVEDIT_EFI) + "printenv -e [name ...]\n" + " - print UEFI variable 'name' or all the variables\n" +#endif "printenv name ...\n" " - print value of environment variable 'name'", var_complete @@ -1322,7 +1343,12 @@ U_BOOT_CMD_COMPLETE( U_BOOT_CMD_COMPLETE( setenv, CONFIG_SYS_MAXARGS, 0, do_env_set, "set environment variables", - "[-f] name value ...\n" +#if defined(CONFIG_CMD_NVEDIT_EFI) + "-e name [value ...]\n" + " - set UEFI variable 'name' to 'value' ...'\n" + " - delete UEFI variable 'name' if 'value' not specified\n" +#endif + "setenv [-f] name value ...\n" " - [forcibly] set environment variable 'name' to 'value ...'\n" "setenv [-f] name\n" " - [forcibly] delete environment variable 'name'", |