]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
util/grub-mkrescue: Preserve a copy of the EFI bootloaders on the ISO 9660 file system
authorPete Batard <pete@akeo.ie>
Fri, 25 Nov 2022 17:22:16 +0000 (17:22 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 10 Jan 2023 14:43:12 +0000 (15:43 +0100)
To enable file system transposition support for UEFI, we also must ensure that
there exists a copy of the EFI bootloaders, that are currently embedded in the
efi.img for xorriso, at their expected UEFI location on the ISO 9660 file system.

This is accomplished by removing the use of a temporary directory to create the
efi/ content, to instead place it at the root of the ISO 9660 content.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/grub-mkrescue.c

index 59a0b5db4f42eeb25be9c436df50448544d508f9..b9d16f5add02305437b9e6725e5f0dbc78ec533d 100644 (file)
@@ -745,9 +745,8 @@ main (int argc, char *argv[])
       || source_dirs[GRUB_INSTALL_PLATFORM_RISCV32_EFI]
       || source_dirs[GRUB_INSTALL_PLATFORM_RISCV64_EFI])
     {
-      char *efidir = grub_util_make_temporary_dir ();
-      char *efidir_efi = grub_util_path_concat (2, efidir, "efi");
-      char *efidir_efi_boot = grub_util_path_concat (3, efidir, "efi", "boot");
+      char *efidir_efi = grub_util_path_concat (2, iso9660_dir, "efi");
+      char *efidir_efi_boot = grub_util_path_concat (3, iso9660_dir, "efi", "boot");
       char *imgname, *img32, *img64, *img_mac = NULL;
       char *efiimgfat;
       grub_install_mkdir_p (efidir_efi_boot);
@@ -828,10 +827,9 @@ main (int argc, char *argv[])
       xorriso_push ("-efi-boot-part");
       xorriso_push ("--efi-boot-image");
 
-      grub_util_unlink_recursive (efidir);
+      /* Don't unlink the efidir_efi_boot directory so that we have a duplicate on the ISO 9660 file system. */
       free (efiimgfat);
       free (efidir_efi);
-      free (efidir);
       grub_install_pop_module ();
       grub_install_pop_module ();
       grub_install_pop_module ();