diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-01-21 07:20:22 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-01-21 07:20:22 +0100 |
commit | 953318ab09ed18e1a6624cce80566872a34bcf18 (patch) | |
tree | 2247fa28c6c36c93917596f1e782ff04879e4440 | |
parent | 3cc914e7e27627c9db75cbd95cf6b8d54d641f8a (diff) | |
download | debvm-953318ab09ed18e1a6624cce80566872a34bcf18.tar.gz |
debvm-run: compute -machine independently of being native
When running on armhf natively, there also is no default machine, so we
should also pass -machine virt there. That likely affects all arms and
riscv64 as well.
-rwxr-xr-x | bin/debvm-run | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index 7847cba..35a3459 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -217,7 +217,18 @@ set -- \ -device "virtio-net-pci,netdev=net0" \ "$@" +MACHINE= MAX_SMP= + +case "$VMARCH" in + amd64) + MACHINE="type=q35" + ;; + arm|arm64|armel|armhf|riscv64) + MACHINE="type=virt" + ;; +esac + if test "$ARCHITECTURE" = "$VMARCH"; then QEMU=kvm # While kvm will fall back gracefully, the following options can only @@ -227,7 +238,7 @@ if test "$ARCHITECTURE" = "$VMARCH"; then fi case "$VMARCH" in arm64) - set -- -machine type=virt,gic-version=host "$@" + MACHINE="$MACHINE,gic-version=host" ;; esac else @@ -238,11 +249,11 @@ else ;; arm64) QEMU=qemu-system-aarch64 - set -- -machine virt -cpu max "$@" + set -- -cpu max "$@" ;; arm|armel|armhf) QEMU=qemu-system-arm - set -- -machine virt -cpu max "$@" + set -- -cpu max "$@" ;; powerpc) QEMU=qemu-system-ppc @@ -261,19 +272,16 @@ else mipsel) MAX_SMP=1 ;; - riscv64) - set -- -machine virt "$@" - ;; sparc64) MAX_SMP=1 ;; esac fi -case "$VMARCH" in - amd64) - set -- -machine q35 "$@" - ;; -esac + +if test -n "$MACHINE"; then + set -- -machine "$MACHINE" "$@" +fi + if test -z "$MAX_SMP" || test "$MAX_SMP" -gt 1; then NPROC=$(nproc) test -n "$MAX_SMP" && test "$NPROC" -gt "$MAX_SMP" && NPROC=$MAX_SMP |