All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 9/9] cmd: add efibootmgr command
Date: Fri, 19 Apr 2019 12:22:36 +0900	[thread overview]
Message-ID: <20190419032236.8242-10-takahiro.akashi@linaro.org> (raw)
In-Reply-To: <20190419032236.8242-1-takahiro.akashi@linaro.org>

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 2bdbfcb3d091..46222be4a3c6 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 8c84fff590a7..348c6fdbe28d 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -644,3 +644,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;
+
+	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 */
-- 
2.20.1

  parent reply	other threads:[~2019-04-19  3:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19  3:22 [U-Boot] [PATCH 0/9] efi_loader: rework bootefi/bootmgr AKASHI Takahiro
2019-04-19  3:22 ` [U-Boot] [PATCH 1/9] cmd: bootefi: rework set_load_options() AKASHI Takahiro
2019-04-19  3:37   ` Heinrich Schuchardt
2019-04-19  3:22 ` [U-Boot] [PATCH 2/9] cmd: bootefi: carve out fdt handling from do_bootefi() AKASHI Takahiro
2019-04-19  3:43   ` Heinrich Schuchardt
2019-04-19  3:22 ` [U-Boot] [PATCH 3/9] cmd: bootefi: merge efi_install_fdt() and efi_process_fdt() AKASHI Takahiro
2019-04-19  4:06   ` Heinrich Schuchardt
2019-04-19  4:42     ` AKASHI Takahiro
2019-04-19  3:22 ` [U-Boot] [PATCH 4/9] cmd: bootefi: carve out efi_selftest code from do_bootefi() AKASHI Takahiro
2019-04-20  6:57   ` Heinrich Schuchardt
2019-04-19  3:22 ` [U-Boot] [PATCH 5/9] cmd: bootefi: move do_bootefi_bootmgr_exec() forward AKASHI Takahiro
2019-04-19  3:22 ` [U-Boot] [PATCH 6/9] cmd: bootefi: carve out bootmgr code from do_bootefi() AKASHI Takahiro
2019-04-20  7:47   ` Heinrich Schuchardt
2019-04-19  3:22 ` [U-Boot] [PATCH 7/9] cmd: bootefi: carve out do_bootefi_image() " AKASHI Takahiro
2019-04-19  3:22 ` [U-Boot] [PATCH 8/9] efi_loader: rework bootmgr/bootefi using load_image API AKASHI Takahiro
2019-04-20  8:07   ` Heinrich Schuchardt
2019-04-22  0:44     ` AKASHI Takahiro
2019-04-20  8:37   ` Heinrich Schuchardt
2019-04-20 17:37     ` Heinrich Schuchardt
2019-04-22  0:36       ` AKASHI Takahiro
2019-04-20 18:24     ` Heinrich Schuchardt
2019-04-22  1:05     ` AKASHI Takahiro
2019-04-21  7:02   ` Heinrich Schuchardt
2019-04-19  3:22 ` AKASHI Takahiro [this message]
2019-04-20  8:49   ` [U-Boot] [PATCH 9/9] cmd: add efibootmgr command Heinrich Schuchardt
2019-04-22 18:16 ` [U-Boot] [PATCH 0/9] efi_loader: rework bootefi/bootmgr Heinrich Schuchardt
2019-04-23  0:24   ` AKASHI, Takahiro
2019-04-23  4:57     ` Heinrich Schuchardt
2019-04-23  5:08       ` AKASHI, Takahiro
2020-01-03  0:17 ` Heinrich Schuchardt
2020-01-06  1:42   ` AKASHI Takahiro

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=20190419032236.8242-10-takahiro.akashi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.