From: Daan De Meyer Date: Fri, 19 Dec 2025 14:47:01 +0000 (+0100) Subject: mkosi: Use initrd as exitrd X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=738bad8f35488368cb5dc406168b7207a14a8c32;p=thirdparty%2Fsystemd.git mkosi: Use initrd as exitrd Let's speed up image builds by avoiding building an exitrd and instead reusing the initrd image for the same purpose. --- diff --git a/mkosi/mkosi.conf b/mkosi/mkosi.conf index 28577b348f1..1afc0de65c8 100644 --- a/mkosi/mkosi.conf +++ b/mkosi/mkosi.conf @@ -3,7 +3,6 @@ [Config] MinimumVersion=commit:9e31235211d975bae25622d6205a8396d104335e Dependencies= - exitrd initrd minimal-base minimal-0 @@ -57,7 +56,7 @@ ExtraTrees= %O/minimal-1.root-%a-verity.raw:/usr/share/minimal_1.verity %O/minimal-1.root-%a-verity-sig.raw:/usr/share/minimal_1.verity.sig %O/minimal-base:/usr/share/TEST-13-NSPAWN-container-template - %O/exitrd:/exitrd + %O/initrd:/exitrd Initrds=%O/initrd KernelInitrdModules=default @@ -94,6 +93,7 @@ Packages= bash-completion binutils coreutils + cpio curl diffutils dnsmasq diff --git a/mkosi/mkosi.images/exitrd/mkosi.conf b/mkosi/mkosi.images/exitrd/mkosi.conf deleted file mode 100644 index 4a811e15e2f..00000000000 --- a/mkosi/mkosi.images/exitrd/mkosi.conf +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -[Output] -Format=directory - -[Build] -Environment=SYSTEMD_REQUIRED_DEPS_ONLY=1 - -[Content] -Bootable=no -Locale=C.UTF-8 -WithDocs=no -CleanPackageMetadata=yes -MakeInitrd=yes - -Packages= - coreutils - bash - -[Include] -Include=%D/mkosi/mkosi.sanitizers diff --git a/mkosi/mkosi.images/exitrd/mkosi.conf.d/arch.conf b/mkosi/mkosi.images/exitrd/mkosi.conf.d/arch.conf deleted file mode 100644 index 9940b1ef58d..00000000000 --- a/mkosi/mkosi.images/exitrd/mkosi.conf.d/arch.conf +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -[Match] -Distribution=arch - -[Content] -PrepareScripts=%D/mkosi/mkosi.conf.d/arch/systemd.prepare -VolatilePackages= - systemd - systemd-libs - -RemoveFiles= - # Arch Linux doesn't split their gcc-libs package so we manually remove - # unneeded stuff here to make sure it doesn't end up in the image. - /usr/lib/libgfortran.so* - /usr/lib/libgo.so* - /usr/lib/libgomp.so* - /usr/lib/libgphobos.so* - /usr/lib/libobjc.so* - /usr/lib/libgdruntime.so* - - # Remove all files that are only required for development. - /usr/lib/*.a - /usr/include/* - - /usr/share/i18n/* - /usr/share/hwdata/* - /usr/share/iana-etc/* - /usr/share/locale/* - /usr/share/terminfo/* - /usr/share/zoneinfo/* diff --git a/mkosi/mkosi.images/exitrd/mkosi.conf.d/build.conf b/mkosi/mkosi.images/exitrd/mkosi.conf.d/build.conf deleted file mode 100644 index 8c16d9b9f87..00000000000 --- a/mkosi/mkosi.images/exitrd/mkosi.conf.d/build.conf +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -# Add a dependency on the build image unless NO_BUILD=1. - -[Match] -Environment=!NO_BUILD=1 - -[Config] -Dependencies=build diff --git a/mkosi/mkosi.images/exitrd/mkosi.conf.d/centos-fedora.conf b/mkosi/mkosi.images/exitrd/mkosi.conf.d/centos-fedora.conf deleted file mode 100644 index 67fc047103a..00000000000 --- a/mkosi/mkosi.images/exitrd/mkosi.conf.d/centos-fedora.conf +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -[Match] -Distribution=|centos -Distribution=|fedora - -[Content] -PrepareScripts=%D/mkosi/mkosi.conf.d/centos-fedora/systemd.prepare -VolatilePackages= - systemd-standalone-shutdown diff --git a/mkosi/mkosi.images/exitrd/mkosi.conf.d/debian.conf b/mkosi/mkosi.images/exitrd/mkosi.conf.d/debian.conf deleted file mode 100644 index bce949168d9..00000000000 --- a/mkosi/mkosi.images/exitrd/mkosi.conf.d/debian.conf +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -[Match] -Distribution=debian - -[Content] -PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare -VolatilePackages= - systemd-standalone-shutdown diff --git a/mkosi/mkosi.images/exitrd/mkosi.conf.d/opensuse.conf b/mkosi/mkosi.images/exitrd/mkosi.conf.d/opensuse.conf deleted file mode 100644 index 5afda7a87cd..00000000000 --- a/mkosi/mkosi.images/exitrd/mkosi.conf.d/opensuse.conf +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -[Match] -Distribution=opensuse - -[Content] -PrepareScripts=%D/mkosi/mkosi.conf.d/opensuse/systemd.prepare -Packages= - diffutils - grep - patterns-base-minimal_base - sed - xz - -VolatilePackages= - libsystemd0 - libudev1 - systemd diff --git a/mkosi/mkosi.images/exitrd/mkosi.conf.d/ubuntu.conf b/mkosi/mkosi.images/exitrd/mkosi.conf.d/ubuntu.conf deleted file mode 100644 index f1ef2eb19b6..00000000000 --- a/mkosi/mkosi.images/exitrd/mkosi.conf.d/ubuntu.conf +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -[Match] -Distribution=ubuntu - -[Content] -PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare -VolatilePackages= - libsystemd-shared - libsystemd0 - libudev1 - systemd diff --git a/mkosi/mkosi.images/exitrd/mkosi.extra/shutdown b/mkosi/mkosi.images/initrd/mkosi.extra/shutdown similarity index 100% rename from mkosi/mkosi.images/exitrd/mkosi.extra/shutdown rename to mkosi/mkosi.images/initrd/mkosi.extra/shutdown diff --git a/test/units/TEST-08-INITRD.sh b/test/units/TEST-08-INITRD.sh index 48045272f87..b59a5b99ffe 100755 --- a/test/units/TEST-08-INITRD.sh +++ b/test/units/TEST-08-INITRD.sh @@ -22,9 +22,8 @@ test -d /run/initrd-mount-target mountpoint /run/initrd-mount-target [[ -e /run/initrd-mount-target/hello-world ]] -# Copy the prepared exitrd to its intended location. Check the respective -# test.sh file for details +# Copy the prepared exitrd to its intended location. mkdir -p /run/initramfs -cp -r /exitrd/* /run/initramfs/ +unzstd --stdout /exitrd | cpio --extract --make-directories --directory /run/initramfs/ touch /testok