Add EFISTUB bootloader support
This commit is contained in:
parent
ca52c796a5
commit
34cd2c18d3
|
|
@ -623,6 +623,51 @@ class Installer:
|
|||
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc --recheck {boot_partition.path}')
|
||||
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-mkconfig -o /boot/grub/grub.cfg')
|
||||
self.helper_flags['bootloader'] = True
|
||||
|
||||
elif bootloader == 'efistub':
|
||||
self.pacstrap('efibootmgr')
|
||||
|
||||
if not has_uefi():
|
||||
raise HardwareIncompatibilityError
|
||||
# TODO: Ideally we would want to check if another config
|
||||
# points towards the same disk and/or partition.
|
||||
# And in which case we should do some clean up.
|
||||
|
||||
for kernel in self.kernels:
|
||||
# Setup the firmware entry
|
||||
|
||||
label = f'Arch Linux ({kernel})'
|
||||
loader = f"/vmlinuz-{kernel}"
|
||||
|
||||
kernel_parameters = []
|
||||
|
||||
if not is_vm():
|
||||
vendor = cpu_vendor()
|
||||
if vendor == "AuthenticAMD":
|
||||
kernel_parameters.append("initrd=\\amd-ucode.img")
|
||||
elif vendor == "GenuineIntel":
|
||||
kernel_parameters.append("initrd=\\intel-ucode.img")
|
||||
else:
|
||||
self.log("unknow cpu vendor, not adding ucode to systemd-boot config")
|
||||
|
||||
kernel_parameters.append(f"initrd=\\initramfs-{kernel}.img")
|
||||
|
||||
# blkid doesn't trigger on loopback devices really well,
|
||||
# so we'll use the old manual method until we get that sorted out.
|
||||
if real_device := self.detect_encryption(root_partition):
|
||||
# TODO: We need to detect if the encrypted device is a whole disk encryption,
|
||||
# or simply a partition encryption. Right now we assume it's a partition (and we always have)
|
||||
log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=logging.DEBUG)
|
||||
kernel_parameters.append(f'cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}')
|
||||
else:
|
||||
log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{root_partition.uuid}'.", level=logging.DEBUG)
|
||||
kernel_parameters.append(f'root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}')
|
||||
|
||||
boot_partition = find_partition_by_mountpoint(self.partitions, relative_mountpoint=f"/boot")
|
||||
|
||||
SysCommand(f'efibootmgr --disk {boot_partition[:-1]} --part {boot_partition[-1]} --create --label "{label}" --loader {loader} --unicode \'{" ".join(kernel_parameters)}\' --verbose')
|
||||
|
||||
self.helper_flags['bootloader'] = bootloader
|
||||
else:
|
||||
raise RequirementError(f"Unknown (or not yet implemented) bootloader requested: {bootloader}")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue