From patchwork Wed Oct 17 07:32:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 149024 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp319747lji; Wed, 17 Oct 2018 00:32:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV62xKqf4ZHuns+0B4j8btNnN1+sW3HEMdQCx+QkmdfAFN13hYCR1F15+pz6GTVB1BXQhj0+3 X-Received: by 2002:a50:aca2:: with SMTP id x31-v6mr34250380edc.76.1539761544689; Wed, 17 Oct 2018 00:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539761544; cv=none; d=google.com; s=arc-20160816; b=prXUHGck+aWcBI5sf7pwVyt/MFWXzFWrlTUqO/h8OPRA5FLDgjyY8pMSnUbPxNq54r 7IbBJ+7DKcE0N89Sf3YeT6oFTVHNYNJDfXn9sJem7EHBN6dqi7gYr3+56ypLUKT2q2IP Ed/1K55yiMTy4bnDaPNC2VyPKGG5WcPMDDj31LnSFHxId2dT7+OFQOTpXvFXWM1JcQFM lztjTB4uPpv2cJZNwrkgqiPzkXWbEWGF68GMPO0JmPpvbRUNkED4zfdLX+4VmRaV1l30 mW9YEKFu84i3jZEIGCVABiVz3UBh8BEggE2WF5C4Pqxs8wXa++pYNuU5x/p3dx/yTiP6 b4+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature; bh=xYBeNMRwWnL3hT730QDrp3xcap81EcyJrAsHZgW3ff4=; b=nByv1HvUhv95lTl4lwUNbkzch5QzaePxyRY2cY2mCVXUeCZy1vcwYBj5k0T2a9QuhZ lgvuqnwDDDEsSUr0lB7ACrlHsWRmsMOFYEMc5Kp9pkh1TScQkxYdqCLPFLMKdXAM71EX rKG74EU22Dw1FND1bvPnT9kA49UWVUPy36PzTBL8ers7chiQ5M8djc3h34wGTXDFbeWn 1DsUa/bwOrFWU4OzWi9PNcpzK8FBn+hcWJ0/yeNzEJeMm0Y1R0GIqdh8VrpFddzgo7DV CboyS/E3Jq0j+YekiwJK1qgwEYDJSwUHKqsWg8xJKdTLc7ylQFm0iQRVkFlPJWij/60T IDHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hr2d2Gzz; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id b58-v6si7436900ede.270.2018.10.17.00.32.24; Wed, 17 Oct 2018 00:32:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hr2d2Gzz; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 3C78DC21DC1; Wed, 17 Oct 2018 07:31:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0455BC21D8E; Wed, 17 Oct 2018 07:31:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C6025C21DA2; Wed, 17 Oct 2018 07:30:50 +0000 (UTC) Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) by lists.denx.de (Postfix) with ESMTPS id 6A069C21DA2 for ; Wed, 17 Oct 2018 07:30:49 +0000 (UTC) Received: by mail-yw1-f65.google.com with SMTP id v198-v6so9948367ywg.12 for ; Wed, 17 Oct 2018 00:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xk3V7MDwJG6eRbv1MQsB9ZTaYp9hRJkJrx1Milj3di4=; b=hr2d2GzzwKFvyo4DCAlgCidyKTdV3RlTr0gt/Abmqs5/lAHOVe6Vd+XuYqDPNYuplB VTX5JiufmU7Z6f7qlSSCJfHGR9PqHxi+0tW28hTzatI7nErqwFG4Puas/fvDs/h9D4ZP PSCaN5Co0pqg5XuMJT7j7NVAWm7A77EE8EH1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xk3V7MDwJG6eRbv1MQsB9ZTaYp9hRJkJrx1Milj3di4=; b=WXbvNY6U0ylEyk/XHfcLoLf+/YVkBhZkXTKkHb6pwR9EoWyLvmfwT9UuETFz5RFAou mGTOCbjT2tNEn34hdUjyl59c5h5rMAmBu2c/g7YfMmMhAWu7vr59RNxAV89RGXZzvyeO nxcBNjDibUGcmnkLU2ePHKODDwedXlFrbkGtu6oKNJ8axkGbFcQF9CI6uqAzggYGgBYH d05+rg6e9Yq8HIZqcI5JjtNrDhZ867ejBAivr69VVab+EFhlmKSnS2AIlaRUR6Lubo4j U6jwp/5uC/zBzXwQOMX0BFv6rihNvX8mC0t3ecsC5HTFuIUhR29kWerFK3C569PfNohV DX4g== X-Gm-Message-State: ABuFfoh9LBkbPJc10/HsYRhMhPZicwIi7H3l+goOTR5a4FyfEwN09qBN 38RhCLgmQdRH1hilHDwcLcA+sw== X-Received: by 2002:a81:b209:: with SMTP id q9-v6mr13960366ywh.45.1539761448164; Wed, 17 Oct 2018 00:30:48 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id u79-v6sm4918716ywe.110.2018.10.17.00.30.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 00:30:47 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de Date: Wed, 17 Oct 2018 16:32:05 +0900 Message-Id: <20181017073207.13150-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181017073207.13150-1-takahiro.akashi@linaro.org> References: <20181017073207.13150-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 4/6] cmd: add efishell command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Currently, there is no easy way to add or modify UEFI variables. In particular, bootmgr supports BootOrder/BootXXXX variables, it is quite hard to define them as u-boot variables because they are represented in a complicated and encoded format. The new command, efishell, helps address these issues and give us more friendly interfaces: * efishell boot add: add BootXXXX variable * efishell boot rm: remove BootXXXX variable * efishell boot dump: display all BootXXXX variables * efishell boot order: set/display a boot order (BootOrder) * efishell setvar: set an UEFI variable (with limited functionality) * efishell dumpvar: display all UEFI variables As the name suggests, this command basically provides a subset fo UEFI shell commands with simplified functionality. Signed-off-by: AKASHI Takahiro --- cmd/Makefile | 2 +- cmd/efishell.c | 531 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 532 insertions(+), 1 deletion(-) create mode 100644 cmd/efishell.c diff --git a/cmd/Makefile b/cmd/Makefile index a61fab6583df..e18fb21e4b71 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -24,7 +24,7 @@ obj-$(CONFIG_CMD_BINOP) += binop.o obj-$(CONFIG_CMD_BLOCK_CACHE) += blkcache.o obj-$(CONFIG_CMD_BMP) += bmp.o obj-$(CONFIG_CMD_BOOTCOUNT) += bootcount.o -obj-$(CONFIG_CMD_BOOTEFI) += bootefi.o +obj-$(CONFIG_CMD_BOOTEFI) += bootefi.o efishell.o obj-$(CONFIG_CMD_BOOTMENU) += bootmenu.o obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o obj-$(CONFIG_CMD_BOOTZ) += bootz.o diff --git a/cmd/efishell.c b/cmd/efishell.c new file mode 100644 index 000000000000..7cadb9e47712 --- /dev/null +++ b/cmd/efishell.c @@ -0,0 +1,531 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * EFI Shell-like command + * + * Copyright (c) 2018 Takahiro AKASHI, Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +/* + * From efi_variable.c, + * + * Mapping between EFI variables and u-boot variables: + * + * efi_$guid_$varname = {attributes}(type)value + */ +static int do_efi_dump_var(int argc, char * const argv[]) +{ + char regex[256]; + char * const regexlist[] = {regex}; + char *res = NULL; + int len; + + if (argc > 2) + return CMD_RET_USAGE; + + if (argc == 2) + snprintf(regex, 256, "efi_.*-.*-.*-.*-.*_%s", argv[1]); + else + snprintf(regex, 256, "efi_.*-.*-.*-.*-.*_.*"); + debug("%s:%d grep uefi var %s\n", __func__, __LINE__, regex); + + len = hexport_r(&env_htab, '\n', H_MATCH_REGEX | H_MATCH_KEY, + &res, 0, 1, regexlist); + + if (len < 0) + return CMD_RET_FAILURE; + + if (len > 0) { + puts(res); + free(res); + if (len < 2 && argc == 2) + printf("%s: not found\n", argv[1]); + } + + return CMD_RET_SUCCESS; +} + +static bool isalnum(char c) +{ + if (c >= '0' && c <= '9') + return true; + if (c >= 'A' && c <= 'F') + return true; + if (c >= 'a' && c <= 'f') + return true; + + return false; +} + +static int do_efi_set_var(int argc, char * const argv[]) +{ + char *value, *data, *ptr, *ptr2 = NULL, num[3] = {'\0', '\0', '\0'}; + unsigned long len, size; + u16 *var_name16; + efi_guid_t guid; + efi_status_t ret; + + if (argc > 3) + return CMD_RET_USAGE; + + if (argc == 1) + return CMD_RET_SUCCESS; + + if (argc == 2) { + /* remove */ + value = NULL; + size = 0; + } else { /* set */ + value = argv[2]; + if (value[0] == '=') + value++; + len = strlen(value); + if ((len > 2) && !strncmp(value, "0x", 2)) { + if ((len % 2)) + return CMD_RET_USAGE; + + data = value + 2; + size = (len - 2) / 2; + /* FIXME */ + ptr = malloc(size); + ptr2 = ptr; + len = 0; + while (len < size * 2) { + num[0] = data[len++]; + num[1] = data[len++]; + if (!isalnum(num[0]) || !isalnum(num[1])) { + printf("Invalid format: %s\n\n", value); + ret = CMD_RET_USAGE; + goto out; + } + *ptr++ = (char)simple_strtoul(num, NULL, 16); + } + value = data; + } else { + size = len; + } + } + + var_name16 = malloc((strlen(argv[1]) + 1) * 2); + utf8_to_utf16(var_name16, (u8 *)argv[1], strlen(argv[1]) + 1); + + guid = efi_global_variable_guid; + ret = efi_set_variable(var_name16, &guid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, size, value); + ret = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE); +out: + if (ptr2) + free(ptr2); + return ret; +} + +static int do_efi_boot_add(int argc, char * const argv[]) +{ + int id; + char *endp; + char var_name[9]; + u16 var_name16[9]; + efi_guid_t guid; + u32 attr; + size_t label_len, label_len16; + u16 *label, *p; + char *interface, *device, *file, *option; + struct efi_device_path *device_path = NULL, *file_path = NULL; + void *data = NULL; + unsigned long size; + int ret; + + if (argc < 6 || argc > 7) + return CMD_RET_USAGE; + + id = (int)simple_strtoul(argv[1], &endp, 0); + if (*endp != '\0' || id > 0xffff) + return CMD_RET_FAILURE; + + sprintf(var_name, "Boot%04X", id); + utf8_to_utf16(var_name16, (u8 *)var_name, 9); + guid = efi_global_variable_guid; + + attr = 0x1; /* always ACTIVE */ + + label_len = strlen(argv[2]); + label_len16 = utf8_utf16_strnlen(argv[2], label_len); + label = malloc((label_len16 + 1) * sizeof(u16)); + if (!label) + return CMD_RET_FAILURE; + p = label; + utf8_utf16_strncpy(&p, argv[2], label_len); + + interface = argv[3]; + device = argv[4]; + file = argv[5]; + option = (argc == 6 ? "" : argv[6]); + + ret = efi_dp_from_name(interface, device, file, &device_path, + &file_path); + if (ret != EFI_SUCCESS) { + ret = CMD_RET_FAILURE; + goto out; + } + + size = efi_marshal_load_option(attr, label, file_path, option, &data); + if (!size) { + ret = CMD_RET_FAILURE; + goto out; + } + + ret = efi_set_variable(var_name16, &guid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, size, data); + ret = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE); +out: + free(data); + free(device_path); + free(file_path); + free(label); + return ret; +} + +static int do_efi_boot_rm(int argc, char * const argv[]) +{ + efi_guid_t guid; + int id, i; + char *endp; + char var_name[9]; + u16 var_name16[9]; + efi_status_t ret; + + if (argc == 1) + return CMD_RET_USAGE; + + guid = efi_global_variable_guid; + for (i = 1; i < argc; i++, argv++) { + id = (int)simple_strtoul(argv[1], &endp, 0); + if (*endp != '\0' || id > 0xffff) + return CMD_RET_FAILURE; + + sprintf(var_name, "Boot%04X", id); + utf8_to_utf16(var_name16, (u8 *)var_name, 9); + + ret = efi_set_variable(var_name16, &guid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL); + if (ret) { + printf("cannot remove Boot%04X", id); + return CMD_RET_FAILURE; + } + } + + return CMD_RET_SUCCESS; +} + +static void show_efi_boot_opt_data(int id, void *data) +{ + struct load_option lo; + char *label, *p; + size_t label_len16, label_len; + u16 *dp_str; + + efi_parse_load_option(&lo, data); + + label_len16 = u16_strlen(lo.label); + label_len = utf16_utf8_strnlen(lo.label, label_len16); + label = malloc(label_len + 1); + if (!label) + return; + p = label; + utf16_utf8_strncpy(&p, lo.label, label_len16); + + printf("Boot%04X:\n", id); + printf("\tattributes: %c%c%c (0x%08x)\n", + /* ACTIVE */ + lo.attributes & 0x1 ? 'A' : '-', + /* FORCE RECONNECT */ + lo.attributes & 0x2 ? 'R' : '-', + /* HIDDEN */ + lo.attributes & 0x8 ? 'H' : '-', + lo.attributes); + printf("\tlabel: %s\n", label); + + dp_str = efi_dp_str(lo.file_path); + printf("\tfile_path: %ls\n", dp_str); + efi_free_pool(dp_str); + + printf("\tdata: %s\n", lo.optional_data); + + free(label); +} + +static void show_efi_boot_opt(int id) +{ + char var_name[9]; + u16 var_name16[9]; + efi_guid_t guid; + void *data = NULL; + unsigned long size; + int ret; + + sprintf(var_name, "Boot%04X", id); + utf8_to_utf16(var_name16, (u8 *)var_name, 9); + guid = efi_global_variable_guid; + + size = 0; + ret = efi_get_variable(var_name16, &guid, NULL, &size, NULL); + if (ret == (int)EFI_BUFFER_TOO_SMALL) { + data = malloc(size); + ret = efi_get_variable(var_name16, &guid, NULL, &size, data); + } + if (ret == EFI_SUCCESS) { + show_efi_boot_opt_data(id, data); + free(data); + } else if (ret == EFI_NOT_FOUND) { + printf("Boot%04X: not found\n", id); + } +} + +static int do_efi_boot_dump(int argc, char * const argv[]) +{ + char regex[256]; + char * const regexlist[] = {regex}; + char *variables = NULL, *boot, *value; + int len; + int id; + + if (argc > 1) + return CMD_RET_USAGE; + + snprintf(regex, 256, "efi_.*-.*-.*-.*-.*_Boot[0-9A-F]+"); + + len = hexport_r(&env_htab, '\n', H_MATCH_REGEX | H_MATCH_KEY, + &variables, 0, 1, regexlist); + + if (!len) + return CMD_RET_SUCCESS; + + if (len < 0) + return CMD_RET_FAILURE; + + boot = variables; + while (*boot) { + value = strstr(boot, "Boot") + 4; + id = (int)simple_strtoul(value, NULL, 16); + show_efi_boot_opt(id); + boot = strchr(boot, '\n'); + if (!*boot) + break; + boot++; + } + free(variables); + + return CMD_RET_SUCCESS; +} + +static int show_efi_boot_order(void) +{ + efi_guid_t guid; + u16 *bootorder = NULL; + unsigned long size; + int num, i; + char var_name[9]; + u16 var_name16[9]; + void *data; + struct load_option lo; + char *label, *p; + size_t label_len16, label_len; + efi_status_t ret = CMD_RET_SUCCESS; + + guid = efi_global_variable_guid; + size = 0; + ret = efi_get_variable(L"BootOrder", &guid, NULL, &size, NULL); + if (ret == EFI_BUFFER_TOO_SMALL) { + bootorder = malloc(size); + ret = efi_get_variable(L"BootOrder", &guid, NULL, &size, + bootorder); + } + if (ret != EFI_SUCCESS) { + printf("BootOrder not defined\n"); + return CMD_RET_SUCCESS; + } + + num = size / sizeof(u16); + for (i = 0; i < num; i++) { + sprintf(var_name, "Boot%04X", bootorder[i]); + utf8_to_utf16(var_name16, (u8 *)var_name, 9); + + size = 0; + ret = efi_get_variable(var_name16, &guid, NULL, &size, NULL); + if (ret != EFI_BUFFER_TOO_SMALL) { + printf("%2d: Boot%04X: (not defined)\n", + i + 1, bootorder[i]); + continue; + } + + data = malloc(size); + if (!data) { + ret = CMD_RET_FAILURE; + goto out; + } + ret = efi_get_variable(var_name16, &guid, NULL, &size, data); + if (ret != EFI_SUCCESS) { + free(data); + ret = CMD_RET_FAILURE; + goto out; + } + + efi_parse_load_option(&lo, data); + + label_len16 = u16_strlen(lo.label); + label_len = utf16_utf8_strnlen(lo.label, label_len16); + label = malloc(label_len + 1); + if (!label) { + free(data); + ret = CMD_RET_FAILURE; + goto out; + } + p = label; + utf16_utf8_strncpy(&p, lo.label, label_len16); + printf("%2d: Boot%04X: %s\n", i + 1, bootorder[i], label); + free(label); + + free(data); + } +out: + free(bootorder); + + return ret; +} + +static int do_efi_boot_order(int argc, char * const argv[]) +{ + u16 *bootorder = NULL; + unsigned long size; + int id, i; + char *endp; + efi_guid_t guid; + efi_status_t ret; + + if (argc == 1) + return show_efi_boot_order(); + + argc--; + argv++; + + size = argc * sizeof(u16); + bootorder = malloc(size); + if (!bootorder) + return CMD_RET_FAILURE; + + for (i = 0; i < argc; i++) { + id = (int)simple_strtoul(argv[i], &endp, 0); + if (*endp != '\0' || id > 0xffff) { + printf("invalid value: %s\n", argv[i]); + ret = CMD_RET_FAILURE; + goto out; + } + + bootorder[i] = (u16)id; + } + + guid = efi_global_variable_guid; + ret = efi_set_variable(L"BootOrder", &guid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, size, bootorder); + ret = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE); +out: + free(bootorder); + + return ret; +} + +static int do_efi_boot_opt(int argc, char * const argv[]) +{ + char *sub_command; + + if (argc < 2) + return CMD_RET_USAGE; + + argc--; argv++; + sub_command = argv[0]; + + if (!strcmp(sub_command, "add")) + return do_efi_boot_add(argc, argv); + else if (!strcmp(sub_command, "rm")) + return do_efi_boot_rm(argc, argv); + else if (!strcmp(sub_command, "dump")) + return do_efi_boot_dump(argc, argv); + else if (!strcmp(sub_command, "order")) + return do_efi_boot_order(argc, argv); + else + return CMD_RET_USAGE; +} + +/* Interpreter command to configure EFI environment */ +static int do_efishell(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + char *command; + /* TODO: declare this somewhere else */ + extern efi_status_t efi_init_obj_list(void); + efi_status_t r; + + if (argc < 2) + return CMD_RET_USAGE; + + argc--; argv++; + command = argv[0]; + + /* Initialize EFI drivers */ + r = efi_init_obj_list(); + if (r != EFI_SUCCESS) { + printf("Error: Cannot set up EFI drivers, r = %lu\n", + r & ~EFI_ERROR_MASK); + return CMD_RET_FAILURE; + } + + if (!strcmp(command, "boot")) + return do_efi_boot_opt(argc, argv); + else if (!strcmp(command, "dumpvar")) + return do_efi_dump_var(argc, argv); + else if (!strcmp(command, "setvar")) + return do_efi_set_var(argc, argv); + else + return CMD_RET_USAGE; +} + +#ifdef CONFIG_SYS_LONGHELP +static char efishell_help_text[] = + " - EFI Shell-like interface to configure EFI environment\n" + "\n" + "efishell boot add