ohetfi

kvm-i440FX-sles11sp3-passthru.sh

May 1st, 2016
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # QEMU name and PID
  4. VM_NAME="sles-11sp3"
  5. OPTS="-name $VM_NAME"
  6. OPTS="$OPTS -pidfile /tmp/$VM_NAME.pid"
  7.  
  8. # Processor
  9. OPTS="$OPTS -cpu host,kvm=off"
  10. OPTS="$OPTS -smp 8,sockets=1,cores=4,threads=2"
  11. OPTS="$OPTS -enable-kvm"
  12.  
  13. # Machine
  14. OPTS="$OPTS -machine type=pc-i440fx-2.1,accel=kvm"
  15. #OPTS="$OPTS -machine type=q35,accel=kvm"
  16.  
  17. # The following setting enables S3 (suspend to RAM). OVMF supports S3
  18. # suspend/resume. Disable when using Q35
  19. OPTS="$OPTS -global PIIX4_PM.disable_s3=0"
  20.  
  21. # Memory
  22. OPTS="$OPTS -m 16G"
  23. OPTS="$OPTS -mem-path /dev/hugepages"
  24. OPTS="$OPTS -mem-prealloc"
  25. OPTS="$OPTS -balloon none"
  26.  
  27. # Hardware clock
  28. OPTS="$OPTS -rtc clock=host,base=utc"
  29.  
  30. # Sound hardware
  31. #QEMU_PA_SAMPLES=128
  32. #export QEMU_AUDIO_DRV=pa
  33. #OPTS="$OPTS -soundhw hda"
  34. export QEMU_AUDIO_DRV=alsa
  35. OPTS="$OPTS -soundhw ac97"
  36.  
  37. # Graphic card passthrough (Gigabyte GeForce GTX 980 G1 Gaming)
  38. OPTS="$OPTS -device vfio-pci,host=03:00.0,multifunction=on"
  39. OPTS="$OPTS -device vfio-pci,host=03:00.1"
  40.  
  41. # USB 3.0 passthrough (NEC/Renesas)
  42. OPTS="$OPTS -device vfio-pci,host=09:00.0"
  43.  
  44. # Keyboard layout
  45. OPTS="$OPTS -k en-us"
  46.  
  47. # Boot priority
  48. OPTS="$OPTS -boot order=c"
  49.  
  50. # OVMF
  51. OPTS="$OPTS -drive if=pflash,format=raw,readonly,file=./ovmf/OVMF_CODE-pure-efi.fd"
  52. OPTS="$OPTS -drive if=pflash,format=raw,file=./ovmf/OVMF_VARS-pure-efi.fd"
  53.  
  54. # System drive
  55. OPTS="$OPTS -drive id=disk0,if=none,cache=unsafe,format=raw,file=./disks/disk0-system.img"
  56. OPTS="$OPTS -device driver=virtio-scsi-pci,id=scsi0"
  57. OPTS="$OPTS -device scsi-hd,drive=disk0"
  58.  
  59. # SUSE Linux Enterprise Server 11 SP3 installer disk 1
  60. OPTS="$OPTS -drive id=cd0,if=none,format=raw,readonly,file=./iso/SLES-11-SP3-DVD-x86_64-GM-DVD1.iso"
  61. OPTS="$OPTS -device driver=ide-cd,bus=ide.0,drive=cd0"
  62.  
  63. # SUSE Linux Enterprise Server 11 SP3 installer disk 2
  64. OPTS="$OPTS -drive id=cd1,if=none,format=raw,readonly,file=./iso/SLES-11-SP3-DVD-x86_64-GM-DVD2.iso"
  65. OPTS="$OPTS -device driver=ide-cd,bus=ide.1,drive=cd1"
  66.  
  67. # OVMF emits a number of info / debug messages to the QEMU debug console, at
  68. # ioport 0x402. We configure qemu so that the debug console is indeed
  69. # available at that ioport. We redirect the host side of the debug console to
  70. # a file.
  71. OPTS="$OPTS -global isa-debugcon.iobase=0x402 -debugcon file:/tmp/$VM_NAME.ovmf.log"
  72.  
  73. # QEMU accepts various commands and queries from the user on the monitor
  74. # interface. Connect the monitor with the qemu process's standard input and
  75. # output.
  76. #OPTS="$OPTS -monitor stdio"
  77. #OPTS="$OPTS -vga qxl"
  78.  
  79. # A USB tablet device in the guest allows for accurate pointer tracking
  80. # between the host and the guest.
  81. OPTS="$OPTS -device piix3-usb-uhci -device usb-tablet"
  82.  
  83. # Network
  84. OPTS="$OPTS -netdev tap,vhost=on,ifname=$VM,id=brlan"
  85. OPTS="$OPTS -device virtio-net-pci,mac=$(/usr/local/bin/qemu-mac-hasher $VM_NAME),netdev=brlan"
  86.  
  87. # Disable display
  88. OPTS="$OPTS -vga none"
  89. OPTS="$OPTS -serial null"
  90. OPTS="$OPTS -parallel null"
  91. OPTS="$OPTS -monitor none"
  92. OPTS="$OPTS -display none"
  93. #OPTS="$OPTS -daemonize"
  94.  
  95. # QEMU Guest Agent
  96. #OPTS="$OPTS -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0"
  97. #OPTS="$OPTS -device virtio-serial"
  98. #OPTS="$OPTS -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"
  99.  
  100. sudo echo "Starting $VM_NAME machine"
  101.  
  102. # Disable Dell U2312HM display
  103. #xrandr --output HDMI1 --off --output HDMI3 --mode 1920x1080 --pos 0x0 --rotate normal
  104.  
  105. # Start SUSE Linux Enterprise Server 11 SP3
  106. sudo taskset -c 0-11 qemu-system-x86_64 $OPTS
  107.  
  108. # Restore Dell U2312HM display
  109. #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