@@ -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
@@ -1245,6 +1245,8 @@ def _add_limine_bootloader(
12451245 hook_command = None
12461246
12471247 if SysInfo .has_uefi ():
1248+ self .pacman .strap ('efibootmgr' )
1249+
12481250 if not efi_partition :
12491251 raise ValueError ('Could not detect efi partition' )
12501252 elif not efi_partition .mountpoint :
@@ -1253,7 +1255,7 @@ def _add_limine_bootloader(
12531255 info (f"Limine EFI partition: { efi_partition .dev_path } " )
12541256
12551257 try :
1256- efi_dir_path = self .target / efi_partition .mountpoint .relative_to ('/' ) / 'EFI' / 'BOOT '
1258+ efi_dir_path = self .target / efi_partition .mountpoint .relative_to ('/' ) / 'EFI' / 'Limine '
12571259 efi_dir_path .mkdir (parents = True , exist_ok = True )
12581260
12591261 for file in ('BOOTIA32.EFI' , 'BOOTX64.EFI' ):
@@ -1262,9 +1264,33 @@ def _add_limine_bootloader(
12621264 raise DiskError (f'Failed to install Limine in { self .target } { efi_partition .mountpoint } : { err } ' )
12631265
12641266 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 /'
1267+ f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI { efi_partition .mountpoint } /EFI/Limine /'
1268+ f' && /usr/bin/cp /usr/share/limine/BOOTX64.EFI { efi_partition .mountpoint } /EFI/Limine /'
12671269 )
1270+
1271+ # Create EFI boot menu entry for Limine.
1272+ try :
1273+ with open ('/sys/firmware/efi/fw_platform_size' , 'r' ) as fw_platform_size :
1274+ efi_bitness = fw_platform_size .read ().strip ()
1275+ except Exception as err :
1276+ raise error (f'Could not open or read /sys/firmware/efi/fw_platform_size to determine EFI bitness: { err } '
1277+
1278+ if efi_bitness == '64' :
1279+ loader_path = '/EFI/Limine/BOOTX64.EFI'
1280+ elif efi_bitness == '32' :
1281+ loader_path = '/EFI/Limine/BOOTIA32.EFI'
1282+ else :
1283+ raise error (f'EFI bitness is neither 32 nor 64 bits' )
1284+
1285+ try :
1286+ SysCommand (f'efibootmgr'
1287+ + ' --create'
1288+ + ' --disk ' + str (parent_dev_path )
1289+ + ' --part ' + str (boot_partition .partn )
1290+ + ' --label "Arch Linux via Limine Bootloader"'
1291+ + ' --loader ' + loader_path )
1292+ except Exception as err :
1293+ raise error (f'SysCommand for efibootmgr failed: { err } ' )
12681294 else :
12691295 parent_dev_path = device_handler .get_parent_device_path (boot_partition .safe_dev_path )
12701296
0 commit comments