summaryrefslogtreecommitdiff
path: root/bin/debvm-run
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2023-01-25 09:18:42 +0100
committerHelmut Grohne <helmut@subdivi.de>2023-01-25 09:27:40 +0100
commitec0828e62fdfc5d899ff4fc7a21f7900753e1301 (patch)
tree94397804688a6c9d8613702b8173d1ea07f838b0 /bin/debvm-run
parent999970b6e3e3ca3e19d9a9ef7dfd1443f9ced59e (diff)
downloaddebvm-ec0828e62fdfc5d899ff4fc7a21f7900753e1301.tar.gz
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.
Diffstat (limited to 'bin/debvm-run')
-rwxr-xr-xbin/debvm-run21
1 files changed, 14 insertions, 7 deletions
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