Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-09-17 03:17:48 -0400
committerGitHub <noreply@github.com>2023-09-17 17:17:48 +1000
commit15e52b77683f266ee843def2bb35ed02cd8e559d (patch)
treeda1010a38ec213d138ae4cafe54dd75b55a089ba /archinstall
parentb9d962bec2466d096b38c5c4e519e79c0162a0eb (diff)
Refactor `_add_efistub_bootloader()` cmdline (#2059)
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/installer.py58
1 files changed, 32 insertions, 26 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index c32069c3..01c92d3b 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -1047,37 +1047,43 @@ TIMEOUT=5
# 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}"
+ microcode = []
+
+ if not SysInfo.is_vm():
+ vendor = SysInfo.cpu_vendor()
+ if vendor == "AuthenticAMD":
+ microcode.append("initrd=\\amd-ucode.img")
+ elif vendor == "GenuineIntel":
+ microcode.append("initrd=\\intel-ucode.img")
+ else:
+ debug(f"Unknown CPU vendor '{vendor}' detected. Archinstall won't add any ucode to firmware boot entry.")
- kernel_parameters = []
+ # blkid doesn't trigger on loopback devices really well,
+ # so we'll use the old manual method until we get that sorted out.
- if not SysInfo.is_vm():
- vendor = SysInfo.cpu_vendor()
- if vendor == "AuthenticAMD":
- kernel_parameters.append("initrd=\\amd-ucode.img")
- elif vendor == "GenuineIntel":
- kernel_parameters.append("initrd=\\intel-ucode.img")
- else:
- debug(f"Unknown CPU vendor '{vendor}' detected. Archinstall won't add any ucode to firmware boot entry.")
+ kernel_parameters = []
- kernel_parameters.append(f"initrd=\\initramfs-{kernel}.img")
+ if root_partition in self._disk_encryption.partitions:
+ # 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)
+ debug(f'Root partition is an encrypted device identifying by PARTUUID: {root_partition.partuuid}')
+ kernel_parameters.append(f'cryptdevice=PARTUUID={root_partition.partuuid}:luksdev root=/dev/mapper/luksdev rw rootfstype={root_partition.safe_fs_type.value} {" ".join(self._kernel_params)}')
+ else:
+ debug(f'Identifying root partition by PARTUUID: {root_partition.partuuid}')
+ kernel_parameters.append(f'root=PARTUUID={root_partition.partuuid} rw rootfstype={root_partition.safe_fs_type.value} {" ".join(self._kernel_params)}')
- # blkid doesn't trigger on loopback devices really well,
- # so we'll use the old manual method until we get that sorted out.
+ parent_dev_path = disk.device_handler.get_parent_device_path(boot_partition.safe_dev_path)
- if root_partition in self._disk_encryption.partitions:
- # 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)
- debug(f'Root partition is an encrypted device identifying by PARTUUID: {root_partition.partuuid}')
- kernel_parameters.append(f'cryptdevice=PARTUUID={root_partition.partuuid}:luksdev root=/dev/mapper/luksdev rw rootfstype={root_partition.safe_fs_type.value} {" ".join(self._kernel_params)}')
- else:
- debug(f'Identifying root partition by PARTUUID: {root_partition.partuuid}')
- kernel_parameters.append(f'root=PARTUUID={root_partition.partuuid} rw rootfstype={root_partition.safe_fs_type.value} {" ".join(self._kernel_params)}')
+ for kernel in self.kernels:
+ # Setup the firmware entry
+ label = f'Arch Linux ({kernel})'
+ loader = f"/vmlinuz-{kernel}"
- parent_dev_path = disk.device_handler.get_parent_device_path(boot_partition.safe_dev_path)
+ cmdline = []
+
+ cmdline.extend(microcode)
+ cmdline.append(f"initrd=\\initramfs-{kernel}.img")
+ cmdline.extend(kernel_parameters)
cmd = f'efibootmgr ' \
f'--disk {parent_dev_path} ' \
@@ -1085,7 +1091,7 @@ TIMEOUT=5
f'--create ' \
f'--label "{label}" ' \
f'--loader {loader} ' \
- f'--unicode \'{" ".join(kernel_parameters)}\' ' \
+ f'--unicode \'{" ".join(cmdline)}\' ' \
f'--verbose'
SysCommand(cmd)