From f5d2d49f52d02207c0a724342a635117930aecd2 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sat, 21 Jan 2023 10:47:58 +0100 Subject: 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. --- bin/debvm-run | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3