Advertisement
Jupiter_Crafter

KVM Skript

May 22nd, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. # QEMU name and PID
  5. OPTS="-name windows-10-pro"
  6. OPTS="$OPTS -pidfile /tmp/windows-10-pro.pid"
  7.  
  8.  
  9. # Processor
  10. OPTS="$OPTS -cpu host,kvm=off"
  11. OPTS="$OPTS -smp 8,sockets=1,cores=4,threads=2"
  12. OPTS="$OPTS -enable-kvm"
  13.  
  14.  
  15. # Machine
  16. OPTS="$OPTS -machine type=pc-i440fx-2.1,accel=kvm"
  17. #OPTS="$OPTS -machine type=q35,accel=kvm"
  18.  
  19.  
  20.  
  21. OPTS="$OPTS -global PIIX4_PM.disable_s3=0"
  22.  
  23.  
  24. # Memory
  25. OPTS="$OPTS -m 8G"
  26. OPTS="$OPTS -mem-path /dev/hugepages"
  27. OPTS="$OPTS -mem-prealloc"
  28. OPTS="$OPTS -balloon none"
  29.  
  30.  
  31. # Hardware clock
  32. OPTS="$OPTS -rtc clock=host,base=utc"
  33.  
  34.  
  35. # Sound hardware
  36. QEMU_PA_SAMPLES=128
  37. export QEMU_AUDIO_DRV=pa
  38. OPTS="$OPTS -soundhw hda"
  39.  
  40.  
  41. # Graphic card passthrough (Gigabyte GeForce GTX 970 G1 Gaming)
  42. OPTS="$OPTS -device vfio-pci,host=03:00.0,multifunction=on"
  43. OPTS="$OPTS -device vfio-pci,host=03:00.1"
  44.  
  45.  
  46. # USB 3.0 passthrough (NEC/Renesas)
  47. # XBOX CONTROLLER
  48. OPTS="$OPTS -usb -usbdevice host:045e:02d1"
  49. #ALIENWARE MOUSE
  50. #OPTS="$OPTS -usb -usbdevice host:187c:0515"
  51.  
  52.  
  53. # Keyboard layout
  54. OPTS="$OPTS -k de"
  55.  
  56.  
  57. # Boot priority
  58. OPTS="$OPTS -boot order=c"
  59.  
  60.  
  61. # OVMF
  62. cp /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd /home/tom/virtualmachine/my_vars.fd
  63. OPTS="$OPTS -drive if=pflash,format=raw,readonly,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd"
  64. OPTS="$OPTS -drive if=pflash,format=raw,file=/home/tom/virtualmachine/my_vars.fd"
  65.  
  66.  
  67. # System drive
  68. OPTS="$OPTS -drive id=disk0,if=none,cache=unsafe,format=raw,file=/home/tom/virtualmachine/windows10.img"
  69. OPTS="$OPTS -device driver=virtio-scsi-pci,id=scsi0"
  70. OPTS="$OPTS -device scsi-hd,drive=disk0"
  71.  
  72.  
  73. # Other drive
  74. OPTS="$OPTS -drive id=disk1,if=none,cache=none,aio=native,format=raw,file=/dev/disk/by-id/ata-ST1000DM003-1ER162_Z4Y29PNX-part2"
  75. OPTS="$OPTS -device driver=virtio-scsi-pci,id=scsi1"
  76. OPTS="$OPTS -device scsi-hd,drive=disk1"
  77.  
  78.  
  79.  
  80.  
  81. # Windows 10 Pro installer
  82. OPTS="$OPTS -drive id=cd0,if=none,format=raw,readonly,file=/home/tom/virtualmachine/Win8.1_German_x64.iso"
  83. OPTS="$OPTS -device driver=ide-cd,bus=ide.0,drive=cd0"
  84.  
  85.  
  86. # Virtio driver
  87. OPTS="$OPTS -drive id=virtiocd,if=none,format=raw,file=/home/tom/virtualmachine/virtio-win.iso"
  88. OPTS="$OPTS -device driver=ide-cd,bus=ide.1,drive=virtiocd"
  89.  
  90. OPTS="$OPTS -device piix3-usb-uhci"
  91.  
  92.  
  93. # Network
  94. OPTS="$OPTS -net nic -net user,net=192.168.1.0/24"
  95. #OPTS="$OPTS -net nic,model=virtio,vlan=0 -net user"
  96.  
  97.  
  98.  
  99.  
  100.  
  101. sudo taskset -c 0-7 qemu-system-x86_64 $OPTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement