diff options
-rwxr-xr-x | bin/debvm-run | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index 1055467..0e9403f 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -214,17 +214,17 @@ test "${INITRDNAME#/}" = "$INITRDNAME" && INITRDNAME="$BOOTDIR$INITRDNAME" with_set_ex /sbin/debugfs "$IMAGE" -R "cat $KERNELNAME" > "$KERNELTMP" with_set_ex /sbin/debugfs "$IMAGE" -R "cat $INITRDNAME" > "$INITRDTMP" -# Refine our VMARCH guess from /bin/true using the kernel image to improve -# experience for multiarch kernels. +# Guess the kernel architecture. +KERNELARCH=$VMARCH if command -v file >/dev/null 2>&1; then case "$VMARCH:$(file -b "$KERNELTMP")" in - "arm:Linux kernel ARM64 boot executable Image"*) VMARCH=arm64 ;; - "armel:Linux kernel ARM64 boot executable Image"*) VMARCH=arm64 ;; - "armhf:Linux kernel ARM64 boot executable Image"*) VMARCH=arm64 ;; + "arm:Linux kernel ARM64 boot executable Image"*) KERNELARCH=arm64 ;; + "armel:Linux kernel ARM64 boot executable Image"*) KERNELARCH=arm64 ;; + "armhf:Linux kernel ARM64 boot executable Image"*) KERNELARCH=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 ;; + "i386:Linux kernel x86 boot executable bzImage, version "*"-amd64 "*) KERNELARCH=amd64 ;; esac fi @@ -241,14 +241,14 @@ set -- \ -object rng-random,filename=/dev/urandom,id=rng0 \ "$@" -QEMU="qemu-system-$VMARCH" +QEMU="qemu-system-$KERNELARCH" CPU= MACHINE= MAX_SMP= NIC_DEV=virtio-net-pci,netdev=net0 RNG_DEV=virtio-rng-pci,rng=rng0 -case "$VMARCH" in +case "$KERNELARCH" in amd64) QEMU=qemu-system-x86_64 MACHINE="type=q35" @@ -292,7 +292,7 @@ case "$VMARCH" in ;; esac -if test "$ARCHITECTURE" = "$VMARCH"; then +if test "$ARCHITECTURE" = "$KERNELARCH"; then if ! command -v "$QEMU" >/dev/null 2>&1; then # Fall back to kvm in case we badly guessed qemu. QEMU=kvm @@ -303,7 +303,7 @@ if test "$ARCHITECTURE" = "$VMARCH"; then if test -w /dev/kvm; then CPU=host fi - if test "$VMARCH" = arm64; then + if test "$KERNELARCH" = arm64; then MACHINE="$MACHINE,gic-version=max" fi fi @@ -325,7 +325,7 @@ fi if test -z "$GRAPHICAL"; then set -- -nographic "$@" - case "$VMARCH" in + case "$KERNELARCH" in amd64|i386) KERNEL_CMDLINE="$KERNEL_CMDLINE console=ttyS0" ;; @@ -334,7 +334,7 @@ if test -z "$GRAPHICAL"; then KERNEL_CMDLINE="$KERNEL_CMDLINE TERM=$TERM" fi else - case "$VMARCH" in + case "$KERNELARCH" in amd64|i386) set -- -vga virtio "$@" ;; |