@@ -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
@@ -1244,7 +1244,11 @@ def _add_limine_bootloader(
1244
1244
limine_path = self .target / 'usr' / 'share' / 'limine'
1245
1245
hook_command = None
1246
1246
1247
+ parent_dev_path = device_handler .get_parent_device_path (boot_partition .safe_dev_path )
1248
+
1247
1249
if SysInfo .has_uefi ():
1250
+ self .pacman .strap ('efibootmgr' )
1251
+
1248
1252
if not efi_partition :
1249
1253
raise ValueError ('Could not detect efi partition' )
1250
1254
elif not efi_partition .mountpoint :
@@ -1253,7 +1257,7 @@ def _add_limine_bootloader(
1253
1257
info (f"Limine EFI partition: { efi_partition .dev_path } " )
1254
1258
1255
1259
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 '
1257
1261
efi_dir_path .mkdir (parents = True , exist_ok = True )
1258
1262
1259
1263
for file in ('BOOTIA32.EFI' , 'BOOTX64.EFI' ):
@@ -1262,12 +1266,38 @@ def _add_limine_bootloader(
1262
1266
raise DiskError (f'Failed to install Limine in { self .target } { efi_partition .mountpoint } : { err } ' )
1263
1267
1264
1268
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 /'
1267
1271
)
1268
- else :
1269
- parent_dev_path = device_handler .get_parent_device_path (boot_partition .safe_dev_path )
1270
1272
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
+ 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 } ' )
1300
+ else :
1271
1301
if unique_path := device_handler .get_unique_path_for_device (parent_dev_path ):
1272
1302
parent_dev_path = unique_path
1273
1303
0 commit comments