From ec0828e62fdfc5d899ff4fc7a21f7900753e1301 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Wed, 25 Jan 2023 09:18:42 +0100 Subject: debvm-run: handle some multiarch kernels We completely treat all 32bit arm as armhf now. Booting the rpi kernel installed by debvm-create for armel will not work at all. The only sane way to boot armel is to enable a multiarch kernel. Refine the VMARCH guess from /bin/true using the file output for the kernel image for the common cases of i386+amd64 and armel/armhf+arm64. --- bin/debvm-run | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'bin/debvm-run') diff --git a/bin/debvm-run b/bin/debvm-run index 70ee556..10e19be 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -203,6 +203,19 @@ INITRDNAME=$(/sbin/debugfs "$IMAGE" -R "stat ${BOOTDIR}initrd.img" | sed 's/Fast test -n "$INITRDNAME" || die "failed to discover initrd image" test "${INITRDNAME#/}" = "$INITRDNAME" && INITRDNAME="$BOOTDIR$INITRDNAME" +# Refine our VMARCH guess from /bin/true using the kernel image to improve +# experience for multiarch kernels. +if command -v file >/dev/null 2>&1; then + case "$VMARCH:$(file -b "$KERNELTMP")" in + "armel:Linux kernel ARM64 boot executable Image"*) VMARCH=arm64 ;; + "armhf:Linux kernel ARM64 boot executable Image"*) VMARCH=arm64 ;; + # The boot stub looks the same on i386 and amd64, so we + # actually inspect the kernel version here, which happens to + # include amd64 for Debian kernels. + "i386:Linux kernel x86 boot executable bzImage, version "*"-amd64 "*) VMARCH=amd64 ;; + esac +fi + KERNEL_CMDLINE="root=LABEL=debvm rw" NETDEV="user,id=net0" @@ -228,22 +241,16 @@ case "$VMARCH" in QEMU=qemu-system-x86_64 MACHINE="type=q35" ;; - arm|armel) + arm|armel|armhf) CPU=max MACHINE="type=virt" MAX_SMP=8 - RNG_DEV= ;; arm64) QEMU=qemu-system-aarch64 CPU=max MACHINE="type=virt" ;; - armhf) - CPU=max - MACHINE="type=virt" - MAX_SMP=8 - ;; m68k) MACHINE="type=virt" MAX_SMP=1 -- cgit v1.2.3