mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-13 18:56:59 +02:00
efi_loader: binary_run: register an initrd
Add support to install an initrd when running an EFI binary with efi_binary_run Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
73c9a35270
commit
36835a9105
@ -507,7 +507,8 @@ static int do_bootm_efi(int flag, struct bootm_info *bmi)
|
||||
|
||||
ret = efi_binary_run(image_buf, images->os.image_len,
|
||||
images->ft_len
|
||||
? images->ft_addr : EFI_FDT_USE_INTERNAL);
|
||||
? images->ft_addr : EFI_FDT_USE_INTERNAL,
|
||||
NULL, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
}
|
||||
}
|
||||
|
||||
ret = efi_binary_run(image_buf, size, fdt);
|
||||
ret = efi_binary_run(image_buf, size, fdt, NULL, 0);
|
||||
|
||||
if (ret != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
|
@ -600,7 +600,7 @@ efi_status_t efi_install_fdt(void *fdt);
|
||||
/* Execute loaded UEFI image */
|
||||
efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options);
|
||||
/* Run loaded UEFI image with given fdt */
|
||||
efi_status_t efi_binary_run(void *image, size_t size, void *fdt);
|
||||
efi_status_t efi_binary_run(void *image, size_t size, void *fdt, void *initrd, size_t initrd_sz);
|
||||
|
||||
/**
|
||||
* efi_bootflow_run() - Run a bootflow containing an EFI application
|
||||
|
@ -204,6 +204,8 @@ out:
|
||||
* @image: memory address of the UEFI image
|
||||
* @size: size of the UEFI image
|
||||
* @fdt: device-tree
|
||||
* @initrd: initrd
|
||||
* @initrd_sz: initrd size
|
||||
* @dp_dev: EFI device-path
|
||||
* @dp_img: EFI image-path
|
||||
*
|
||||
@ -213,10 +215,12 @@ out:
|
||||
* Return: status code
|
||||
*/
|
||||
static efi_status_t efi_binary_run_dp(void *image, size_t size, void *fdt,
|
||||
void *initrd, size_t initd_sz,
|
||||
struct efi_device_path *dp_dev,
|
||||
struct efi_device_path *dp_img)
|
||||
{
|
||||
efi_status_t ret;
|
||||
struct efi_device_path *dp_initrd;
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
ret = efi_init_obj_list();
|
||||
@ -230,6 +234,14 @@ static efi_status_t efi_binary_run_dp(void *image, size_t size, void *fdt,
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
|
||||
dp_initrd = efi_dp_from_mem(EFI_LOADER_DATA, (uintptr_t)initrd, initd_sz);
|
||||
if (!dp_initrd)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
||||
ret = efi_initrd_register(dp_initrd);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
|
||||
return efi_run_image(image, size, dp_dev, dp_img);
|
||||
}
|
||||
|
||||
@ -239,13 +251,15 @@ static efi_status_t efi_binary_run_dp(void *image, size_t size, void *fdt,
|
||||
* @image: memory address of the UEFI image
|
||||
* @size: size of the UEFI image
|
||||
* @fdt: device-tree
|
||||
* @initrd: initrd
|
||||
* @initrd_sz: initrd size
|
||||
*
|
||||
* Execute an EFI binary image loaded at @image.
|
||||
* @size may be zero if the binary is loaded with U-Boot load command.
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
efi_status_t efi_binary_run(void *image, size_t size, void *fdt)
|
||||
efi_status_t efi_binary_run(void *image, size_t size, void *fdt, void *initrd, size_t initrd_sz)
|
||||
{
|
||||
efi_handle_t mem_handle = NULL;
|
||||
struct efi_device_path *file_path = NULL;
|
||||
@ -273,7 +287,7 @@ efi_status_t efi_binary_run(void *image, size_t size, void *fdt)
|
||||
log_debug("Loaded from disk\n");
|
||||
}
|
||||
|
||||
ret = efi_binary_run_dp(image, size, fdt, bootefi_device_path,
|
||||
ret = efi_binary_run_dp(image, size, fdt, initrd, initrd_sz, bootefi_device_path,
|
||||
bootefi_image_path);
|
||||
out:
|
||||
if (mem_handle) {
|
||||
@ -355,7 +369,7 @@ efi_status_t efi_bootflow_run(struct bootflow *bflow)
|
||||
log_debug("Booting with external fdt\n");
|
||||
fdt = map_sysmem(bflow->fdt_addr, 0);
|
||||
}
|
||||
ret = efi_binary_run_dp(bflow->buf, bflow->size, fdt, device, image);
|
||||
ret = efi_binary_run_dp(bflow->buf, bflow->size, fdt, NULL, 0, device, image);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user