Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #!/bin/bash
  2. #-usb -device usb-host,hostbus=4,hostaddr=4 -device usb-host,hostbus=4,hostaddr=3 \
  3. #-drive file=/home/shi/windows1.img,id=disk,format=raw,if=none -device scsi-hd,drive=disk \
  4. #-drive file=/home/shi/win10/win10.iso,id=isocd,format=iso,if=none -device scsi-cd,drive=isocd \
  5.  
  6. configfile=/etc/vfio-pci1.cfg
  7.  
  8. vfiobind() {
  9. dev="$1"
  10. vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
  11. device=$(cat /sys/bus/pci/devices/$dev/device)
  12. if [ -e /sys/bus/pci/devices/$dev/driver ]; then
  13. echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
  14. fi
  15. echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
  16.  
  17. }
  18.  
  19. modprobe vfio-pci
  20.  
  21. cat $configfile | while read line;do
  22. echo $line | grep ^# >/dev/null 2>&1 && continue
  23. vfiobind $line
  24. done
  25.  
  26. sudo qemu-system-x86_64 -enable-kvm -M q35 -m 8192 -cpu host,kvm=off \
  27. -smp 4,sockets=1,cores=4,threads=1 \
  28. -bios /usr/share/seabios/bios.bin -vga none \
  29. -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
  30. -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
  31. -device vfio-pci,host=01:00.1,bus=root.1,addr=00.1 \
  32. -device virtio-scsi-pci,id=scsi \
  33. -drive file=/home/shi/windows1.img,id=disk,format=raw,if=none -device ide-hd,bus=ide.0,drive=disk \
  34. -drive file=/home/shi/win10/win10.iso,id=isocd,if=none -device ide-cd,bus=ide.1,drive=isocd \
  35. -boot menu=on
  36.  
  37. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement