@@ -268,10 +268,13 @@ alpine-3.18-arm64-rootfs-export:
extends: .test-jobs-artifact-common
image: registry.gitlab.com/xen-project/xen/tests-artifacts/alpine:3.18-arm64v8
script:
- - mkdir binaries && cp /initrd.tar.gz binaries/initrd.tar.gz
+ - mkdir binaries
+ - cp /initrd.tar.gz binaries/initrd.tar.gz
+ - cp /initrd.cpio.gz binaries/initrd.cpio.gz
artifacts:
paths:
- binaries/initrd.tar.gz
+ - binaries/initrd.cpio.gz
tags:
- arm64
@@ -25,20 +25,19 @@ mount -t devtmpfs devtmpfs /dev
chmod +x initrd/init
# DomU rootfs
cd initrd
-find . | cpio --create --format='newc' | gzip > ../initrd.cpio.gz
+find . | cpio --create --format='newc' | gzip > ../initrd-domU.cpio.gz
cd ..
# initrd.tar.gz is Dom0 rootfs
mkdir -p rootfs
cd rootfs
-tar xvzf ../initrd.tar.gz
mkdir proc
mkdir run
mkdir srv
mkdir sys
-rm var/run
cp -ar ../dist/install/* .
-mv ../initrd.cpio.gz ./root
+mkdir -p root etc/local.d
+mv ../initrd-domU.cpio.gz ./root/initrd.cpio.gz
cp ../bzImage ./root
echo "name=\"test\"
memory=512
@@ -60,9 +59,9 @@ xl -vvv create -c /root/test.cfg
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
# rebuild Dom0 rootfs
-find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz
+cp ../initrd.cpio.gz ../xen-rootfs.cpio.gz
+find . |cpio -H newc -o|gzip >> ../xen-rootfs.cpio.gz
cd ../..
cat >> binaries/pxelinux.0 << EOF
@@ -24,19 +24,18 @@ mount -t devtmpfs devtmpfs /dev
/bin/sh" > initrd/init
chmod +x initrd/init
cd initrd
-find . | cpio --create --format='newc' | gzip > ../initrd.cpio.gz
+find . | cpio --create --format='newc' | gzip > ../initrd-domU.cpio.gz
cd ..
mkdir -p rootfs
cd rootfs
-tar xvzf ../initrd.tar.gz
mkdir proc
mkdir run
mkdir srv
mkdir sys
-rm var/run
cp -ar ../dist/install/* .
-mv ../initrd.cpio.gz ./root
+mkdir -p etc/local.d root
+mv ../initrd-domU.cpio.gz ./root/initrd.cpio.gz
cp ../Image ./root
echo "name=\"test\"
memory=512
@@ -56,8 +55,8 @@ xl -vvv create -c /root/test.cfg
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz
+cp ../initrd.cpio.gz ../xen-rootfs.cpio.gz
+find . |cpio -H newc -o|gzip >> ../xen-rootfs.cpio.gz
cd ../..
# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
@@ -117,13 +117,12 @@ cd ..
# DOM0 rootfs
mkdir -p rootfs
cd rootfs
-tar xzf ../binaries/initrd.tar.gz
mkdir proc
mkdir run
mkdir srv
mkdir sys
-rm var/run
cp -ar ../binaries/dist/install/* .
+mkdir -p etc/local.d
echo "#!/bin/bash
@@ -142,8 +141,8 @@ xl network-attach 1 type=vif
${dom0_check}
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cp ../binaries/initrd.cpio.gz ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
cd ..
# ImageBuilder
@@ -167,13 +167,10 @@ if [ -n "$domU_check" ]; then
# DomU
mkdir -p rootfs
cd rootfs
- # fakeroot is needed to preserve device nodes in rootless podman container
- fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
mkdir proc
mkdir run
- mkdir srv
mkdir sys
- rm var/run
+ mkdir -p etc/local.d
echo "#!/bin/sh
echo 8 > /proc/sys/kernel/printk
@@ -181,23 +178,23 @@ echo 8 > /proc/sys/kernel/printk
${domU_check}
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
- echo "rc_verbose=yes" >> etc/rc.conf
- sed -i -e 's/^Welcome/domU \0/' etc/issue
- find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+ echo "domU Welcome to Alpine Linux 3.18
+Kernel \r on an \m (\l)
+
+" > etc/issue
+ find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs-overlay.cpio.gz
cd ..
rm -rf rootfs
fi
-# DOM0 rootfs
+# DOM0 rootfs - this will be an overlay over alpine's initrd
mkdir -p rootfs
cd rootfs
-fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
mkdir boot
mkdir proc
mkdir run
-mkdir srv
mkdir sys
-rm var/run
+mkdir -p etc/local.d
cp -ar ../binaries/dist/install/* .
cp -ar ../binaries/tests .
cp -a ../automation/scripts/run-tools-tests tests/
@@ -221,6 +218,8 @@ fi
if [ -n "$domU_check" ]; then
echo "
+# append test-specific files to domU initrd
+cat /boot/initrd-domU-overlay >> boot/initrd-domU
# get domU console content into test log
tail -F /var/log/xen/console/guest-domU.log 2>/dev/null | sed -e \"s/^/(domU) /\" &
tail -F /var/log/xen/qemu-dm-domU.log 2>/dev/null | sed -e \"s/^/(qemu-dm) /\" &
@@ -234,18 +233,18 @@ fi
chmod +x etc/local.d/xen.start
echo "$domU_config" > etc/xen/domU.cfg
-echo "rc_verbose=yes" >> etc/rc.conf
echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
mkdir -p var/log/xen/console
cp ../binaries/bzImage boot/vmlinuz
if [ -n "$domU_check" ]; then
- cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+ cp ../binaries/domU-rootfs-overlay.cpio.gz boot/initrd-domU-overlay
fi
-find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+# take base initrd and append test-specific files
+cp ../binaries/initrd.cpio.gz ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
cd ..
-
TFTP=/scratch/gitlab-runner/tftp
CONTROLLER=control@thor.testnet
@@ -80,6 +80,7 @@ argo-exec -l -p 28333 -- /bin/echo
"
copy_dom0_files ()
{
+ mkdir -p root usr/local/lib
cp "${WORKDIR}/binaries/xen-argo.ko" "root/"
cp -ar "${WORKDIR}/binaries/lib/"* "usr/local/lib/"
cp "${WORKDIR}/binaries/argo-exec" "usr/local/bin/"
@@ -92,9 +93,8 @@ fi
# Set up domU rootfs.
mkdir -p rootfs
cd rootfs
-tar xzf ../binaries/initrd.tar.gz
mkdir proc run srv sys
-rm var/run
+mkdir -p etc/local.d
echo "#!/bin/sh
set -x
export LD_LIBRARY_PATH=/usr/local/lib
@@ -102,36 +102,39 @@ PATH=/usr/local/bin:/usr/local/sbin:\$PATH
${DOMU_CMD}
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-sed -i -e 's/^Welcome/domU \0/' etc/issue
+echo "domU Welcome to Alpine Linux 3.18
+Kernel \r on an \m (\l)
+
+" > etc/issue
copy_domU_files
-find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs-overlay.cpio.gz
cd ..
rm -rf rootfs
# Set up dom0 rootfs.
mkdir -p rootfs
cd rootfs
-tar xzf ../binaries/initrd.tar.gz
mkdir boot proc run srv sys
-rm var/run
cp -ar ../binaries/dist/install/* .
+mkdir -p etc/local.d
echo "#!/bin/bash
set -x
export LD_LIBRARY_PATH=/usr/local/lib
bash /etc/init.d/xencommons start
+# append test-specific files to domU initrd
+cat /boot/initrd-domU-overlay >> boot/initrd-domU
${DOM0_CMD}
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
echo "${DOMU_CFG}${DOMU_CFG_EXTRA}" > etc/xen/domU.cfg
-echo "rc_verbose=yes" >> etc/rc.conf
echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
mkdir -p var/log/xen/console
cp ../binaries/bzImage boot/vmlinuz
-cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+cp ../binaries/domU-rootfs-overlay.cpio.gz boot/initrd-domU-overlay
copy_dom0_files
-find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cp ../binaries/initrd.cpio.gz ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
cd ..
# Load software into TFTP server directory.
@@ -41,33 +41,31 @@ fi
# DomU
mkdir -p rootfs
cd rootfs
-tar xzf ../binaries/initrd.tar.gz
mkdir proc
mkdir run
mkdir srv
mkdir sys
-rm var/run
+mkdir -p etc/local.d
echo "#!/bin/sh
${domU_check}
/bin/sh" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+cp ../binaries/initrd.cpio.gz ../binaries/domU-rootfs.cpio.gz
+find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
cd ..
rm -rf rootfs
# DOM0 rootfs
mkdir -p rootfs
cd rootfs
-tar xzf ../binaries/initrd.tar.gz
mkdir proc
mkdir run
mkdir srv
mkdir sys
-rm var/run
cp -ar ../binaries/dist/install/* .
+mkdir -p etc/local.d
echo "#!/bin/bash
export LD_LIBRARY_PATH=/usr/local/lib
@@ -78,8 +76,8 @@ bash /etc/init.d/xencommons start
${dom0_check}
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cp ../binaries/initrd.cpio.gz ../binaries/dom0-rootfs.cpio.gz
+find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
cd ..
@@ -60,7 +60,10 @@ RUN \
echo "ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100" >> /etc/inittab && \
echo "hvc0::respawn:/sbin/getty -L hvc0 115200 vt100" >> /etc/inittab && \
passwd -d "root" root && \
+ echo "rc_verbose=yes" >> /etc/rc.conf && \
\
# Create rootfs
cd / && \
- tar cvzf /initrd.tar.gz bin dev etc home init lib mnt opt root sbin usr var
+ tar cvzf /initrd.tar.gz bin dev etc home init lib mnt opt root sbin usr var && \
+ find bin dev etc home init lib mnt opt root sbin usr var |\
+ cpio -o -H newc | gzip > /initrd.cpio.gz
@@ -61,6 +61,7 @@ RUN \
echo "hvc0::respawn:/sbin/getty -L hvc0 115200 vt100" >> /etc/inittab && \
echo > /etc/modules && \
passwd -d "root" root && \
+ echo "rc_verbose=yes" >> /etc/rc.conf && \
\
# Create rootfs
cd / && \
The prerequisite for this is building initrd.cpio.gz, not only initrd.tar.gz. That's a change in the test-artifacts repository. Having that, do not repack the whole initrd, but only pack modified files and rely on Linux handling of concatenated archives. This allows packing just test-related files (which includes the whole toolstack), instead of the whole initrd. DomU initrd handling is a bit more complicated thing. It's sent to the target host as part of the dom0 initrd. But to modify/extend it, the "overlay" need to be applied already on the target system (otherwise controller host would need to repack it anyway). So, make the initrd.cpio.gz in test-artifacts include boot/initrd-domU already, and add test-specific files as boot/initrd-domU-overlay that is concatenated by dom0 boot script. Since full initrd is not unpacked now when preparing domU (and dom0) rootfs, a couple of minor changes are needed to how they are prepared. This includes creating whole etc/issue file, instead of modifying existing one, and a need to create a couple directories. And since there is now initrd.cpio.gz artifact, rename temporary domU initrd to initrd-domU.cpio.gz Finally, move adding "rc_verbose=yes" to /etc/rc.conf to initrd building. Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> --- New in v2 In fact, alpine/3.18.dockerfile in this repository is not what is used to build initrd.cpio.gz for test here, but add it anyway in case there are some other tests using it that I missed. If it's really unused, it probably should be removed, but that's a separate patch. Jobs xilinx-* are untested, as I don't have necessary access. --- automation/gitlab-ci/build.yaml | 5 +- automation/scripts/qemu-alpine-x86_64.sh | 11 +-- automation/scripts/qemu-smoke-dom0-arm64.sh | 11 +-- automation/scripts/qemu-smoke-dom0less-arm64.sh | 7 +-- automation/scripts/qubes-x86-64.sh | 29 +++----- automation/scripts/xilinx-smoke-dom0-x86_64.sh | 23 +++--- automation/scripts/xilinx-smoke-dom0less-arm64.sh | 14 +--- automation/tests-artifacts/alpine/3.18-arm64v8.dockerfile | 5 +- automation/tests-artifacts/alpine/3.18.dockerfile | 1 +- 9 files changed, 55 insertions(+), 51 deletions(-)