Unverified Commit 2f17bf9f authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Allow running without KVM in debug mode

parent a7a4bf34
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -49,17 +49,22 @@ if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
  fi
fi

[ -z "${KVM_OPTS}" ] && echo "Error: KVM acceleration is disabled.." && exit 88
if [ -z "${KVM_OPTS}" ]; then
  KVM_OPTS="-machine usb=off"
  if [ "$DEBUG" != "Y" ]; then
    echo "Error: KVM acceleration is disabled.." && exit 88
  fi
fi

DEF_OPTS="-nographic"
RAM_OPTS=$(echo "-m ${RAM_SIZE}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
CPU_OPTS="-smp ${CPU_CORES},sockets=1,cores=${CPU_CORES},threads=1"
EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4 -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0"
DEF_OPTS="-nographic -nodefaults -pidfile ${_QEMU_PID} -overcommit mem-lock=off"
EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0 -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0"
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${KVM_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS}"

set -m
(
  qemu-system-x86_64 ${ARGS} & echo $! > ${_QEMU_PID}
  qemu-system-x86_64 ${ARGS} &
)
set +m