Advertisement
vorron

qemu launch script

Jun 19th, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # VARS ========================================================================
  4. ID=c78c9cf0-3e95-4fa6-b859-b3db464ea7a0
  5. LOC=/sys/devices/pci0000:00/0000:00:02.0
  6. QEMU_BIN=qemu-system-x86_64
  7.  
  8. ISO_STORAGE=/mnt/media/iso
  9. IMG_STORAGE=/mnt/media/vmdrive
  10. HIGH_SPEED_STORAGE=/mnt/storage/vmdrive
  11. SAMBA_DIR=/mnt/storage/devshare/
  12.  
  13. # QEMU SETTINGS ===============================================================
  14. OPTS="-name win10vgpu"
  15.  
  16. # Processor
  17. OPTS="$OPTS -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time"
  18. OPTS="$OPTS -smp sockets=1,cores=2,threads=2"
  19.  
  20. # Memory
  21. OPTS="$OPTS -m 4G"
  22.  
  23. # Machine
  24. OPTS="$OPTS -enable-kvm"
  25. #OPTS="$OPTS -machine type=pc,accel=kvm,kernel_irqchip=on"
  26. OPTS="$OPTS -machine type=pc-i440fx-3.1,accel=kvm,kernel_irqchip=on"
  27.  
  28. # BIOS
  29. OPTS="$OPTS -bios /usr/share/qemu/bios.bin"
  30.  
  31. # Display
  32. OPTS="$OPTS -display gtk,gl=on"
  33. OPTS="$OPTS -vga none"
  34. # OPTS="$OPTS -vga vmware"
  35.  
  36. # Sound
  37. OPTS="$OPTS -soundhw hda"
  38. OPTS="$OPTS -audiodev driver=pa,id=pa,server=/run/user/1000/pulse/native"
  39.  
  40. # Drives
  41. #OPTS="$OPTS -drive file=${HIGH_SPEED_STORAGE}/win10-gvt/win10-gvt-base.qcow2,index=0,media=disk,format=qcow2"
  42. OPTS="$OPTS -drive file=${HIGH_SPEED_STORAGE}/win10-gvt/snap/win10-gvt-current.qcow2,index=0,media=disk,format=qcow2"
  43. #OPTS="$OPTS -drive file=${HIGH_SPEED_STORAGE}/win10-gvt/snap/win10-gvt-testing.qcow2,index=0,media=disk,format=qcow2"
  44. OPTS="$OPTS -drive file=/dev/disk/by-id/ata-ST1000LX015-1U7172_WDEDQ8GG-part3,index=1,media=disk,format=raw,if=virtio"
  45. #OPTS="$OPTS -drive file=${IMG_STORAGE}/data/win-data.qcow2,index=2,media=disk,format=qcow2"
  46. OPTS="$OPTS -drive index=3,media=cdrom"
  47.  
  48. # Boot order
  49. # OPTS="$OPTS -boot d"
  50.  
  51. # Disable suspend
  52. OPTS="$OPTS -global PIIX4_PM.disable_s3=1"
  53. OPTS="$OPTS -global PIIX4_PM.disable_s4=1"
  54.  
  55. # Intel vGPU pass through
  56. OPTS="$OPTS -device vfio-pci,sysfsdev=${LOC}/${ID},display=on,x-igd-opregion=on"
  57.  
  58. # Keyboard layout
  59. OPTS="$OPTS -k en-us"
  60.  
  61. # A USB tablet device in the guest allows for accurate pointer tracking
  62. OPTS="$OPTS -usb -device usb-tablet"
  63.  
  64. # USB pass through
  65. # OPTS="$OPTS -usb -device usb-host,hostbus=1,hostaddr=2"
  66. #OPTS="$OPTS -usb -device usb-host,hostbus=1,hostaddr=4"
  67.  
  68. # Shared folders
  69. OPTS="$OPTS -net nic -net user,smb=$SAMBA_DIR"
  70.  
  71. # LAUNCH ======================================================================
  72.  
  73. # Create vGPU
  74. echo ${ID} > ${LOC}/mdev_supported_types/i915-GVTg_V5_4/create
  75. sleep 5
  76.  
  77. # QEMU Launch
  78. ${QEMU_BIN} ${OPTS}
  79.  
  80. # Remove vGPU
  81. echo 1 > ${LOC}/${ID}/remove
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement