aboutsummaryrefslogtreecommitdiff
path: root/boot/bootm_os.c
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2023-11-21 10:29:46 +0900
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-12-17 13:04:54 +0100
commit7017fc54a5bccd95bebaf371bfa3098fcf84068a (patch)
tree27f3409063918d0b50fd22e2cba3e23909ebc98b /boot/bootm_os.c
parent01adf0a408e34a24f7471ff67f3defdeec4c56f3 (diff)
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>
Diffstat (limited to 'boot/bootm_os.c')
-rw-r--r--boot/bootm_os.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/boot/bootm_os.c b/boot/bootm_os.c
index b92422171a..dc4046ad08 100644
--- a/boot/bootm_os.c
+++ b/boot/bootm_os.c
@@ -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;
- }
+ /* We expect to return */
+ images->os.type = IH_TYPE_STANDALONE;
- /* 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;
- }
+ image_buf = map_sysmem(images->ep, images->os.image_len);
/* 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;
+ ret = efi_binary_run(image_buf, images->os.image_len,
+ images->ft_len
+ ? images->ft_addr : EFI_FDT_USE_INTERNAL);
- 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;
+ return ret;
}
#endif