]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Allow adding kernel modules in extension images
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 19 Jan 2025 19:34:31 +0000 (20:34 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 19 Jan 2025 20:11:30 +0000 (20:11 +0000)
When building standalone extension images (without Overlay=yes),
let's process kernel modules but not run depmod. depmod produces a
single monolithic file which means we can't extend it from an
extension image without overriding the base file.

mkosi/__init__.py

index df2f229c19fa25a541141a42a62965fec14d96f5..3a7c03999d07f62576c5ea88d58093ed71623e93 100644 (file)
@@ -2778,7 +2778,23 @@ def configure_clock(context: Context) -> None:
 
 
 def run_depmod(context: Context, *, cache: bool = False) -> None:
-    if context.config.overlay or context.config.output_format.is_extension_or_portable_image():
+    if context.config.overlay:
+        return
+
+    if not cache:
+        for kver, _ in gen_kernel_images(context):
+            process_kernel_modules(
+                context.root,
+                kver,
+                include=finalize_kernel_modules_include(
+                    context,
+                    include=context.config.kernel_modules_include,
+                    host=context.config.kernel_modules_include_host,
+                ),
+                exclude=context.config.kernel_modules_exclude,
+            )
+
+    if context.config.output_format.is_extension_or_portable_image():
         return
 
     outputs = (
@@ -2800,18 +2816,6 @@ def run_depmod(context: Context, *, cache: bool = False) -> None:
             if all(m.stat().st_mtime <= mtime for m in modulesd.rglob("*.ko*")):
                 continue
 
-        if not cache:
-            process_kernel_modules(
-                context.root,
-                kver,
-                include=finalize_kernel_modules_include(
-                    context,
-                    include=context.config.kernel_modules_include,
-                    host=context.config.kernel_modules_include_host,
-                ),
-                exclude=context.config.kernel_modules_exclude,
-            )
-
         with complete_step(f"Running depmod for {kver}"):
             run(["depmod", "--all", kver], sandbox=chroot_cmd(root=context.root))