Advertisement
Jako81624

Untitled

Jun 20th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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. sudo qemu-system-x86_64 -enable-kvm -M q35 -m 4096 -cpu host,kvm=off \
  24. -smp 4,sockets=1,cores=4,threads=1 \
  25. -bios /usr/share/qemu/bios.bin -vga none \
  26. -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
  27. -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
  28. -device vfio-pci,host=02:00.1,bus=root.1,addr=00.1 \
  29. -drive file=/home/jacob/windows7.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk \
  30. -drive file=/home/jacob/Downloads/Windows.iso,id=isocd -device ide-cd,bus=ide.1,drive=isocd \
  31. -boot menu=on
  32.  
  33. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement