From a41fafd3ce23b22248083a57eeeff4d115077ae6 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 25 Nov 2022 17:22:16 +0000 Subject: [PATCH] util/grub-mkrescue: Preserve a copy of the EFI bootloaders on the ISO 9660 file system 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 Reviewed-by: Daniel Kiper --- util/grub-mkrescue.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c index 59a0b5db4..b9d16f5ad 100644 --- a/util/grub-mkrescue.c +++ b/util/grub-mkrescue.c @@ -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 (); -- 2.47.2