Skip to content
Snippets Groups Projects
Commit a6842a8a authored by Florent Gluck's avatar Florent Gluck
Browse files

Added vm_run_win script to launch a Windows VM with usb passthrough. It's experimental for now.

parent 888c74ef
Branches
No related tags found
No related merge requests found
#!/bin/bash
CPUS=4
RAM=4G
APP=`basename $0`
function echoerr {
echo "$@" >&2
}
function usage {
echoerr "$APP - launch a VM on the specified disk image(s)."
echoerr "The VM is configured with $CPUS CPUs and $RAM of RAM."
echoerr ""
echoerr "Usage: $APP -d disk -i iso"
echoerr "disk the disk image to use (typically a .qcow file)"
echoerr "iso the CD/DVD-ROM image to use (typically an .iso file)"
echoerr ""
echoerr "At least one image must be specified."
exit 1
}
if [ $# -lt 1 ]; then
usage
fi
while [[ $# -gt 0 ]]; do
case $1 in
-d)
disk="$2"
shift # past argument
shift # past value
;;
-i)
iso="$2"
shift # past argument
shift # past value
;;
*)
echo "Unknown argument $1"
exit 1
;;
esac
done
if [ ! -z $disk ]; then
disk_drive="-drive file=$disk,index=0,media=disk,format=qcow2,discard=unmap,detect-zeroes=unmap,if=ide"
fi
if [ ! -z $iso ]; then
cdrom_drive="-drive file=$iso,index=1,media=cdrom,format=raw,read-only=on"
fi
network="-nic user,model=e1000e"
# USB passthrough for using a Fuji camera with X-RAW-Studio
usb="-usb -device usb-host,vendorid=0x04cb,productid=0x02e8"
# -boot order=d tells QEMU to boot to CDROM first
qemu-system-x86_64 -enable-kvm -cpu host -smp cpus=$CPUS -m $RAM -boot order=d $disk_drive $cdrom_drive -vga virtio -device virtio-serial-pci $network $usb
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment