public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC v3 10/10] cmd: add efibootmgr command
Date: Wed, 17 Apr 2019 17:07:21 +0900	[thread overview]
Message-ID: <20190417080720.GT7158@linaro.org> (raw)
In-Reply-To: <087dda28-6701-68b7-fa1f-8420852cba81@gmx.de>

On Tue, Apr 16, 2019 at 07:27:10AM +0200, Heinrich Schuchardt wrote:
> On 4/16/19 6:24 AM, AKASHI Takahiro wrote:
> >Add CONFIG_CMD_STANDALONE_EFIBOOTMGR.
> >With this patch, EFI boot manager can be kicked in by a standalone
> >command, efibootmgr.
> >
> >Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >---
> >  cmd/Kconfig   |  8 ++++++++
> >  cmd/bootefi.c | 35 +++++++++++++++++++++++++++++++++++
> >  2 files changed, 43 insertions(+)
> >
> >diff --git a/cmd/Kconfig b/cmd/Kconfig
> >index 0b07b3b9d777..6c9a9f821e54 100644
> >--- a/cmd/Kconfig
> >+++ b/cmd/Kconfig
> >@@ -224,6 +224,14 @@ config CMD_BOOTEFI
> >  	help
> >  	  Boot an EFI image from memory.
> >
> >+config CMD_STANDALONE_EFIBOOTMGR
> >+	bool "Enable EFI Boot Manager as a standalone command"
> >+	depends on CMD_BOOTEFI
> >+	default n
> >+	help
> >+          With this option enabled, EFI Boot Manager can be invoked
> >+	  as a standalone command.
> >+
> >  config CMD_BOOTEFI_HELLO_COMPILE
> >  	bool "Compile a standard EFI hello world binary for testing"
> >  	depends on CMD_BOOTEFI && !CPU_V7M && !SANDBOX
> >diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> >index 97d49a53a44b..1afa86256670 100644
> >--- a/cmd/bootefi.c
> >+++ b/cmd/bootefi.c
> >@@ -631,3 +631,38 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
> >  		bootefi_image_path = NULL;
> >  	}
> >  }
> >+
> >+#ifdef CONFIG_CMD_STANDALONE_EFIBOOTMGR
> >+static int do_efibootmgr_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
> >+			     char * const argv[])
> >+{
> >+	char *fdt_opt;
> >+	int ret;
> >+
> >+	if (argc != 1)
> >+		return CMD_RET_USAGE;
> 
> Why would you not allow to pass a device tree address?

I think I explained in the past:
The current *secure boot* feature in U-Boot assumes that a single
command without any arguments be invoked. See cli_secure_boot_cmd()
in common/cli.c.

> I think we do not need to different ways to invoke the boot manager.
> 
> We should either have either `bootefi bootmgr` or `efibootmgr`.

This patch is not essential in this patch series, so it's up to you
if it's merged or not.
I will re-visit this issue when I submit *secure boot* patch.

Thanks,
-Takahiro Akashi


> Best regards
> 
> Heinrich
> 
> >+
> >+	fdt_opt = env_get("fdtaddr");
> >+	if (!fdt_opt)
> >+		fdt_opt = env_get("fdtcontroladdr");
> >+
> >+	ret = do_efibootmgr(fdt_opt);
> >+
> >+	free(fdt_opt);
> >+
> >+	return ret;
> >+}
> >+
> >+#ifdef CONFIG_SYS_LONGHELP
> >+static char efibootmgr_help_text[] =
> >+	"(no arguments)\n"
> >+	" - Launch EFI boot manager and execute EFI application\n"
> >+	"   based on BootNext and BootOrder variables\n";
> >+#endif
> >+
> >+U_BOOT_CMD(
> >+	efibootmgr, 1, 0, do_efibootmgr_cmd,
> >+	"Launch EFI boot manager",
> >+	efibootmgr_help_text
> >+);
> >+#endif /* CONFIG_CMD_STANDALONE_EFIBOOTMGR */
> >
> 

      reply	other threads:[~2019-04-17  8:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16  4:24 [U-Boot] [RFC v3 00/10] efi_loader: rework bootefi/bootmgr AKASHI Takahiro
2019-04-16  4:24 ` [U-Boot] [RFC v3 01/10] efi_loader: device_path: handle special case of loading AKASHI Takahiro
2019-04-16  4:44   ` Heinrich Schuchardt
2019-04-16  4:24 ` [U-Boot] [RFC v3 02/10] efi_loader: export root node handle AKASHI Takahiro
2019-04-16  4:48   ` Heinrich Schuchardt
2019-04-17  6:57     ` AKASHI Takahiro
2019-04-16  4:24 ` [U-Boot] [RFC v3 03/10] cmd: bootefi: carve out fdt handling from do_bootefi() AKASHI Takahiro
2019-04-16  4:54   ` Heinrich Schuchardt
2019-04-17  7:01     ` AKASHI Takahiro
2019-04-17 16:35       ` Heinrich Schuchardt
2019-04-18  0:16         ` AKASHI Takahiro
2019-04-16  4:24 ` [U-Boot] [RFC v3 04/10] cmd: bootefi: merge efi_install_fdt() and efi_process_fdt() AKASHI Takahiro
2019-04-16  5:05   ` Heinrich Schuchardt
2019-04-17 10:53   ` Heinrich Schuchardt
2019-04-16  4:24 ` [U-Boot] [RFC v3 05/10] cmd: bootefi: carve out efi_selftest code from do_bootefi() AKASHI Takahiro
2019-04-16  5:21   ` Heinrich Schuchardt
2019-04-17  7:19     ` AKASHI Takahiro
2019-04-16  4:24 ` [U-Boot] [RFC v3 06/10] cmd: bootefi: move do_bootefi_bootmgr_exec() forward AKASHI Takahiro
2019-04-16  5:22   ` Heinrich Schuchardt
2019-04-16  4:24 ` [U-Boot] [RFC v3 07/10] cmd: bootefi: carve out bootmgr code from do_bootefi() AKASHI Takahiro
2019-04-16  4:24 ` [U-Boot] [RFC v3 08/10] cmd: bootefi: carve out do_boot_efi() " AKASHI Takahiro
2019-04-16  5:31   ` Heinrich Schuchardt
2019-04-17  7:43     ` AKASHI Takahiro
2019-04-16  4:24 ` [U-Boot] [RFC v3 09/10] efi_loader: rework bootmgr/bootefi using load_image API AKASHI Takahiro
2019-04-16 10:56   ` Heinrich Schuchardt
2019-04-16 16:20     ` Heinrich Schuchardt
2019-04-18  8:29       ` Alexander Graf
2019-04-18  0:13     ` AKASHI Takahiro
2019-04-18  3:06       ` AKASHI Takahiro
2019-04-16  4:24 ` [U-Boot] [RFC v3 10/10] cmd: add efibootmgr command AKASHI Takahiro
2019-04-16  5:27   ` Heinrich Schuchardt
2019-04-17  8:07     ` AKASHI Takahiro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190417080720.GT7158@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox