Skip to content

Commit 2f40e35

Browse files
MingcongBaichenx97
authored andcommitted
util/grub-mkrescue: use capitalised paths for removable EFI images
Per UEFI Specification, section 3.4.1.1: ... If FilePathList[0] points to a device that supports the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, then the system firmware will attempt to boot from a removable media FilePathList[0] by adding a default file name in the form \EFI\BOOT\BOOT{machine type short-name}.EFI. While FAT < 32 filesystems are not case sensitive (which grub-mkrescue creates as a FAT12 image via mformat with a size of 2.88MiB), it seems that some of Loongson's LoongArch-based firmware (namely those found on their latest XA61200 boards) seems to treat this file system as case-sensitive. In this case, at least the XA61200 board seems incapable of identifying /efi/boot/bootloongarch64.efi as a valid removable EFI image. In any case, according to the UEFI Specification, all paths and image filenames should be capitalised (with the exception of BOOTx64.EFI, according to section 3.5.1.1, for some reason) to stay compliant. The Loongson case is only one example of users running into buggy firmware and unbootable GRUB ISO images. Signed-off-by: Mingcong Bai <[email protected]>
1 parent 1632a45 commit 2f40e35

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

util/grub-mkrescue.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ main (int argc, char *argv[])
769769
|| source_dirs[GRUB_INSTALL_PLATFORM_RISCV64_EFI])
770770
{
771771
FILE *f;
772-
char *efidir_efi = grub_util_path_concat (2, iso9660_dir, "efi");
773-
char *efidir_efi_boot = grub_util_path_concat (3, iso9660_dir, "efi", "boot");
772+
char *efidir_efi = grub_util_path_concat (2, iso9660_dir, "EFI");
773+
char *efidir_efi_boot = grub_util_path_concat (3, iso9660_dir, "EFI", "BOOT");
774774
char *imgname, *img32, *img64, *img_mac = NULL;
775775
char *efiimgfat, *iso_uuid_file, *diskdir, *diskdir_uuid;
776776
grub_install_mkdir_p (efidir_efi_boot);
@@ -792,39 +792,39 @@ main (int argc, char *argv[])
792792
free (diskdir_uuid);
793793
free (diskdir);
794794

795-
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootia64.efi");
795+
imgname = grub_util_path_concat (2, efidir_efi_boot, "BOOTIA64.EFI");
796796
make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname);
797797
free (imgname);
798798

799799
grub_install_push_module ("part_apple");
800-
img64 = grub_util_path_concat (2, efidir_efi_boot, "bootx64.efi");
800+
img64 = grub_util_path_concat (2, efidir_efi_boot, "BOOTx64.EFI");
801801
make_image_abs (GRUB_INSTALL_PLATFORM_X86_64_EFI, "x86_64-efi", img64);
802802
grub_install_pop_module ();
803803

804804
grub_install_push_module ("part_apple");
805-
img32 = grub_util_path_concat (2, efidir_efi_boot, "bootia32.efi");
805+
img32 = grub_util_path_concat (2, efidir_efi_boot, "BOOTIA32.EFI");
806806
make_image_abs (GRUB_INSTALL_PLATFORM_I386_EFI, "i386-efi", img32);
807807
grub_install_pop_module ();
808808

809-
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootarm.efi");
809+
imgname = grub_util_path_concat (2, efidir_efi_boot, "BOOTARM.EFI");
810810
make_image_abs (GRUB_INSTALL_PLATFORM_ARM_EFI, "arm-efi", imgname);
811811
free (imgname);
812812

813-
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootaa64.efi");
813+
imgname = grub_util_path_concat (2, efidir_efi_boot, "BOOTAA64.EFI");
814814
make_image_abs (GRUB_INSTALL_PLATFORM_ARM64_EFI, "arm64-efi", imgname);
815815
free (imgname);
816816

817-
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootloongarch64.efi");
817+
imgname = grub_util_path_concat (2, efidir_efi_boot, "BOOTLOONGARCH64.EFI");
818818
make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI,
819819
"loongarch64-efi",
820820
imgname);
821821
free (imgname);
822822

823-
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootriscv32.efi");
823+
imgname = grub_util_path_concat (2, efidir_efi_boot, "BOOTRISCV32.EFI");
824824
make_image_abs (GRUB_INSTALL_PLATFORM_RISCV32_EFI, "riscv32-efi", imgname);
825825
free (imgname);
826826

827-
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootriscv64.efi");
827+
imgname = grub_util_path_concat (2, efidir_efi_boot, "BOOTRISCV64.EFI");
828828
make_image_abs (GRUB_INSTALL_PLATFORM_RISCV64_EFI, "riscv64-efi", imgname);
829829
free (imgname);
830830

0 commit comments

Comments
 (0)