Guest User

kvm-start

a guest
Jun 5th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. INSTALLFILE=/media/Windows_VM/win7-uefi-x64_system.raw
  4. #FILESIZE=50G
  5.  
  6. # PCI address of the passtrough devices
  7. DEVICE1="01:00.0"
  8. DEVICE2="01:00.1"
  9.  
  10. #Repertoire Windows
  11. WINDOWS=/media/Autres/Windows
  12.  
  13. # load vfio-pci module
  14. modprobe vfio-pci
  15.  
  16. for dev in "0000:$DEVICE1" "0000:$DEVICE2"; do
  17. vendor=$(cat /sys/bus/pci/devices/${dev}/vendor)
  18. device=$(cat /sys/bus/pci/devices/${dev}/device)
  19. if [ -e /sys/bus/pci/devices/${dev}/driver ]; then
  20. echo ${dev} > /sys/bus/pci/devices/${dev}/driver/unbind
  21. fi
  22. echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
  23. done
  24.  
  25. QEMU_PA_SAMPLES=6144 QEMU_AUDIO_DRV=pa \
  26. qemu-system-x86_64 \
  27. -enable-kvm \
  28. -m 4096 \
  29. -cpu host,kvm=off \
  30. -smp 8,sockets=1,cores=4,threads=2 \
  31. -machine pc-i440fx-2.1,accel=kvm \
  32. -soundhw hda \
  33. -bios /usr/share/ovmf/OVMF.fd `# SID version of OVMF` \
  34. -device vfio-pci,host=$DEVICE1,addr=0x8.0x0,multifunction=on,x-vga=on \
  35. -device vfio-pci,host=$DEVICE2,addr=0x8.0x1 \
  36. -vga none \
  37. -device qxl \
  38. -device virtio-net-pci,netdev=user.0,mac=52:54:00:a0:66:43 \
  39. -netdev user,id=user.0 \
  40.  
  41. ##HDD for Windows
  42. -drive file=$INSTALLFILE,if=none,id=drive-virtio-disk0,format=raw,cache=none \
  43. -device virtio-blk-pci,scsi=off,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
  44.  
  45. -rtc base=localtime,driftfix=slew \
  46. -smb $WINDOWS \
  47. -usb \
  48. -usbdevice host:3938:1036 \
  49. -usbdevice host:046d:c31c
Add Comment
Please, Sign In to add comment