Advertisement
Guest User

Untitled

a guest
May 4th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 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 -enable-kvm -m 8192 -no-hpet -serial none -nodefconfig -parallel none -cpu host,kvm=off,check \
  25. -rtc base=localtime,clock=host \
  26. -smp sockets=1,cores=4,threads=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=/dev/sda1,id=disk1,if=none,format=raw,cache=none -device scsi-hd,drive=disk1 \
  36. -drive file=/dev/sdc2,id=disk2,if=none,format=raw,cache=none -device scsi-hd,drive=disk2 \
  37. -drive file=/dev/sdb1,id=disk3,if=none,format=raw,cache=none -device scsi-hd,drive=disk3 \
  38. -usb -usbdevice host:054c:0268 -usbdevice host:1b1c:1b09 -usbdevice host:046d:c07d
  39. -boot menu=on
  40.  
  41. xrandr --output HDMI1 --auto
  42.  
  43.  
  44. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement