1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

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>
This commit is contained in:
Heinrich Schuchardt
2019-04-30 17:57:30 +02:00
parent 45203e0ccb
commit 556d8dc937
3 changed files with 60 additions and 3 deletions

View File

@@ -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)