Advertisement
ohetfi

osx-elcapitan.sh

Nov 8th, 2015
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.86 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # QEMU name and PID
  4. VM_NAME="osx-elcapitan"
  5. OPTS="-name $VM_NAME"
  6. OPTS="$OPTS -pidfile /run/qemu_$VM_NAME.pid"
  7.  
  8. # Processor
  9. OPTS="$OPTS -cpu core2duo,kvm=off,vendor=GenuineIntel"
  10. OPTS="$OPTS -smp cpus=4,cores=2,threads=2,sockets=1"
  11. OPTS="$OPTS -enable-kvm"
  12.  
  13. # Memory
  14. OPTS="$OPTS -m size=16G"
  15. OPTS="$OPTS -mem-path /dev/hugepages"
  16. OPTS="$OPTS -mem-prealloc"
  17. OPTS="$OPTS -balloon none"
  18.  
  19. # Machine
  20. OPTS="$OPTS -machine type=pc-q35-2.5,accel=kvm"
  21. OPTS="$OPTS -smbios type=2"
  22.  
  23. # Apple Decryption OSK
  24. OPTS="$OPTS -device isa-applesmc,osk=enter-your-osk-key-here"
  25.  
  26. # Hardware clock
  27. OPTS="$OPTS -rtc clock=host,base=utc"
  28.  
  29. # Sound hardware
  30. export QEMU_AUDIO_DRV=alsa
  31. OPTS="$OPTS -device AC97"
  32.  
  33. # Graphic card passthrough (Gigabyte GeForce GTX 980 G1 Gaming)
  34. OPTS="$OPTS -device vfio-pci,host=01:00.0,multifunction=on"
  35. OPTS="$OPTS -device vfio-pci,host=01:00.1"
  36.  
  37. # USB 3.0 passthrough (NEC/Renesas)
  38. OPTS="$OPTS -device vfio-pci,host=03:00.0"
  39.  
  40. # Keyboard layout
  41. OPTS="$OPTS -k en-us"
  42.  
  43. # OVMF
  44. OPTS="$OPTS -bios /data/machines/$VM_NAME/ovmf/OVMF-pure-efi.fd"
  45.  
  46. # AHCI root bus
  47. OPTS="$OPTS -device ahci,id=hdbus,bus=pcie.0"
  48.  
  49. # Clover drive
  50. 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"
  51. OPTS="$OPTS -device ide-drive,bus=hdbus.0,drive=Clover"
  52.  
  53. # System drive
  54. 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"
  55. OPTS="$OPTS -device ide-drive,bus=hdbus.1,drive=MacOSX"
  56.  
  57. # OVMF emits a number of info / debug messages to the QEMU debug console, at
  58. # ioport 0x402. We configure qemu so that the debug console is indeed
  59. # available at that ioport. We redirect the host side of the debug console to
  60. # a file.
  61. OPTS="$OPTS -global isa-debugcon.iobase=0x402 -debugcon file:/tmp/qemu_$VM_NAME.ovmf.log"
  62.  
  63. # QEMU accepts various commands and queries from the user on the monitor
  64. # interface. Connect the monitor with the qemu process's standard input and
  65. # output.
  66. OPTS="$OPTS -monitor stdio"
  67.  
  68. # USB devices
  69. #OPTS="$OPTS -device piix4-usb-uhci,id=usbbus"
  70. #OPTS="$OPTS -usb -device usb-kbd -device usb-mouse"
  71.  
  72. # Network
  73. OPTS="$OPTS -netdev tap,vhost=on,id=brlan"
  74. OPTS="$OPTS -device e1000-82545em,mac=$(/usr/local/bin/qemu-mac-hasher $VM_NAME),netdev=brlan"
  75.  
  76. # Disable display
  77. OPTS="$OPTS -vga none"
  78. OPTS="$OPTS -serial null"
  79. OPTS="$OPTS -parallel null"
  80. OPTS="$OPTS -display none"
  81.  
  82. sudo echo "Starting $VM_NAME machine"
  83.  
  84. # Disable Dell U2312HM display
  85. xrandr --output HDMI1 --off --output HDMI3 --mode 1920x1080 --pos 0x0 --rotate normal
  86.  
  87. # Start the machine
  88. sudo taskset -c 0-7 qemu-system-x86_64 $OPTS
  89.  
  90. # Restore Dell U2312HM display
  91. 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