Advertisement
Guest User

MyVM

a guest
Apr 27th, 2016
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. configfile=/etc/vfio-pci1.cfg
  4.  
  5. vfiobind() {
  6. dev="$1"
  7. vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
  8. device=$(cat /sys/bus/pci/devices/$dev/device)
  9. if [ -e /sys/bus/pci/devices/$dev/driver ]; then
  10. echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
  11. fi
  12. echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
  13.  
  14. }
  15.  
  16. modprobe vfio-pci
  17.  
  18. cat $configfile | while read line;do
  19. echo $line | grep ^# >/dev/null 2>&1 && continue
  20. vfiobind $line
  21. done
  22.  
  23.  
  24. sudo qemu-system-x86_64 -machine accel=kvm -enable-kvm -m 8192 -no-hpet -cpu host,kvm=off, \
  25. -rtc base=localtime,clock=host \
  26. -smp threads=2,cores=4,sockets=1 \
  27. -bios /home/evil/run-ovmf/bios.bin -vga none \
  28. -drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
  29. -drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS.fd \
  30. -device vfio-pci,host=01:00.0,multifunction=on,x-vga=on \
  31. -device vfio-pci,host=01:00.1 \
  32. -vga none \
  33. -device virtio-scsi-pci,id=scsi \
  34. -drive file=/home/evil/windows1.img,id=disk,format=raw,cache=none,if=none -device scsi-hd,drive=disk \
  35. -drive file=/media/evil/Storage/storage.img,id=disk1,format=raw,if=none -device scsi-hd,drive=disk1 \
  36. -soundhw hda \
  37. -usb -device usb-host,hostbus=3,hostaddr=10 -device usb-host,hostbus=3,hostaddr=9 \
  38. -boot menu=on
  39.  
  40. xrandr --output HDMI1 --auto
  41.  
  42.  
  43. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement