Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-11-17 15:38:32 +0000
committerGitHub <noreply@github.com>2021-11-17 15:38:32 +0000
commit5cc88a74ab79b245e9fbe0c4964a052088a22aea (patch)
tree2d0c81be9effcbfa545240e977e7f5314158cf2d /archinstall/lib
parenta18a652bb0557c0dae7c5706893efd3a217c6598 (diff)
parent436cabb8d057d88f97fc7f51ba1d5abd4a6b7fd7 (diff)
Merge PR #716 - Support for efistub-bootloader (API only)
Add EFISTUB bootloader support through config/api calls using: ```json { "bootloader": "efistub", "kernels": [ "linux", "linux-lts" ] } ```
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/installer.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index c15a0cdb..7ac80047 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -625,6 +625,49 @@ 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 firmware boot entry")
+
+ 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)}')
+
+ SysCommand(f'efibootmgr --disk {boot_partition.path[:-1]} --part {boot_partition.path[-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}")