mkosi: Build a directory image by default
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 7 Dec 2023 18:52:41 +0000 (19:52 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 12 Jan 2024 15:19:48 +0000 (16:19 +0100)
Both building and booting a directory image is much faster than
building or booting a disk image so let's default to a directory
image.

In CI, we stick to a disk image to make sure that keeps working as
well.

The only extra dependency this introduces is virtiofsd which is
packaged in all distributions except Debian stable. For users
hacking on systemd on Debian stable, a disk image can be built by
writing the following to mkosi.local.conf:

```
[Output]
Format=disk
```

.github/workflows/mkosi.yml
docs/HACKING.md
mkosi.conf
mkosi.images/system/mkosi.conf

index f6eddebffb55511e5e624de8d4173dc780940452..dce515800cbf9d8891193e1a7c02ab69c339eeea 100644 (file)
@@ -85,6 +85,10 @@ jobs:
         Distribution=${{ matrix.distro }}
         Release=${{ matrix.release }}
 
+        [Output]
+        # Build a disk image in CI as this logic is much more prone to breakage.
+        Format=disk
+
         [Content]
         Environment=CI_BUILD=1
                     SLOW_TESTS=true
index feec6b4537ee045b910aad26283fdefd8c8ef331..bd792092f798051022c2b7e7575a65b521ecf72d 100644 (file)
@@ -56,6 +56,23 @@ $ mkosi qemu
 Every time you rerun the `mkosi` command a fresh image is built, incorporating
 all current changes you made to the project tree.
 
+By default a directory image is built. This requires `virtiofsd` to be installed
+on the host. To build a disk image instead which does not require `virtiofsd`,
+add the following to `mkosi.local.conf`:
+
+```conf
+[Output]
+Format=disk
+```
+
+To boot in UEFI mode instead of using QEMU's direct kernel boot, add the following
+to `mkosi.local.conf`:
+
+```conf
+[Host]
+QemuFirmware=uefi
+```
+
 Putting this all together, here's a series of commands for preparing a patch
 for systemd:
 
index b02c24cdd90af5bd01b538925af4bc6f34a5717b..9ec4faf1225bfdc575e20f48389fa57364e7d17a 100644 (file)
@@ -18,6 +18,7 @@ Environment=ASAN_OPTIONS=verify_asan_link_order=false
 @Incremental=yes
 @QemuMem=2G
 @RuntimeSize=8G
+ToolsTreePackages=virtiofsd
 KernelCommandLineExtra=systemd.crash_shell
                        systemd.log_level=debug
                        systemd.log_ratelimit_kmsg=0
index 6948f8eb7ce8eb65b6a1f4e2220b0997b26ae4db..9646bbefde048fa46fae109f0990e455028b5b1c 100644 (file)
@@ -3,6 +3,9 @@
 [Config]
 Dependencies=base
 
+[Output]
+@Format=directory
+
 [Content]
 Autologin=yes
 BaseTrees=../../mkosi.output/base