Skip to content

Commit 6015952

Browse files
MingcongBaichenx97
authored andcommitted
grub-install: (loongarch64-efi) also install BOOTLOONGARCH.EFI
Some old-world firmware (especially that of the BPI01000 revision) does not recognise the standardised BOOTLOONGARCH64.EFI and only sees BOOTLOONGARCH.EFI as the removable image name. Make a copy (since it is FAT/VFAT) to satisfy both old- and new-world firmware.
1 parent 9776354 commit 6015952

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

util/grub-install.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,8 @@ main (int argc, char *argv[])
938938
const char *efi_distributor = NULL;
939939
const char *efi_file = NULL;
940940
const char *removeable_efi_file = NULL;
941+
const char *efi_file_ow = NULL;
942+
const char *removeable_efi_file_ow = NULL;
941943
char **grub_devices;
942944
grub_fs_t grub_fs;
943945
grub_device_t grub_dev = NULL;
@@ -1274,6 +1276,7 @@ main (int argc, char *argv[])
12741276
break;
12751277
case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI:
12761278
efi_file = "BOOTLOONGARCH64.EFI";
1279+
efi_file_ow = "BOOTLOONGARCH.EFI";
12771280
break;
12781281
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
12791282
efi_file = "BOOTRISCV32.EFI";
@@ -1288,6 +1291,7 @@ main (int argc, char *argv[])
12881291
if (force_extra_removable)
12891292
{
12901293
removeable_efi_file = efi_file;
1294+
removeable_efi_file_ow = efi_file_ow;
12911295
}
12921296
}
12931297
if (!removable)
@@ -1314,6 +1318,7 @@ main (int argc, char *argv[])
13141318
break;
13151319
case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI:
13161320
efi_file = "grubloongarch64.efi";
1321+
efi_file_ow = NULL;
13171322
break;
13181323
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
13191324
efi_file = "grubriscv32.efi";
@@ -2091,8 +2096,21 @@ main (int argc, char *argv[])
20912096
char *dst = grub_util_path_concat (2, efidir, efi_file);
20922097
grub_install_copy_file (imgfile, dst, 1);
20932098

2099+
if (platform == GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI && efi_file_ow)
2100+
{
2101+
char *dst_ow = grub_util_path_concat (2, efidir, efi_file_ow);
2102+
grub_install_copy_file (imgfile, dst_ow, 1);
2103+
free (dst_ow);
2104+
}
2105+
20942106
if (force_extra_removable)
2107+
{
20952108
also_install_removable(imgfile, base_efidir, removeable_efi_file);
2109+
if (platform == GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI && removeable_efi_file_ow)
2110+
{
2111+
also_install_removable(imgfile, base_efidir, removeable_efi_file_ow);
2112+
}
2113+
}
20962114

20972115
grub_set_install_backup_ponr ();
20982116

0 commit comments

Comments
 (0)