@@ -1235,7 +1235,7 @@ def _add_limine_bootloader(
12351235 root : PartitionModification | LvmVolume ,
12361236 uki_enabled : bool = False
12371237 ) -> None :
1238- debug ('Installing limine bootloader' )
1238+ debug ('Installing Limine bootloader' )
12391239
12401240 self .pacman .strap ('limine' )
12411241
@@ -1244,7 +1244,11 @@ def _add_limine_bootloader(
12441244 limine_path = self .target / 'usr' / 'share' / 'limine'
12451245 hook_command = None
12461246
1247+ parent_dev_path = device_handler .get_parent_device_path (boot_partition .safe_dev_path )
1248+
12471249 if SysInfo .has_uefi ():
1250+ self .pacman .strap ('efibootmgr' )
1251+
12481252 if not efi_partition :
12491253 raise ValueError ('Could not detect efi partition' )
12501254 elif not efi_partition .mountpoint :
@@ -1253,7 +1257,7 @@ def _add_limine_bootloader(
12531257 info (f"Limine EFI partition: { efi_partition .dev_path } " )
12541258
12551259 try :
1256- efi_dir_path = self .target / efi_partition .mountpoint .relative_to ('/' ) / 'EFI' / 'BOOT '
1260+ efi_dir_path = self .target / efi_partition .mountpoint .relative_to ('/' ) / 'EFI' / 'Limine '
12571261 efi_dir_path .mkdir (parents = True , exist_ok = True )
12581262
12591263 for file in ('BOOTIA32.EFI' , 'BOOTX64.EFI' ):
@@ -1262,12 +1266,34 @@ def _add_limine_bootloader(
12621266 raise DiskError (f'Failed to install Limine in { self .target } { efi_partition .mountpoint } : { err } ' )
12631267
12641268 hook_command = (
1265- f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI { efi_partition .mountpoint } /EFI/BOOT /'
1266- f' && /usr/bin/cp /usr/share/limine/BOOTX64.EFI { efi_partition .mountpoint } /EFI/BOOT /'
1269+ f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI { efi_partition .mountpoint } /EFI/Limine /'
1270+ f' && /usr/bin/cp /usr/share/limine/BOOTX64.EFI { efi_partition .mountpoint } /EFI/Limine /'
12671271 )
1268- else :
1269- parent_dev_path = device_handler .get_parent_device_path (boot_partition .safe_dev_path )
12701272
1273+ # Create EFI boot menu entry for Limine.
1274+ try :
1275+ with open ('/sys/firmware/efi/fw_platform_size' ) as fw_platform_size :
1276+ efi_bitness = fw_platform_size .read ().strip ()
1277+ except Exception as err :
1278+ error (f'Could not open or read /sys/firmware/efi/fw_platform_size to determine EFI bitness: { err } ' )
1279+
1280+ if efi_bitness == '64' :
1281+ loader_path = '/EFI/Limine/BOOTX64.EFI'
1282+ elif efi_bitness == '32' :
1283+ loader_path = '/EFI/Limine/BOOTIA32.EFI'
1284+ else :
1285+ error ('EFI bitness is neither 32 nor 64 bits' )
1286+
1287+ try :
1288+ SysCommand ('efibootmgr'
1289+ ' --create'
1290+ f' --disk { str (parent_dev_path )} '
1291+ f' --part { str (boot_partition .partn )} '
1292+ ' --label "Arch Linux via Limine Bootloader"'
1293+ f' --loader { loader_path } ' )
1294+ except Exception as err :
1295+ error (f'SysCommand for efibootmgr failed: { err } ' )
1296+ else :
12711297 if unique_path := device_handler .get_unique_path_for_device (parent_dev_path ):
12721298 parent_dev_path = unique_path
12731299
0 commit comments