efi: Provide wrappers for load_image, start_image and unload_image

These can be used to register a different implementation later,
for example, when shim provides a protocol with those functions.

Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
Signed-off-by: Mate Kukri <mate.kukri@canonical.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Julian Andres Klode authored and Daniel Kiper committed 2025-07-11 17:12:24 +02:00
1 parent 030a70fcad
commit 70897d3d3e
4 files changed
+109 -15

No files matched your search

+5 -8
View File
@@ -50,14 +50,12 @@ grub_chainloader_unload (void *context)
{
grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
grub_efi_loaded_image_t *loaded_image;
grub_efi_boot_services_t *b;
loaded_image = grub_efi_get_loaded_image (image_handle);
if (loaded_image != NULL)
grub_free (loaded_image->load_options);
b = grub_efi_system_table->boot_services;
b->unload_image (image_handle);
grub_efi_unload_image (image_handle);
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
@@ -73,7 +71,7 @@ grub_chainloader_boot (void *context)
grub_efi_char16_t *exit_data = NULL;
b = grub_efi_system_table->boot_services;
status = b->start_image (image_handle, &exit_data_size, &exit_data);
status = grub_efi_start_image (image_handle, &exit_data_size, &exit_data);
if (status != GRUB_EFI_SUCCESS)
{
if (exit_data)
@@ -339,9 +337,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
#endif
status = b->load_image (0, grub_efi_image_handle, file_path,
boot_image, size,
&image_handle);
status = grub_efi_load_image (0, grub_efi_image_handle, file_path,
boot_image, size, &image_handle);
if (status != GRUB_EFI_SUCCESS)
{
if (status == GRUB_EFI_OUT_OF_RESOURCES)
@@ -418,7 +415,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
b->free_pages (address, pages);
if (image_handle != NULL)
b->unload_image (image_handle);
grub_efi_unload_image (image_handle);
grub_dl_unref (my_mod);