From: DaanDeMeyer Date: Sat, 23 Aug 2025 19:48:51 +0000 (+0200) Subject: Add kernel-modules-initrd to SplitArtifacts X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=804d7b91bf3d183a70cb3817bbc983bfa53d48b0;p=thirdparty%2Fmkosi.git Add kernel-modules-initrd to SplitArtifacts Useful when debugging the contents of the kernel modules initrd. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 2f67bdd4b..8f3852cef 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1590,6 +1590,9 @@ def build_kernel_modules_initrd(context: Context, kver: str) -> Path: maybe_compress(context, compression, kmods, kmods) + if ArtifactOutput.kernel_modules_initrd in context.config.split_artifacts: + shutil.copy(kmods, context.staging / context.config.output_split_kernel_modules_initrd) + return kmods diff --git a/mkosi/config.py b/mkosi/config.py index 8f14d78e2..938738932 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -620,6 +620,7 @@ class ArtifactOutput(StrEnum): pcrs = enum.auto() roothash = enum.auto() os_release = enum.auto() + kernel_modules_initrd = enum.auto() @staticmethod def compat_no() -> list["ArtifactOutput"]: @@ -2265,6 +2266,10 @@ class Config: def output_split_os_release(self) -> str: return f"{self.output}.osrelease" + @property + def output_split_kernel_modules_initrd(self) -> str: + return f"{self.output}.kernel-modules-initrd" + @property def output_nspawn_settings(self) -> str: return f"{self.output}.nspawn" @@ -2306,6 +2311,7 @@ class Config: self.output_split_pcrs, self.output_split_roothash, self.output_split_os_release, + self.output_split_kernel_modules_initrd, self.output_nspawn_settings, self.output_checksum, self.output_signature, diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index d1844ca43..6bbe83cb1 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -651,8 +651,8 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, `SplitArtifacts=`, `--split-artifacts=` : The artifact types to split out of the final image. A comma-delimited list consisting of `uki`, `kernel`, `initrd`, `os-release`, `prcs`, `partitions`, - `roothash` and `tar`. When building a bootable image `kernel` and `initrd` - correspond to their artifact found in the image (or in the UKI), + `roothash`, `kernel-modules-initrd` and `tar`. When building a bootable image `kernel` + and `initrd` correspond to their artifact found in the image (or in the UKI), while `uki` copies out the entire UKI. If `pcrs` is specified, a JSON file containing the pre-calculated TPM2 digests is written out, according to the [UKI specification](https://uapi-group.org/specifications/specs/unified_kernel_image/#json-format-for-pcrsig), @@ -673,6 +673,11 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, When `roothash` is specified and a dm-verity disk image is built, the dm-verity roothash is written out as a separate file, which is useful for offline signing. + `kernel-modules-initrd` corresponds to the separate kernel modules initrd which + mkosi appends to the main initrd. This is primarily intended for debugging as many + initrd inspection tools don't properly handle multiple initrds appended to each + other. + By default `uki`, `kernel` and `initrd` are split out. `RepartDirectories=`, `--repart-directory=`