Skip to content

Instantly share code, notes, and snippets.

@lamcw
Created July 15, 2019 09:53
Show Gist options
  • Save lamcw/bedeee9bde836a89b8d78e1d4e6fc155 to your computer and use it in GitHub Desktop.
Save lamcw/bedeee9bde836a89b8d78e1d4e6fc155 to your computer and use it in GitHub Desktop.
QEMU launch script for Windows 10
#!/bin/sh
# Wrapper script for launching a qemu instance for Windows 10.
#
# This script is used in a Dell XPS 13 host.
#
# Usage: win [custom_qemu_options]
#
# Example:
# Assigning host USB device to guest VM
# win -usb -device usb-host,hostbus=2,hostaddr=2
set -xe
export QEMU_AUDIO_DRV=alsa
export SDL_VIDEODRIVER=wayland
vm_path=$(systemd-path user-shared)/libvirt/images/win10.img
smb_path="$HOME"/qemu
qemu-system-x86_64 \
-m 5G \
-drive file="$vm_path",format=raw,if=virtio,cache=none,aio=native,cache.direct=on \
-enable-kvm \
-machine type=pc,accel=kvm \
-cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time \
-smp 4,sockets=1,cores=2,threads=2 \
-vga virtio -display sdl,gl=on \
-soundhw hda \
-nic user,model=e1000,smb="$smb_path" \
-usb \
-device usb-tablet \
-device nec-usb-xhci,id=xhci \
"$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment