summaryrefslogtreecommitdiff
path: root/bin/debvm-run
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2023-01-21 10:47:58 +0100
committerHelmut Grohne <helmut@subdivi.de>2023-01-21 10:47:58 +0100
commitf5d2d49f52d02207c0a724342a635117930aecd2 (patch)
treed045ab2830bf57bd8eeefd90a86a6a34e6b23991 /bin/debvm-run
parent0dba27d15a459f3408fb71b9c79be9b8f4cbdb1d (diff)
downloaddebvm-f5d2d49f52d02207c0a724342a635117930aecd2.tar.gz
debvm-run: refactor rng device
It's not as simple as disabling the rng when pci is unavailable. For m68k, we can select -machine virt and then we can have a virtio-rng-device. Thus make that part configurable.
Diffstat (limited to 'bin/debvm-run')
-rwxr-xr-xbin/debvm-run14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/debvm-run b/bin/debvm-run
index bead93e..4c8bb5a 100755
--- a/bin/debvm-run
+++ b/bin/debvm-run
@@ -214,13 +214,14 @@ set -- \
-initrd "$INITRDTMP" \
-drive "media=disk,format=raw,discard=unmap,file=$IMAGE,if=virtio,cache=unsafe" \
-device "virtio-net-pci,netdev=net0" \
+ -object rng-random,filename=/dev/urandom,id=rng0 \
"$@"
QEMU="qemu-system-$VMARCH"
CPU=
-HAVE_PCI=yes
MACHINE=
MAX_SMP=
+RNG_DEV=virtio-rng-pci,rng=rng0
case "$VMARCH" in
amd64)
@@ -230,7 +231,7 @@ case "$VMARCH" in
arm|armel)
CPU=max
MACHINE="type=virt"
- HAVE_PCI=no
+ RNG_DEV=
;;
arm64)
QEMU=qemu-system-aarch64
@@ -242,7 +243,8 @@ case "$VMARCH" in
MACHINE="type=virt"
;;
m68k)
- HAVE_PCI=no
+ MACHINE="type=virt"
+ RNG_DEV=virtio-rng-device,rng=rng0
;;
mips64el)
CPU=5KEc
@@ -257,7 +259,7 @@ case "$VMARCH" in
MACHINE="type=virt"
;;
sparc64)
- HAVE_PCI=no
+ RNG_DEV=
;;
esac
@@ -294,8 +296,8 @@ if test -z "$MAX_SMP" || test "$MAX_SMP" -gt 1; then
test -n "$MAX_SMP" && test "$NPROC" -gt "$MAX_SMP" && NPROC=$MAX_SMP
set -- -smp "$NPROC" "$@"
fi
-if test "$HAVE_PCI" = yes; then
- set -- -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 "$@"
+if test -n "$RNG_DEV"; then
+ set -- -device "$RNG_DEV" "$@"
fi
if test -z "$GRAPHICAL"; then