diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-04-30 17:57:30 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-05-02 18:17:50 +0200 |
commit | 556d8dc937f74fa8a5fa849b7e1393db3446f3b2 (patch) | |
tree | 0079463ca29cfa732c68747cc0062fce6daa6245 /cmd/bootefi.c | |
parent | 45203e0ccbfaab5eafe3b6a7b8bb742182a83077 (diff) | |
download | u-boot-556d8dc937f74fa8a5fa849b7e1393db3446f3b2.tar.gz |
efi_loader: implement support of exit data
In case of a failure exit data may be passed to Exit() which in turn is
returned by StartImage().
Let the `bootefi` command print the exit data string in case of an error.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r-- | cmd/bootefi.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index b93d8c6a32..f1d7d8bc66 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -297,6 +297,8 @@ static efi_status_t efi_install_fdt(const char *fdt_opt) static efi_status_t do_bootefi_exec(efi_handle_t handle) { efi_status_t ret; + efi_uintn_t exit_data_size = 0; + u16 *exit_data = NULL; /* Transfer environment variable as load options */ ret = set_load_options(handle, "bootargs"); @@ -304,7 +306,12 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle) return ret; /* Call our payload! */ - ret = EFI_CALL(efi_start_image(handle, NULL, NULL)); + ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data)); + printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK); + if (ret && exit_data) { + printf("## %ls\n", exit_data); + efi_free_pool(exit_data); + } efi_restore_gd(); @@ -357,7 +364,6 @@ static int do_efibootmgr(const char *fdt_opt) } ret = do_bootefi_exec(handle); - printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK); if (ret != EFI_SUCCESS) return CMD_RET_FAILURE; @@ -472,7 +478,6 @@ static int do_bootefi_image(const char *image_opt, const char *fdt_opt) goto out; ret = do_bootefi_exec(handle); - printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK); out: if (mem_handle) |