Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- INSTALLFILE=win7-uefi-x64_system.qcow2
- FILESIZE=50G
- INSTALLCD=/data/operatingsystems/windows7/win7sp1x64noeicfg.iso
- # if you use a hardware CD-ROM drive, check for the device. In most cases it's /dev/sr0
- #INSTALLCD=/dev/sr0
- DRIVERCD=/home/mobi/Downloads/virtio-win-0.1.110.iso
- # PCI address of the passtrough devices
- DEVICE1="01:00.0"
- DEVICE2="01:00.1"
- # load vfio-pci module
- modprobe vfio-pci
- for dev in "0000:$DEVICE1" "0000:$DEVICE2"; do
- 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
- done
- # create installation file if not exist
- if [ ! -e $INSTALLFILE ]; then
- qemu-img create -f qcow2 $INSTALLFILE $FILESIZE
- fi
- QEMU_PA_SAMPLES=4096 QEMU_AUDIO_DRV=pa \
- qemu-system-x86_64 \
- -enable-kvm \
- -m 4096 \
- -cpu host,kvm=off \
- -smp 2,sockets=1,cores=2,threads=1 \
- -machine pc-i440fx-2.1,accel=kvm \
- -soundhw hda \
- -bios /usr/share/ovmf/x64/OVMF.fd `# SID version of OVMF` \
- -device vfio-pci,host=$DEVICE1,addr=0x8.0x0,multifunction=on \
- -device vfio-pci,host=$DEVICE2,addr=0x8.0x1 \
- -vga qxl \
- -device virtio-net-pci,netdev=user.0,mac=52:54:00:a0:66:43 \
- -netdev user,id=user.0 \
- -drive file=$INSTALLCD,if=none,id=drive-ide0-0-0,readonly=on,format=raw \
- -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
- -drive file=$INSTALLFILE,if=none,id=drive-virtio-disk0,format=qcow2,cache=unsafe \
- -device virtio-blk-pci,scsi=off,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=2 \
- -drive file=$DRIVERCD,if=none,id=drive-ide0-1-0,readonly=on,format=raw \
- -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=3 \
- -rtc base=localtime,driftfix=slew \
- -smb /home/mobi/Downloads/toinstall \
- -usb \
- -device usb-tablet \
- -device usb-kbd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement