diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/Kconfig | 8 | ||||
-rw-r--r-- | cmd/Makefile | 1 | ||||
-rw-r--r-- | cmd/fitupd.c | 30 | ||||
-rw-r--r-- | cmd/lsblk.c | 2 | ||||
-rw-r--r-- | cmd/nvedit.c | 7 | ||||
-rw-r--r-- | cmd/nvedit_efi.c | 106 |
6 files changed, 26 insertions, 128 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 846c905c9c..bfe6c163dc 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -378,6 +378,7 @@ config CMD_BOOTEFI_HELLO_COMPILE config CMD_BOOTEFI_HELLO bool "Allow booting a standard EFI hello world for testing" depends on CMD_BOOTEFI_HELLO_COMPILE + default y if CMD_BOOTEFI_SELFTEST help This adds a standard EFI hello world application to U-Boot so that it can be used with the 'bootefi hello' command. This is useful @@ -489,13 +490,6 @@ config CMD_SPL_WRITE_SIZE flash used by Falcon-mode boot. See the documentation until CMD_SPL for detail. -config CMD_FITUPD - bool "fitImage update command" - depends on UPDATE_TFTP - help - Implements the 'fitupd' command, which allows to automatically - store software updates present on a TFTP server in NOR Flash - config CMD_THOR_DOWNLOAD bool "thor - TIZEN 'thor' download" select DFU diff --git a/cmd/Makefile b/cmd/Makefile index dc412d1106..7952138dc2 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -62,7 +62,6 @@ obj-$(CONFIG_CMD_EXT4) += ext4.o obj-$(CONFIG_CMD_EXT2) += ext2.o obj-$(CONFIG_CMD_FAT) += fat.o obj-$(CONFIG_CMD_FDT) += fdt.o -obj-$(CONFIG_CMD_FITUPD) += fitupd.o obj-$(CONFIG_CMD_FLASH) += flash.o obj-$(CONFIG_CMD_FPGA) += fpga.o obj-$(CONFIG_CMD_FPGAD) += fpgad.o diff --git a/cmd/fitupd.c b/cmd/fitupd.c deleted file mode 100644 index 0f490c58fc..0000000000 --- a/cmd/fitupd.c +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2011 - * Andreas Pretzsch, carpe noctem engineering, apr@cn-eng.de - */ - -#include <common.h> -#include <command.h> -#include <net.h> - -static int do_fitupd(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - ulong addr = 0UL; - - if (argc > 2) - return CMD_RET_USAGE; - - if (argc == 2) - addr = simple_strtoul(argv[1], NULL, 16); - - return update_tftp(addr, NULL, NULL); -} - -U_BOOT_CMD(fitupd, 2, 0, do_fitupd, - "update from FIT image", - "[addr]\n" - "\t- run update from FIT image at addr\n" - "\t or from tftp 'updatefile'" -); diff --git a/cmd/lsblk.c b/cmd/lsblk.c index ece8bbf108..653dffce04 100644 --- a/cmd/lsblk.c +++ b/cmd/lsblk.c @@ -5,6 +5,8 @@ */ #include <common.h> +#include <blk.h> +#include <command.h> #include <dm.h> static int do_lsblk(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 49338b4d36..ca0be92fc3 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -1410,7 +1410,7 @@ static char env_help_text[] = #endif "env print [-a | name ...] - print environment\n" #if defined(CONFIG_CMD_NVEDIT_EFI) - "env print -e [-guid guid|-all][-n] [name ...] - print UEFI environment\n" + "env print -e [-guid guid] [-n] [name ...] - print UEFI environment\n" #endif #if defined(CONFIG_CMD_RUN) "env run var [...] - run commands in an environment variable\n" @@ -1452,8 +1452,9 @@ U_BOOT_CMD_COMPLETE( "print environment variables", "[-a]\n - print [all] values of all environment variables\n" #if defined(CONFIG_CMD_NVEDIT_EFI) - "printenv -e [-guid guid|-all][-n] [name ...]\n" + "printenv -e [-guid guid][-n] [name ...]\n" " - print UEFI variable 'name' or all the variables\n" + " \"-guid\": GUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n" " \"-n\": suppress dumping variable's value\n" #endif "printenv name ...\n" @@ -1487,7 +1488,7 @@ U_BOOT_CMD_COMPLETE( "-e [-guid guid][-nv][-bs][-rt][-at][-a][-v]\n" " [-i addr,size name], or [name [value ...]]\n" " - set UEFI variable 'name' to 'value' ...'\n" - " \"-guid\": set vendor guid\n" + " \"-guid\": GUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n" " \"-nv\": set non-volatile attribute\n" " \"-bs\": set boot-service attribute\n" " \"-rt\": set runtime attribute\n" diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index 3f61d5d6cc..8e31f43e1f 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -52,8 +52,7 @@ static const struct { {EFI_CERT_TYPE_PKCS7_GUID, "EFI_CERT_TYPE_PKCS7_GUID"}, }; -/* "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" */ -static char unknown_guid[37]; +static const char unknown_guid[] = ""; /** * efi_guid_to_str() - convert guid to readable name @@ -71,9 +70,6 @@ static const char *efi_guid_to_str(const efi_guid_t *guid) if (!guidcmp(guid, &efi_guid_text[i].guid)) return efi_guid_text[i].text; - uuid_bin_to_str((unsigned char *)guid->b, unknown_guid, - UUID_STR_FORMAT_GUID); - return unknown_guid; } @@ -115,7 +111,7 @@ static void efi_dump_single_var(u16 *name, const efi_guid_t *guid, bool verbose) goto out; rtc_to_tm(time, &tm); - printf("%ls:\n %s:\n", name, efi_guid_to_str(guid)); + printf("%ls:\n %pUl %s\n", name, guid, efi_guid_to_str(guid)); if (attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) printf(" %04d-%02d-%02d %02d:%02d:%02d\n", tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); @@ -136,50 +132,6 @@ out: free(data); } -/** - * efi_dump_vars() - show information about named UEFI variables - * - * @argc: Number of arguments (variables) - * @argv: Argument (variable name) array - * @verbose: if true, dump data - * Return: CMD_RET_SUCCESS on success, or CMD_RET_RET_FAILURE - * - * Show information encoded in named UEFI variables - */ -static int efi_dump_vars(int argc, char *const argv[], - const efi_guid_t *guid, bool verbose) -{ - u16 *var_name16, *p; - efi_uintn_t buf_size, size; - - buf_size = 128; - var_name16 = malloc(buf_size); - if (!var_name16) - return CMD_RET_FAILURE; - - for (; argc > 0; argc--, argv++) { - size = (utf8_utf16_strlen(argv[0]) + 1) * sizeof(u16); - if (buf_size < size) { - buf_size = size; - p = realloc(var_name16, buf_size); - if (!p) { - free(var_name16); - return CMD_RET_FAILURE; - } - var_name16 = p; - } - - p = var_name16; - utf8_utf16_strcpy(&p, argv[0]); - - efi_dump_single_var(var_name16, guid, verbose); - } - - free(var_name16); - - return CMD_RET_SUCCESS; -} - static bool match_name(int argc, char *const argv[], u16 *var_name16) { char *buf, *p; @@ -225,10 +177,7 @@ static int efi_dump_var_all(int argc, char *const argv[], efi_uintn_t buf_size, size; efi_guid_t guid; efi_status_t ret; - - if (argc && guid_p) - /* simplified case */ - return efi_dump_vars(argc, argv, guid_p, verbose); + bool match = false; buf_size = 128; var_name16 = malloc(buf_size); @@ -259,13 +208,18 @@ static int efi_dump_var_all(int argc, char *const argv[], return CMD_RET_FAILURE; } - if ((!guid_p || !guidcmp(guid_p, &guid)) && - (!argc || match_name(argc, argv, var_name16))) + if (guid_p && guidcmp(guid_p, &guid)) + continue; + if (!argc || match_name(argc, argv, var_name16)) { + match = true; efi_dump_single_var(var_name16, &guid, verbose); + } } - free(var_name16); + if (!match && argc == 1) + printf("Error: \"%s\" not defined\n", argv[0]); + return CMD_RET_SUCCESS; } @@ -286,9 +240,8 @@ static int efi_dump_var_all(int argc, char *const argv[], int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - efi_guid_t guid; - const efi_guid_t *guid_p; - bool default_guid, guid_any, verbose; + const efi_guid_t *guid_p = NULL; + bool verbose = true; efi_status_t ret; /* Initialize EFI drivers */ @@ -299,31 +252,18 @@ int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } - default_guid = true; - guid_any = false; - verbose = true; for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) { if (!strcmp(argv[0], "-guid")) { - if (argc == 1) - return CMD_RET_USAGE; + efi_guid_t guid; - /* -a already specified */ - if (!default_guid && guid_any) + if (argc == 1) return CMD_RET_USAGE; - argc--; argv++; if (uuid_str_to_bin(argv[0], guid.b, UUID_STR_FORMAT_GUID)) return CMD_RET_USAGE; - default_guid = false; - } else if (!strcmp(argv[0], "-all")) { - /* -guid already specified */ - if (!default_guid && !guid_any) - return CMD_RET_USAGE; - - guid_any = true; - default_guid = false; + guid_p = (const efi_guid_t *)guid.b; } else if (!strcmp(argv[0], "-n")) { verbose = false; } else { @@ -331,13 +271,6 @@ int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc, } } - if (guid_any) - guid_p = NULL; - else if (default_guid) - guid_p = &efi_global_variable_guid; - else - guid_p = (const efi_guid_t *)guid.b; - /* enumerate and show all UEFI variables */ return efi_dump_var_all(argc, argv, guid_p, verbose); } @@ -518,8 +451,7 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc, argv++; if (uuid_str_to_bin(argv[0], guid.b, UUID_STR_FORMAT_GUID)) { - printf("## Guid not specified or in XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX format\n"); - return CMD_RET_FAILURE; + return CMD_RET_USAGE; } default_guid = false; } else if (!strcmp(argv[0], "-bs")) { @@ -567,8 +499,8 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc, } if (verbose) { - printf("GUID: %s\n", efi_guid_to_str((const efi_guid_t *) - &guid)); + printf("GUID: %pUl %s\n", &guid, + efi_guid_to_str((const efi_guid_t *)&guid)); printf("Attributes: 0x%x\n", attributes); } |