]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Don't fix up vmlinuz locations if not required
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 15 Oct 2025 13:03:50 +0000 (15:03 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 15 Oct 2025 19:11:17 +0000 (21:11 +0200)
If we already have a kernel image for every directory in
/usr/lib/modules then there's no need to do anything.

Fixes #3949

mkosi/__init__.py

index 6ce57028ee8cdf36d0215e35d526b15c5b580821..3fd1d4f9588c23cff598020c45f7251afa9c2868 100644 (file)
@@ -1309,6 +1309,17 @@ def kernel_get_ver_from_modules(context: Context) -> Optional[str]:
 
 
 def fixup_vmlinuz_location(context: Context) -> None:
+    modulesd = Path("usr/lib/modules")
+
+    if not (context.root / modulesd).exists():
+        return
+
+    # Don't touch anything if all the modules directories contain a kernel image already.
+    if all(
+        (d / "vmlinuz").is_file() or (d / "vmlinux").is_file() for d in (context.root / modulesd).iterdir()
+    ):
+        return
+
     # Some architectures ship an uncompressed vmlinux (ppc64el, riscv64)
     for type in ("vmlinuz", "vmlinux"):
         for d in context.root.glob(f"boot/{type}-*"):