@@ -1235,7 +1235,7 @@ def _add_limine_bootloader(
1235
1235
root : PartitionModification | LvmVolume ,
1236
1236
uki_enabled : bool = False
1237
1237
) -> None :
1238
- debug ('Installing limine bootloader' )
1238
+ debug ('Installing Limine bootloader' )
1239
1239
1240
1240
self .pacman .strap ('limine' )
1241
1241
@@ -1245,6 +1245,8 @@ def _add_limine_bootloader(
1245
1245
hook_command = None
1246
1246
1247
1247
if SysInfo .has_uefi ():
1248
+ self .pacman .strap ('efibootmgr' )
1249
+
1248
1250
if not efi_partition :
1249
1251
raise ValueError ('Could not detect efi partition' )
1250
1252
elif not efi_partition .mountpoint :
@@ -1253,7 +1255,7 @@ def _add_limine_bootloader(
1253
1255
info (f"Limine EFI partition: { efi_partition .dev_path } " )
1254
1256
1255
1257
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 '
1257
1259
efi_dir_path .mkdir (parents = True , exist_ok = True )
1258
1260
1259
1261
for file in ('BOOTIA32.EFI' , 'BOOTX64.EFI' ):
@@ -1262,9 +1264,39 @@ def _add_limine_bootloader(
1262
1264
raise DiskError (f'Failed to install Limine in { self .target } { efi_partition .mountpoint } : { err } ' )
1263
1265
1264
1266
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 /'
1267
1269
)
1270
+
1271
+ # Create EFI boot menu entry for Limine.
1272
+ parent_dev_path = device_handler .get_parent_device_path (efi_partition .safe_dev_path )
1273
+
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
+ loader_path = None
1281
+ if efi_bitness == '64' :
1282
+ loader_path = '/EFI/limine/BOOTX64.EFI'
1283
+ elif efi_bitness == '32' :
1284
+ loader_path = '/EFI/limine/BOOTIA32.EFI'
1285
+ else :
1286
+ error ('EFI bitness is neither 32 nor 64 bits' )
1287
+
1288
+ try :
1289
+ SysCommand (
1290
+ 'efibootmgr'
1291
+ ' --create'
1292
+ f' --disk { parent_dev_path } '
1293
+ f' --part { efi_partition .partn } '
1294
+ ' --label "Arch Linux Limine Bootloader"'
1295
+ f' --loader { loader_path } '
1296
+ ' --verbose'
1297
+ )
1298
+ except Exception as err :
1299
+ error (f'SysCommand for efibootmgr failed: { err } ' )
1268
1300
else :
1269
1301
parent_dev_path = device_handler .get_parent_device_path (boot_partition .safe_dev_path )
1270
1302
0 commit comments