Support aarch64 for GRUB and Limine EFI installation

On aarch64 both the GRUB and Limine installers assume x86 and fail.

GRUB names its EFI target 'arm64', but platform.machine() returns
'aarch64', so passing --target=aarch64-efi is rejected. Map aarch64
to the arm64 target name expected by grub-install.

Limine ships architecture-specific default EFI binaries: BOOTAA64.EFI
on aarch64 versus BOOTIA32.EFI and BOOTX64.EFI on x86. Select the
correct binaries in the three places that reference them: when copying
them into the ESP, when building the pacman hook that refreshes them on
update, and when choosing the 64-bit EFI boot menu loader path.
This commit is contained in:
Steev Klimaszewski 2026-07-17 17:20:28 -05:00
parent caff461f0b
commit 6b738a8023
1 changed files with 9 additions and 6 deletions

View File

@ -1359,7 +1359,7 @@ class Installer:
boot_dir = boot_partition.mountpoint
add_options = [
f'--target={platform.machine()}-efi',
f'--target={"arm64" if platform.machine() == "aarch64" else platform.machine()}-efi',
f'--efi-directory={efi_partition.mountpoint}',
*boot_dir_arg,
'--bootloader-id=GRUB',
@ -1480,6 +1480,11 @@ class Installer:
parent_dev_path = get_parent_device_path(efi_partition.safe_dev_path)
if platform.machine() == 'aarch64':
efi_binaries = ('BOOTAA64.EFI',)
else:
efi_binaries = ('BOOTIA32.EFI', 'BOOTX64.EFI')
try:
efi_dir_path = self.target / efi_partition.mountpoint.relative_to('/') / 'EFI'
efi_dir_path_target = efi_partition.mountpoint / 'EFI'
@ -1494,14 +1499,12 @@ class Installer:
efi_dir_path.mkdir(parents=True, exist_ok=True)
for file in ('BOOTIA32.EFI', 'BOOTX64.EFI'):
for file in efi_binaries:
(limine_path / file).copy_into(efi_dir_path)
except Exception as err:
raise DiskError(f'Failed to install Limine in {self.target}{efi_partition.mountpoint}: {err}')
hook_command = (
f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI {efi_dir_path_target}/ && /usr/bin/cp /usr/share/limine/BOOTX64.EFI {efi_dir_path_target}/'
)
hook_command = ' && '.join(f'/usr/bin/cp /usr/share/limine/{file} {efi_dir_path_target}/' for file in efi_binaries)
if not bootloader_removable:
# Create EFI boot menu entry for Limine.
@ -1512,7 +1515,7 @@ class Installer:
raise OSError(f'Could not open or read /sys/firmware/efi/fw_platform_size to determine EFI bitness: {err}')
if efi_bitness == '64':
loader_path = '\\EFI\\arch-limine\\BOOTX64.EFI'
loader_path = f'\\EFI\\arch-limine\\{"BOOTAA64.EFI" if platform.machine() == "aarch64" else "BOOTX64.EFI"}'
elif efi_bitness == '32':
loader_path = '\\EFI\\arch-limine\\BOOTIA32.EFI'
else: