Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # QEMU name and PID
- VM_NAME="osx-elcapitan"
- OPTS="-name $VM_NAME"
- OPTS="$OPTS -pidfile /run/qemu_$VM_NAME.pid"
- # Processor
- OPTS="$OPTS -cpu core2duo,kvm=off,vendor=GenuineIntel"
- OPTS="$OPTS -smp cpus=4,cores=2,threads=2,sockets=1"
- OPTS="$OPTS -enable-kvm"
- # Memory
- OPTS="$OPTS -m size=16G"
- OPTS="$OPTS -mem-path /dev/hugepages"
- OPTS="$OPTS -mem-prealloc"
- OPTS="$OPTS -balloon none"
- # Machine
- OPTS="$OPTS -machine type=pc-q35-2.5,accel=kvm"
- OPTS="$OPTS -smbios type=2"
- # Apple Decryption OSK
- OPTS="$OPTS -device isa-applesmc,osk=enter-your-osk-key-here"
- # Hardware clock
- OPTS="$OPTS -rtc clock=host,base=utc"
- # Sound hardware
- export QEMU_AUDIO_DRV=alsa
- OPTS="$OPTS -device AC97"
- # Graphic card passthrough (Gigabyte GeForce GTX 980 G1 Gaming)
- OPTS="$OPTS -device vfio-pci,host=01:00.0,multifunction=on"
- OPTS="$OPTS -device vfio-pci,host=01:00.1"
- # USB 3.0 passthrough (NEC/Renesas)
- OPTS="$OPTS -device vfio-pci,host=03:00.0"
- # Keyboard layout
- OPTS="$OPTS -k en-us"
- # OVMF
- OPTS="$OPTS -bios /data/machines/$VM_NAME/ovmf/OVMF-pure-efi.fd"
- # AHCI root bus
- OPTS="$OPTS -device ahci,id=hdbus,bus=pcie.0"
- # Clover drive
- OPTS="$OPTS -drive id=Clover,if=none,cache=unsafe,aio=threads,detect-zeroes=on,format=raw,file=/data/machines/$VM_NAME/disks/clover-debug-test.img"
- OPTS="$OPTS -device ide-drive,bus=hdbus.0,drive=Clover"
- # System drive
- OPTS="$OPTS -drive id=MacOSX,if=none,cache=unsafe,aio=threads,detect-zeroes=on,format=raw,file=/data/machines/$VM_NAME/disks/disk0-system.img"
- OPTS="$OPTS -device ide-drive,bus=hdbus.1,drive=MacOSX"
- # OVMF emits a number of info / debug messages to the QEMU debug console, at
- # ioport 0x402. We configure qemu so that the debug console is indeed
- # available at that ioport. We redirect the host side of the debug console to
- # a file.
- OPTS="$OPTS -global isa-debugcon.iobase=0x402 -debugcon file:/tmp/qemu_$VM_NAME.ovmf.log"
- # QEMU accepts various commands and queries from the user on the monitor
- # interface. Connect the monitor with the qemu process's standard input and
- # output.
- OPTS="$OPTS -monitor stdio"
- # USB devices
- #OPTS="$OPTS -device piix4-usb-uhci,id=usbbus"
- #OPTS="$OPTS -usb -device usb-kbd -device usb-mouse"
- # Network
- OPTS="$OPTS -netdev tap,vhost=on,id=brlan"
- OPTS="$OPTS -device e1000-82545em,mac=$(/usr/local/bin/qemu-mac-hasher $VM_NAME),netdev=brlan"
- # Disable display
- OPTS="$OPTS -vga none"
- OPTS="$OPTS -serial null"
- OPTS="$OPTS -parallel null"
- OPTS="$OPTS -display none"
- sudo echo "Starting $VM_NAME machine"
- # Disable Dell U2312HM display
- xrandr --output HDMI1 --off --output HDMI3 --mode 1920x1080 --pos 0x0 --rotate normal
- # Start the machine
- sudo taskset -c 0-7 qemu-system-x86_64 $OPTS
- # Restore Dell U2312HM display
- xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement