vmtest: allow building foreign debian rootfs

This would allow building s390x images without access to an IBM Z.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
This commit is contained in:
Ilya Leoshkevich
2022-05-09 12:59:54 +02:00
committed by Andrii Nakryiko
parent 14777c3784
commit 87dff0a2c7

View File

@@ -2,6 +2,11 @@
# This script builds a Debian root filesystem image for testing libbpf in a
# virtual machine. Requires debootstrap >= 1.0.95 and zstd.
# Use e.g. ./mkrootfs_debian.sh --arch=s390x to generate a rootfs for a
# foreign architecture. Requires configured binfmt_misc, e.g. using
# Debian/Ubuntu's qemu-user-binfmt package or
# https://github.com/multiarch/qemu-user-static.
set -e -u -x -o pipefail
# Check whether we are root now in order to avoid confusing errors later.
@@ -16,7 +21,7 @@ trap 'rm -r "$root"' EXIT
# Install packages.
packages=binutils,busybox,elfutils,ethtool,iproute2,libcap2,libelf1,strace,zlib1g
debootstrap --include="$packages" --variant=minbase bookworm "$root"
debootstrap --include="$packages" --variant=minbase "$@" bookworm "$root"
# Remove the init scripts (tests use their own). Also remove various
# unnecessary files in order to save space.