summaryrefslogtreecommitdiff
path: root/bin/debvm-run
diff options
context:
space:
mode:
Diffstat (limited to 'bin/debvm-run')
-rwxr-xr-xbin/debvm-run42
1 files changed, 22 insertions, 20 deletions
diff --git a/bin/debvm-run b/bin/debvm-run
index 3371b79..4dc35d3 100755
--- a/bin/debvm-run
+++ b/bin/debvm-run
@@ -354,17 +354,6 @@ set -- \
-initrd "/proc/self/fd/$INITRDFD" \
"$@"
-# If the image filename contains a comma, then that comma must be escaped by
-# prefixing it with another comma or otherwise output filenames are able to
-# inject drive options to qemu (and load the wrong file).
-IMAGE_ESCAPED="$(printf "%s" "$IMAGE" | sed 's/,/,,/g')"
-
-if ! check_skip root/dev; then
- set -- \
- -drive "media=disk,format=raw,discard=unmap,file=$IMAGE_ESCAPED,if=virtio,cache=unsafe" \
- "$@"
-fi
-
# Translate KERNELARCH (a Debian architecture) to a Debian CPU name.
# This utilizes the QEMU Debian package symlink mapping that ensures that
# calling qemu-system-${DEB_HOST_ARCH_CPU} will run the QEMU binary providing
@@ -373,9 +362,8 @@ KERNELARCHCPU="$(dpkg-architecture --force --host-arch "$KERNELARCH" --query DEB
QEMU="qemu-system-$KERNELARCHCPU"
CPU=
MACHINE=
+BUS=pci
MAX_SMP=
-NIC_DEV=virtio-net-pci,netdev=net0
-RNG_DEV=virtio-rng-pci,rng=rng0
case "$KERNELARCHCPU" in
amd64)
@@ -393,8 +381,7 @@ case "$KERNELARCHCPU" in
m68k)
MACHINE="type=virt"
MAX_SMP=1
- NIC_DEV=virtio-net-device,netdev=net0
- RNG_DEV=virtio-rng-device,rng=rng0
+ BUS=device
;;
mips64el)
CPU=5KEc
@@ -415,6 +402,18 @@ case "$KERNELARCHCPU" in
;;
esac
+# If the image filename contains a comma, then that comma must be escaped by
+# prefixing it with another comma or otherwise output filenames are able to
+# inject drive options to qemu (and load the wrong file).
+IMAGE_ESCAPED="$(printf "%s" "$IMAGE" | sed 's/,/,,/g')"
+
+if ! check_skip root/dev; then
+ set -- \
+ -drive "id=root,media=disk,format=raw,discard=unmap,file=$IMAGE_ESCAPED,if=none,cache=unsafe" \
+ -device "virtio-blk-$BUS,drive=root,serial=root" \
+ "$@"
+fi
+
ENABLE_KVM=no
if test "$ARCHITECTURE" = "$KERNELARCH"; then
ENABLE_KVM=yes
@@ -457,7 +456,7 @@ if test -z "$MAX_SMP" || test "$MAX_SMP" -gt 1; then
fi
if ! check_skip rngdev; then
set -- \
- -device "$RNG_DEV" \
+ -device "virtio-rng-$BUS,rng=rng0" \
-object rng-random,filename=/dev/urandom,id=rng0 \
"$@"
fi
@@ -479,14 +478,14 @@ else
;;
*)
set -- \
- -device virtio-gpu-gl-pci \
+ -device "virtio-gpu-gl-$BUS" \
-display gtk,gl=on \
"$@"
;;
esac
set -- \
- -device virtio-keyboard-pci \
- -device virtio-tablet-pci \
+ -device "virtio-keyboard-$BUS" \
+ -device "virtio-tablet-$BUS" \
"$@"
fi
@@ -503,7 +502,10 @@ if test -n "$KERNEL_CMDLINE"; then
fi
if ! check_skip network; then
- set -- -netdev "user,id=net0$NETOPTS" -device "$NIC_DEV" "$@"
+ set -- \
+ -netdev "user,id=net0$NETOPTS" \
+ -device "virtio-net-$BUS,netdev=net0" \
+ "$@"
fi
echo "+ $QEMU $*" 1>&2