mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
bootmeth: use efi_loader interfaces instead of bootefi command
Now that efi_loader subsystem provides interfaces that are equivalent with bootefi command, we can replace command invocations with APIs. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
This commit is contained in:
parent
01adf0a408
commit
7017fc54a5
7 changed files with 18 additions and 40 deletions
|
@ -523,7 +523,7 @@ config BOOTMETH_EXTLINUX_PXE
|
|||
|
||||
config BOOTMETH_EFILOADER
|
||||
bool "Bootdev support for EFI boot"
|
||||
depends on CMD_BOOTEFI
|
||||
depends on BOOTEFI_BOOTMGR
|
||||
default y
|
||||
help
|
||||
Enables support for EFI boot using bootdevs. This makes the
|
||||
|
@ -558,7 +558,7 @@ config BOOTMETH_DISTRO
|
|||
select BOOTMETH_SCRIPT if CMDLINE # E.g. Armbian uses scripts
|
||||
select BOOTMETH_EXTLINUX # E.g. Debian uses these
|
||||
select BOOTMETH_EXTLINUX_PXE if CMD_PXE && CMD_NET && DM_ETH
|
||||
select BOOTMETH_EFILOADER if CMD_BOOTEFI # E.g. Ubuntu uses this
|
||||
select BOOTMETH_EFILOADER if BOOTEFI_BOOTMGR # E.g. Ubuntu uses this
|
||||
|
||||
config SPL_BOOTMETH_VBE
|
||||
bool "Bootdev support for Verified Boot for Embedded (SPL)"
|
||||
|
|
|
@ -34,7 +34,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_CROS) += bootm.o bootm_os.o bootmeth_cros.o
|
|||
obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o
|
||||
ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL
|
||||
obj-$(CONFIG_CMD_BOOTEFI_BOOTMGR) += bootmeth_efi_mgr.o
|
||||
obj-$(CONFIG_BOOTEFI_BOOTMGR) += bootmeth_efi_mgr.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)EXPO) += bootflow_menu.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootflow_menu.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)CEDIT) += cedit.o
|
||||
|
|
|
@ -476,43 +476,27 @@ static int do_bootm_tee(int flag, int argc, char *const argv[],
|
|||
static int do_bootm_efi(int flag, int argc, char *const argv[],
|
||||
struct bootm_headers *images)
|
||||
{
|
||||
efi_status_t efi_ret;
|
||||
int ret;
|
||||
void *image_buf;
|
||||
|
||||
if (flag != BOOTM_STATE_OS_GO)
|
||||
return 0;
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
efi_ret = efi_init_obj_list();
|
||||
if (efi_ret != EFI_SUCCESS) {
|
||||
printf("## Failed to initialize UEFI sub-system: r = %lu\n",
|
||||
efi_ret & ~EFI_ERROR_MASK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Install device tree */
|
||||
efi_ret = efi_install_fdt(images->ft_len
|
||||
? images->ft_addr : EFI_FDT_USE_INTERNAL);
|
||||
if (efi_ret != EFI_SUCCESS) {
|
||||
printf("## Failed to install device tree: r = %lu\n",
|
||||
efi_ret & ~EFI_ERROR_MASK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Run EFI image */
|
||||
printf("## Transferring control to EFI (at address %08lx) ...\n",
|
||||
images->ep);
|
||||
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
||||
|
||||
/* We expect to return */
|
||||
images->os.type = IH_TYPE_STANDALONE;
|
||||
|
||||
image_buf = map_sysmem(images->ep, images->os.image_len);
|
||||
|
||||
efi_ret = efi_run_image(image_buf, images->os.image_len);
|
||||
if (efi_ret != EFI_SUCCESS)
|
||||
return 1;
|
||||
return 0;
|
||||
/* Run EFI image */
|
||||
printf("## Transferring control to EFI (at address %08lx) ...\n",
|
||||
images->ep);
|
||||
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
||||
|
||||
ret = efi_binary_run(image_buf, images->os.image_len,
|
||||
images->ft_len
|
||||
? images->ft_addr : EFI_FDT_USE_INTERNAL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -413,7 +413,6 @@ static int distro_efi_read_bootflow(struct udevice *dev, struct bootflow *bflow)
|
|||
static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow)
|
||||
{
|
||||
ulong kernel, fdt;
|
||||
char cmd[50];
|
||||
int ret;
|
||||
|
||||
kernel = env_get_hex("kernel_addr_r", 0);
|
||||
|
@ -442,12 +441,7 @@ static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow)
|
|||
fdt = env_get_hex("fdt_addr_r", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* At some point we can add a real interface to bootefi so we can call
|
||||
* this directly. For now, go through the CLI, like distro boot.
|
||||
*/
|
||||
snprintf(cmd, sizeof(cmd), "bootefi %lx %lx", kernel, fdt);
|
||||
if (run_command(cmd, 0))
|
||||
if (efi_binary_run(map_sysmem(kernel, 0), 0, map_sysmem(fdt, 0)))
|
||||
return log_msg_ret("run", -EINVAL);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -87,7 +87,7 @@ static int efi_mgr_boot(struct udevice *dev, struct bootflow *bflow)
|
|||
int ret;
|
||||
|
||||
/* Booting is handled by the 'bootefi bootmgr' command */
|
||||
ret = run_command("bootefi bootmgr", 0);
|
||||
ret = efi_bootmgr_run(EFI_FDT_USE_INTERNAL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ config CMD_BOOTMETH
|
|||
|
||||
config BOOTM_EFI
|
||||
bool "Support booting UEFI FIT images"
|
||||
depends on CMD_BOOTEFI && CMD_BOOTM && FIT
|
||||
depends on BOOTEFI_BOOTMGR && CMD_BOOTM && FIT
|
||||
default y
|
||||
help
|
||||
Support booting UEFI FIT images via the bootm command.
|
||||
|
|
|
@ -374,7 +374,7 @@ static int bootflow_system(struct unit_test_state *uts)
|
|||
{
|
||||
struct udevice *bootstd, *dev;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR))
|
||||
if (!IS_ENABLED(CONFIG_BOOTEFI_BOOTMGR))
|
||||
return -EAGAIN;
|
||||
ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
|
||||
ut_assertok(device_bind(bootstd, DM_DRIVER_GET(bootmeth_efi_mgr),
|
||||
|
|
Loading…
Reference in a new issue