@@ -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
@@ -1246,6 +1246,8 @@ def _add_limine_bootloader(
12461246 hook_command = None
12471247
12481248 if SysInfo .has_uefi ():
1249+ self .pacman .strap ('efibootmgr' )
1250+
12491251 if not efi_partition :
12501252 raise ValueError ('Could not detect efi partition' )
12511253 elif not efi_partition .mountpoint :
@@ -1254,7 +1256,7 @@ def _add_limine_bootloader(
12541256 info (f"Limine EFI partition: { efi_partition .dev_path } " )
12551257
12561258 try :
1257- efi_dir_path = self .target / efi_partition .mountpoint .relative_to ('/' ) / 'EFI' / 'BOOT '
1259+ efi_dir_path = self .target / efi_partition .mountpoint .relative_to ('/' ) / 'EFI' / 'limine '
12581260 efi_dir_path .mkdir (parents = True , exist_ok = True )
12591261
12601262 for file in ('BOOTIA32.EFI' , 'BOOTX64.EFI' ):
@@ -1265,9 +1267,40 @@ def _add_limine_bootloader(
12651267 config_path = efi_dir_path / 'limine.conf'
12661268
12671269 hook_command = (
1268- f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI { efi_partition .mountpoint } /EFI/BOOT /'
1269- f' && /usr/bin/cp /usr/share/limine/BOOTX64.EFI { efi_partition .mountpoint } /EFI/BOOT /'
1270+ f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI { efi_partition .mountpoint } /EFI/limine /'
1271+ f' && /usr/bin/cp /usr/share/limine/BOOTX64.EFI { efi_partition .mountpoint } /EFI/limine /'
12701272 )
1273+
1274+ # Create EFI boot menu entry for Limine.
1275+ parent_dev_path = device_handler .get_parent_device_path (efi_partition .safe_dev_path )
1276+
1277+ try :
1278+ with open ('/sys/firmware/efi/fw_platform_size' ) as fw_platform_size :
1279+ efi_bitness = fw_platform_size .read ().strip ()
1280+ except Exception as err :
1281+ error (f'Could not open or read /sys/firmware/efi/fw_platform_size to determine EFI bitness: { err } ' )
1282+
1283+ loader_path = None
1284+ if efi_bitness == '64' :
1285+ loader_path = '/EFI/limine/BOOTX64.EFI'
1286+ elif efi_bitness == '32' :
1287+ loader_path = '/EFI/limine/BOOTIA32.EFI'
1288+ else :
1289+ error ('EFI bitness is neither 32 nor 64 bits' )
1290+
1291+ try :
1292+ SysCommand (
1293+ 'efibootmgr'
1294+ ' --create'
1295+ f' --disk { parent_dev_path } '
1296+ f' --part { efi_partition .partn } '
1297+ ' --label "Arch Linux Limine Bootloader"'
1298+ f' --loader { loader_path } '
1299+ ' --unicode'
1300+ ' --verbose'
1301+ )
1302+ except Exception as err :
1303+ error (f'SysCommand for efibootmgr failed: { err } ' )
12711304 else :
12721305 boot_limine_path = self .target / 'boot' / 'limine'
12731306 boot_limine_path .mkdir (parents = True , exist_ok = True )
0 commit comments