Make debvm-run useable for initramfs-tools test cases
The initramfs-tools autopkgtests construct a initramfs and a really tiny root file system. Then launch qemu with the installed kernel and check that the root file system was reached. Currently the autopkgtest are only run on amd64. I am working on making them work on more architectures. That is my current version of the run-qemu script:
if test "$#" -lt 3; then
echo "${0##*/}: Error: Not enough parameters." >&2
echo "Usage: ${0##*/} kernel initrd append [extra_args]" >&2
exit 1
fi
kernel="$1"
initrd="$2"
append="$3"
shift 3
ARCHITECTURE=$(dpkg --print-architecture)
case "$ARCHITECTURE" in
amd64)
qemu="qemu-system-x86_64"
;;
arm64)
qemu="qemu-system-aarch64"
machine="virt,gic-version=max"
cpu="max,pauth-impdef=on"
efi_code=/usr/share/AAVMF/AAVMF_CODE.fd
efi_vars=/usr/share/AAVMF/AAVMF_VARS.fd
;;
armhf)
qemu="qemu-system-arm"
machine="virt"
cpu=cortex-a7
efi_code=/usr/share/AAVMF/AAVMF32_CODE.fd
efi_vars=/usr/share/AAVMF/AAVMF32_VARS.fd
console=ttyAMA0
;;
ppc64el)
qemu="qemu-system-ppc64"
machine="pseries,cap-ccf-assist=off,cap-cfpc=broken,cap-ibs=broken,cap-sbbc=broken,usb=off"
console=hvc0
;;
*)
qemu="qemu-system-${ARCHITECTURE}"
esac
if test -f "${efi_vars-}"; then
efi_vars_copy="$(mktemp -t "${efi_vars##*/}.XXXXXXXXXX")"
cp "$efi_vars" "$efi_vars_copy"
fi
exec "$qemu" ${machine:+-machine "${machine}"} ${cpu:+-cpu "${cpu}"} -m 1G \
${efi_code:+-drive "file=${efi_code},if=pflash,format=raw,read-only=on"} \
${efi_vars:+-drive "file=${efi_vars_copy},if=pflash,format=raw"} \
-device virtio-rng-pci,rng=rng0 -object rng-random,filename=/dev/urandom,id=rng0 \
-nodefaults -no-reboot -kernel "${kernel}" -initrd "${initrd}" "$@" \
-append "console=${console:-ttyS0},115200 ro ${append}"
This script does 50% of what debvm-run does, but fiddling with the root device (initrd and kernel extraction) is not wanted here.
Do you want to cover this use case as well? If yes, it would probably be useful to carve out a low-level script that can be called by initramfs-tools autopkgtest directly.