Skip to content

Commit e2308c0

Browse files
Steev Klimaszewskisteev
authored andcommitted
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.
1 parent 6dff852 commit e2308c0

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

archinstall/lib/installer.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ def _add_grub_bootloader(
13551355
boot_dir = boot_partition.mountpoint
13561356

13571357
add_options = [
1358-
f'--target={platform.machine()}-efi',
1358+
f'--target={"arm64" if platform.machine() == "aarch64" else platform.machine()}-efi',
13591359
f'--efi-directory={efi_partition.mountpoint}',
13601360
*boot_dir_arg,
13611361
'--bootloader-id=GRUB',
@@ -1489,15 +1489,19 @@ def _add_limine_bootloader(
14891489

14901490
efi_dir_path.mkdir(parents=True, exist_ok=True)
14911491

1492+
efi_binaries: tuple[str, ...]
1493+
if platform.machine() == 'aarch64':
1494+
efi_binaries = ('BOOTAA64.EFI',)
1495+
else:
1496+
efi_binaries = ('BOOTIA32.EFI', 'BOOTX64.EFI')
1497+
14921498
try:
1493-
for file in ('BOOTIA32.EFI', 'BOOTX64.EFI'):
1499+
for file in efi_binaries:
14941500
(limine_path / file).copy_into(efi_dir_path)
14951501
except Exception as err:
14961502
raise DiskError(f'Failed to install Limine in {self.target}{efi_partition.mountpoint}: {err}')
14971503

1498-
hook_command = (
1499-
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}/'
1500-
)
1504+
hook_command = ' && '.join(f'/usr/bin/cp /usr/share/limine/{file} {efi_dir_path_target}/' for file in efi_binaries)
15011505

15021506
if not bootloader_removable:
15031507
# Create EFI boot menu entry for Limine.
@@ -1508,7 +1512,7 @@ def _add_limine_bootloader(
15081512
raise OSError(f'Could not open or read /sys/firmware/efi/fw_platform_size to determine EFI bitness: {err}')
15091513

15101514
if efi_bitness == '64':
1511-
loader_path = '\\EFI\\arch-limine\\BOOTX64.EFI'
1515+
loader_path = f'\\EFI\\arch-limine\\{"BOOTAA64.EFI" if platform.machine() == "aarch64" else "BOOTX64.EFI"}'
15121516
elif efi_bitness == '32':
15131517
loader_path = '\\EFI\\arch-limine\\BOOTIA32.EFI'
15141518
else:

0 commit comments

Comments
 (0)