From: Daan De Meyer Date: Thu, 21 May 2026 10:25:03 +0000 (+0000) Subject: TEST-08-INITRD: Set up exitrd on boot rather than including in image X-Git-Tag: v261-rc1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecaac1c0a2fa9961c5acee024419f0740f44e95b;p=thirdparty%2Fsystemd.git TEST-08-INITRD: Set up exitrd on boot rather than including in image Just copy the initramfs from the VM rather than doing it during the image build. --- diff --git a/mkosi/mkosi.conf b/mkosi/mkosi.conf index a6966de2058..d539b65e00d 100644 --- a/mkosi/mkosi.conf +++ b/mkosi/mkosi.conf @@ -55,7 +55,6 @@ 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/initrd:/exitrd KernelInitrdModules=default diff --git a/mkosi/mkosi.initrd.conf/mkosi.extra/usr/lib/systemd/system/initrd-run-initramfs.service b/mkosi/mkosi.initrd.conf/mkosi.extra/usr/lib/systemd/system/initrd-run-initramfs.service new file mode 100644 index 00000000000..b95397fa236 --- /dev/null +++ b/mkosi/mkosi.initrd.conf/mkosi.extra/usr/lib/systemd/system/initrd-run-initramfs.service @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Unit] +Description=Copy initrd contents to /run/initramfs to serve as exitrd +DefaultDependencies=no +AssertPathExists=/etc/initrd-release +After=initrd.target +Before=initrd-cleanup.service initrd-switch-root.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=mkdir -p /run/initramfs +ExecStart=cp -a --one-file-system /. /run/initramfs/ diff --git a/test/integration-tests/TEST-08-INITRD/meson.build b/test/integration-tests/TEST-08-INITRD/meson.build index 5425096a563..db4a2c6da2d 100644 --- a/test/integration-tests/TEST-08-INITRD/meson.build +++ b/test/integration-tests/TEST-08-INITRD/meson.build @@ -5,6 +5,7 @@ integration_tests += [ 'name' : fs.name(meson.current_source_dir()), 'cmdline' : integration_test_template['cmdline'] + [ 'rd.systemd.wants=initrd-run-mount.service', + 'rd.systemd.wants=initrd-run-initramfs.service', ], 'exit-code' : 124, 'vm' : true, diff --git a/test/units/TEST-08-INITRD.sh b/test/units/TEST-08-INITRD.sh index b59a5b99ffe..7aa2a7e60d3 100755 --- a/test/units/TEST-08-INITRD.sh +++ b/test/units/TEST-08-INITRD.sh @@ -22,8 +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. -mkdir -p /run/initramfs -unzstd --stdout /exitrd | cpio --extract --make-directories --directory /run/initramfs/ +# The initrd-run-initramfs.service in the initrd should have populated /run/initramfs +# from the initrd's own contents before switch-root. +test -x /run/initramfs/shutdown touch /testok