Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- configfile=/etc/vfio-pci1.cfg
- vfiobind() {
- dev="$1"
- vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
- device=$(cat /sys/bus/pci/devices/$dev/device)
- if [ -e /sys/bus/pci/devices/$dev/driver ]; then
- echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
- fi
- echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
- }
- modprobe vfio-pci
- cat $configfile | while read line;do
- echo $line | grep ^# >/dev/null 2>&1 && continue
- vfiobind $line
- done
- sudo qemu-system-x86_64 -enable-kvm -m 8192 -no-hpet -serial none -nodefconfig -parallel none -cpu host,kvm=off,check \
- -rtc base=localtime,clock=host \
- -smp sockets=1,cores=4,threads=1 \
- -bios /home/evil/run-ovmf/bios.bin -vga none \
- -drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
- -drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS.fd \
- -device vfio-pci,host=01:00.0,multifunction=on,x-vga=on \
- -device vfio-pci,host=01:00.1 \
- -vga none \
- -device virtio-scsi-pci,id=scsi \
- -drive file=/home/evil/windows1.img,id=disk,format=raw,cache=none,if=none -device scsi-hd,drive=disk \
- -drive file=/dev/sda1,id=disk1,if=none,format=raw,cache=none -device scsi-hd,drive=disk1 \
- -drive file=/dev/sdc2,id=disk2,if=none,format=raw,cache=none -device scsi-hd,drive=disk2 \
- -drive file=/dev/sdb1,id=disk3,if=none,format=raw,cache=none -device scsi-hd,drive=disk3 \
- -usb -usbdevice host:054c:0268 -usbdevice host:1b1c:1b09 -usbdevice host:046d:c07d
- -boot menu=on
- xrandr --output HDMI1 --auto
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement