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-18 09:22:55 -0400
committerGitHub <noreply@github.com>2023-09-18 23:22:55 +1000
commit6ec2bd4b557867ac12580797b7f15b5e52682c22 (patch)
tree12b8e90a61ec7b2b3e6365821dcf42d6efda7d31 /archinstall
parent12b7017240a040fd4fbebf7c5794a1ca5560f0ea (diff)
Add `_get_kernel_params()` (#2064)
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/installer.py91
1 files changed, 40 insertions, 51 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 34c9441f..2eb63279 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -715,6 +715,44 @@ class Installer:
return root
return None
+ def _get_kernel_params(self, root_partition: disk.PartitionModification) -> List[str]:
+ kernel_parameters = []
+
+ 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('Root partition is an encrypted device, identifying by PARTUUID: {root_partition.partuuid}')
+
+ if self._disk_encryption and self._disk_encryption.hsm_device:
+ # Note: lsblk UUID must be used, not PARTUUID for sd-encrypt to work
+ kernel_parameters.append(f'rd.luks.name={root_partition.uuid}=luksdev')
+ # Note: tpm2-device and fido2-device don't play along very well:
+ # https://github.com/archlinux/archinstall/pull/1196#issuecomment-1129715645
+ kernel_parameters.append('rd.luks.options=fido2-device=auto,password-echo=no')
+ else:
+ kernel_parameters.append(f'cryptdevice=PARTUUID={root_partition.partuuid}:luksdev')
+
+ kernel_parameters.append('root=/dev/mapper/luksdev')
+ else:
+ debug(f'Identifying root partition by PARTUUID: {root_partition.partuuid}')
+ kernel_parameters.append(f'root=PARTUUID={root_partition.partuuid}')
+
+ # Zswap should be disabled when using zram.
+ # https://github.com/archlinux/archinstall/issues/881
+ if self._zram_enabled:
+ kernel_parameters.append('zswap.enabled=0')
+
+ for sub_vol in root_partition.btrfs_subvols:
+ if sub_vol.is_root():
+ kernel_parameters.append(f'rootflags=subvol={sub_vol.name}')
+ break
+
+ kernel_parameters.append('rw')
+ kernel_parameters.append(f'rootfstype={root_partition.safe_fs_type.fs_type_mount}')
+ kernel_parameters.extend(self._kernel_params)
+
+ return kernel_parameters
+
def _add_systemd_bootloader(
self,
boot_partition: disk.PartitionModification,
@@ -798,42 +836,7 @@ class Installer:
"Archinstall won't add any ucode to systemd-boot config.",
)
- options_entry = []
-
- 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('Root partition is an encrypted device, identifying by PARTUUID: {root_partition.partuuid}')
-
- if self._disk_encryption and self._disk_encryption.hsm_device:
- # Note: lsblk UUID must be used, not PARTUUID for sd-encrypt to work
- options_entry.append(f'rd.luks.name={root_partition.uuid}=luksdev')
- # Note: tpm2-device and fido2-device don't play along very well:
- # https://github.com/archlinux/archinstall/pull/1196#issuecomment-1129715645
- options_entry.append('rd.luks.options=fido2-device=auto,password-echo=no')
- else:
- options_entry.append(f'cryptdevice=PARTUUID={root_partition.partuuid}:luksdev')
-
- options_entry.append('root=/dev/mapper/luksdev')
- else:
- debug(f'Identifying root partition by PARTUUID: {root_partition.partuuid}')
- options_entry.append(f'root=PARTUUID={root_partition.partuuid}')
-
- # Zswap should be disabled when using zram.
- # https://github.com/archlinux/archinstall/issues/881
- if self._zram_enabled:
- options_entry.append('zswap.enabled=0')
-
- for sub_vol in root_partition.btrfs_subvols:
- if sub_vol.is_root():
- options_entry.append(f'rootflags=subvol={sub_vol.name}')
- break
-
- options_entry.append('rw')
- options_entry.append(f'rootfstype={root_partition.safe_fs_type.fs_type_mount}')
- options_entry.extend(self._kernel_params)
-
- options = 'options ' + ' '.join(options_entry) + '\n'
+ options = 'options ' + ' '.join(self._get_kernel_params(root_partition)) + '\n'
for kernel in self.kernels:
for variant in ("", "-fallback"):
@@ -1058,21 +1061,7 @@ TIMEOUT=5
else:
debug(f"Unknown CPU vendor '{vendor}' detected. Archinstall won't add any ucode to firmware boot entry.")
- kernel_parameters = []
-
- 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')
- kernel_parameters.append('root=/dev/mapper/luksdev')
- else:
- debug(f'Identifying root partition by PARTUUID: {root_partition.partuuid}')
- kernel_parameters.append(f'root=PARTUUID={root_partition.partuuid}')
-
- kernel_parameters.append('rw')
- kernel_parameters.append(f'rootfstype={root_partition.safe_fs_type.value}')
- kernel_parameters.extend(self._kernel_params)
+ kernel_parameters = self._get_kernel_params(root_partition)
parent_dev_path = disk.device_handler.get_parent_device_path(boot_partition.safe_dev_path)