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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user