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.
This commit is contained in:
Daan De Meyer
2026-05-21 18:06:07 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent df506aa9ef
commit ecaac1c0a2
4 changed files with 18 additions and 4 deletions
-1
View File
@@ -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
@@ -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/
@@ -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,
+3 -3
View File
@@ -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