From mboxrd@z Thu Jan 1 00:00:00 1970 From: AKASHI Takahiro Date: Fri, 22 Feb 2019 10:04:51 +0900 Subject: [U-Boot] [PATCH v7 2/7] cmd: add efidebug command In-Reply-To: References: <20190221062652.3641-1-takahiro.akashi@linaro.org> <20190221062652.3641-3-takahiro.akashi@linaro.org> Message-ID: <20190222010449.GN20286@linaro.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Feb 21, 2019 at 08:24:21PM +0100, Heinrich Schuchardt wrote: > On 2/21/19 7:26 AM, AKASHI Takahiro wrote: > > 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, efidebug, helps address these issues and give us > > more friendly interfaces: > > * efidebug boot add: add BootXXXX variable > > * efidebug boot rm: remove BootXXXX variable > > * efidebug boot dump: display all BootXXXX variables > > * efidebug boot next: set BootNext variable > > * efidebug boot order: set/display a boot order (BootOrder) > > > > Signed-off-by: AKASHI Takahiro > > --- > > MAINTAINERS | 1 + > > cmd/Kconfig | 10 + > > cmd/Makefile | 1 + > > cmd/efidebug.c | 578 +++++++++++++++++++++++++++++++++++++++++++++++++ > > 4 files changed, 590 insertions(+) > > create mode 100644 cmd/efidebug.c > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 0cce9db2660e..4fabb75eda37 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -471,6 +471,7 @@ F: lib/efi*/ > > F: test/py/tests/test_efi* > > F: test/unicode_ut.c > > F: cmd/bootefi.c > > +F: cmd/efidebug.c > > F: cmd/nvedit_efi.c > > F: tools/file2include.c > > > > diff --git a/cmd/Kconfig b/cmd/Kconfig > > index ddcdee44538d..88b086b074be 100644 > > --- a/cmd/Kconfig > > +++ b/cmd/Kconfig > > @@ -1407,6 +1407,16 @@ config CMD_DISPLAY > > displayed on a simple board-specific display. Implement > > display_putc() to use it. > > > > +config CMD_EFIDEBUG > > + bool "efidebug - display/configure UEFI environment" > > + depends on EFI_LOADER > > + default n > > + help > > + Enable the 'efidebug' command which provides a subset of UEFI > > + shell utility with simplified functionality. It will be useful > > + particularly for managing boot parameters as well as examining > > + various EFI status for debugging. > > + > > config CMD_LED > > bool "led" > > default y if LED > > diff --git a/cmd/Makefile b/cmd/Makefile > > index b9ee51869d48..acb85f49fba8 100644 > > --- a/cmd/Makefile > > +++ b/cmd/Makefile > > @@ -51,6 +51,7 @@ obj-$(CONFIG_CMD_ECHO) += echo.o > > obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o > > obj-$(CONFIG_CMD_EEPROM) += eeprom.o > > obj-$(CONFIG_EFI_STUB) += efi.o > > +obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o > > obj-$(CONFIG_CMD_ELF) += elf.o > > obj-$(CONFIG_HUSH_PARSER) += exit.o > > obj-$(CONFIG_CMD_EXT4) += ext4.o > > diff --git a/cmd/efidebug.c b/cmd/efidebug.c > > new file mode 100644 > > index 000000000000..641ec98a4d32 > > --- /dev/null > > +++ b/cmd/efidebug.c > > @@ -0,0 +1,578 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * UEFI Shell-like command > > + * > > + * Copyright (c) 2018 AKASHI Takahiro, Linaro Limited > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/** > > + * do_efi_boot_add() - set UEFI boot option > > + * > > + * @cmdtp: Command table > > + * @flag: Command flag > > + * @argc: Number of arguments > > + * @argv: Argument array > > + * Return: CMD_RET_SUCCESS on success, > > + * CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure > > + * > > + * Implement efidebug "boot add" sub-command. > > + * Create or change UEFI boot option. > > + * - boot add