Advertisement
ohetfi

qemu-windows-10-pro-enlighten

Nov 3rd, 2015
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.01 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # QEMU name and PID
  4. VM_NAME="windows-10-pro"
  5. OPTS="-name $VM_NAME"
  6. OPTS="$OPTS -pidfile /run/qemu_$VM_NAME.pid"
  7.  
  8. # Processor
  9. OPTS="$OPTS -cpu host,kvm=off,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,hv_vendor_id=freyja"
  10. OPTS="$OPTS -smp cpus=8,cores=4,threads=2,sockets=1"
  11. OPTS="$OPTS -enable-kvm"
  12.  
  13. # Machine
  14. OPTS="$OPTS -machine type=pc-i440fx-2.4,accel=kvm"
  15.  
  16. # The following setting enables S3 (suspend to RAM). OVMF supports S3
  17. # suspend/resume. Disable when using Q35
  18. OPTS="$OPTS -global PIIX4_PM.disable_s3=0"
  19.  
  20. # Memory
  21. OPTS="$OPTS -m size=16G"
  22. OPTS="$OPTS -mem-path /dev/hugepages"
  23. OPTS="$OPTS -mem-prealloc"
  24. OPTS="$OPTS -balloon none"
  25.  
  26. # Hardware clock
  27. OPTS="$OPTS -rtc clock=host,base=utc"
  28.  
  29. # Sound hardware
  30. export QEMU_AUDIO_DRV=alsa
  31. OPTS="$OPTS -device AC97"
  32.  
  33. # Graphic card passthrough (Gigabyte GeForce GTX 980 G1 Gaming)
  34. OPTS="$OPTS -device vfio-pci,host=01:00.0,multifunction=on"
  35. OPTS="$OPTS -device vfio-pci,host=01:00.1"
  36.  
  37. # USB 3.0 passthrough (NEC/Renesas)
  38. OPTS="$OPTS -device vfio-pci,host=03:00.0"
  39.  
  40. # Keyboard layout
  41. OPTS="$OPTS -k en-us"
  42.  
  43. # Boot priority
  44. OPTS="$OPTS -boot order=c"
  45.  
  46. # OVMF
  47. OPTS="$OPTS -drive if=pflash,format=raw,readonly,file=/data/machines/$VM_NAME/ovmf/OVMF_CODE-pure-efi.fd"
  48. OPTS="$OPTS -drive if=pflash,format=raw,file=/data/machines/$VM_NAME/ovmf/OVMF_VARS-pure-efi.fd"
  49.  
  50. # System drive
  51. OPTS="$OPTS -drive id=disk0,if=none,cache=unsafe,format=raw,file=/data/machines/$VM_NAME/disks/disk0-system.img"
  52. OPTS="$OPTS -device driver=virtio-scsi-pci,id=scsi0"
  53. OPTS="$OPTS -device scsi-hd,drive=disk0"
  54.  
  55. # 1st Game drive
  56. OPTS="$OPTS -drive id=disk1,if=none,cache=none,aio=native,format=raw,file=/dev/disk/by-id/ata-Hitachi_HDS721050CLA660_JP1570FR1ZWP7K"
  57. OPTS="$OPTS -device driver=virtio-scsi-pci,id=scsi1"
  58. OPTS="$OPTS -device scsi-hd,drive=disk1"
  59.  
  60. # 2nd Game drive
  61. OPTS="$OPTS -drive id=disk2,if=none,cache=none,aio=native,format=raw,file=/dev/disk/by-id/ata-Hitachi_HDS5C3020ALA632_ML0220F30NX2DD"
  62. OPTS="$OPTS -device driver=virtio-scsi-pci,id=scsi2"
  63. OPTS="$OPTS -device scsi-hd,drive=disk2"
  64.  
  65. # Windows 10 Pro installer
  66. #OPTS="$OPTS -drive id=cd0,if=none,format=raw,readonly,file=/data/machines/$VM_NAME/iso/Windows_10_Professional_64_Bit.iso"
  67. #OPTS="$OPTS -device driver=ide-cd,bus=ide.0,drive=cd0"
  68.  
  69. # Virtio driver
  70. #OPTS="$OPTS -drive id=virtiocd,if=none,format=raw,file=/data/iso/VirtIO/virtio-win-0.1.109.iso"
  71. #OPTS="$OPTS -device driver=ide-cd,bus=ide.1,drive=virtiocd"
  72.  
  73. # OVMF emits a number of info / debug messages to the QEMU debug console, at
  74. # ioport 0x402. We configure qemu so that the debug console is indeed
  75. # available at that ioport. We redirect the host side of the debug console to
  76. # a file.
  77. OPTS="$OPTS -global isa-debugcon.iobase=0x402 -debugcon file:/tmp/qemu_$VM_NAME.ovmf.log"
  78.  
  79. # QEMU accepts various commands and queries from the user on the monitor
  80. # interface. Connect the monitor with the qemu process's standard input and
  81. # output.
  82. OPTS="$OPTS -monitor stdio"
  83.  
  84. # A USB tablet device in the guest allows for accurate pointer tracking
  85. # between the host and the guest.
  86. OPTS="$OPTS -device piix3-usb-uhci -device usb-tablet"
  87.  
  88. # Network
  89. OPTS="$OPTS -netdev tap,vhost=on,id=brlan"
  90. OPTS="$OPTS -device virtio-net-pci,mac=$(/usr/local/bin/qemu-mac-hasher $VM_NAME),netdev=brlan"
  91.  
  92. # Disable display
  93. OPTS="$OPTS -vga none"
  94. OPTS="$OPTS -serial null"
  95. OPTS="$OPTS -parallel null"
  96. OPTS="$OPTS -display none"
  97.  
  98. # QEMU Guest Agent
  99. OPTS="$OPTS -chardev socket,path=/tmp/qga_$VM_NAME.sock,server,nowait,id=qga_$VM_NAME"
  100. OPTS="$OPTS -device virtio-serial"
  101. OPTS="$OPTS -device virtserialport,chardev=qga_$VM_NAME,name=org.qemu.guest_agent.$VM_NAME"
  102.  
  103. sudo echo "Starting $VM_NAME machine"
  104.  
  105. # Disable Dell U2312HM display
  106. xrandr --output HDMI1 --off --output HDMI3 --mode 1920x1080 --pos 0x0 --rotate normal
  107.  
  108. # Start Windows 10 Pro
  109. sudo taskset -c 0-7 qemu-system-x86_64 $OPTS
  110.  
  111. # Restore Dell U2312HM display
  112. xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement