Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEttore Forigo <ettore.forigo@gmail.com>2021-11-14 15:19:54 +0100
committerEttore Forigo <ettore.forigo@gmail.com>2021-11-14 15:19:54 +0100
commit34cd2c18d378cd0c37499852ac67b8d35bf5b92b (patch)
treed7372f02bb1e1c2ffba124d3fa1dd852635181aa
parentca52c796a55fd34cc1309f26bab86e15da722182 (diff)
Add EFISTUB bootloader support
-rw-r--r--archinstall/lib/installer.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 3b8f9612..fcf065eb 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -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}")