]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Don't build default initrd for directory images by default 4164/head
authorDaan De Meyer <daan@amutable.com>
Fri, 13 Feb 2026 16:05:40 +0000 (17:05 +0100)
committerDaan De Meyer <daan@amutable.com>
Fri, 13 Feb 2026 20:44:01 +0000 (21:44 +0100)
We switched this around a long time ago to accomodate virtiofsd qemu
boots as those needed an initrd without the image necessarily being
bootable. Given Fedora and Arch now allow for direct kernel boot with
virtiofsd without needing an initrd, let's switch back the default to
not building an initrd for directory images, so that the same config
can be used to build disk images for vm boot and directory images for
container boot without having to build the initrd when building directory
images.

mkosi/config.py
mkosi/resources/man/mkosi.1.md

index 94ed5a965faaae8882f9b6aa22920973fc66ccfa..a897b9a42df04bab4483642cda84ec09a52e6343 100644 (file)
@@ -1125,7 +1125,7 @@ def config_default_initrds(namespace: dict[str, Any]) -> list[Path]:
         return []
 
     if namespace["bootable"] == ConfigFeature.auto and (
-        namespace["output_format"] == OutputFormat.cpio
+        namespace["output_format"] in (OutputFormat.cpio, OutputFormat.directory)
         or namespace["output_format"].is_extension_or_portable_image()
         or namespace["overlay"]
     ):
@@ -5298,7 +5298,7 @@ def want_kernel(config: Config) -> bool:
         return False
 
     if config.bootable == ConfigFeature.auto and (
-        config.output_format == OutputFormat.cpio
+        config.output_format in (OutputFormat.cpio, OutputFormat.directory)
         or config.output_format.is_extension_or_portable_image()
         or config.overlay
     ):
index 86fe39aa3430d204b350d4f8179076096d069609..906b6abdba2941f285c64fcae4e8a24b6f50f7c5 100644 (file)
@@ -1124,10 +1124,11 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
 :   Use user-provided initrd(s). Takes a comma-separated list of paths to initrd
     files. This option may be used multiple times in which case the initrd lists
     are combined. If this setting is not specified and a bootable image is requested,
-    **mkosi** will automatically build a default initrd. To disable building the default
-    initrd, assign the empty string to this setting. To build the default initrd even when
-    specifying this setting, the special value `default` can be assigned alongside the other
-    values.
+    **mkosi** will automatically build a default initrd if the image looks like it might
+    be a bootable image based on a few factors (output format, is a kernel package installed, ...).
+    To disable building the default initrd, assign the empty string to this setting. To build the
+    default initrd even when specifying this setting, the special value `default` can be assigned
+    alongside the other values.
 
     When the default initrd is used, it can be further configured using the settings below and
     with `mkosi.initrd.conf` which can either be a file or directory containing extra configuration