From 34cd2c18d378cd0c37499852ac67b8d35bf5b92b Mon Sep 17 00:00:00 2001 From: Ettore Forigo Date: Sun, 14 Nov 2021 15:19:54 +0100 Subject: Add EFISTUB bootloader support --- archinstall/lib/installer.py | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) 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}") -- cgit v1.2.3-54-g00ecf From 44109b851ab5d09e6d94911a25b60f2cc02a5674 Mon Sep 17 00:00:00 2001 From: Ettore Forigo Date: Mon, 15 Nov 2021 01:58:06 +0100 Subject: Fix boot partition detection for EFISTUB bootloader --- archinstall/lib/installer.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index fcf065eb..b7c5cf92 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -663,9 +663,7 @@ class Installer: 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') + 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: -- cgit v1.2.3-54-g00ecf From 436cabb8d057d88f97fc7f51ba1d5abd4a6b7fd7 Mon Sep 17 00:00:00 2001 From: Ettore Forigo Date: Tue, 16 Nov 2021 02:13:34 +0100 Subject: Fix unknown-ucode message for EFISTUB bootloader --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index b7c5cf92..3cfe0ab7 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -648,7 +648,7 @@ class Installer: elif vendor == "GenuineIntel": kernel_parameters.append("initrd=\\intel-ucode.img") else: - self.log("unknow cpu vendor, not adding ucode to systemd-boot config") + self.log("unknow cpu vendor, not adding ucode to firmware boot entry") kernel_parameters.append(f"initrd=\\initramfs-{kernel}.img") -- cgit v1.2.3-54-g00ecf