mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Add macos_release VM configuration variable. Tune macOS based on release
Tune Qemu optimisations based on the macOS release, or fallback to lowest common supported options if macos_release is not specified.
This commit is contained in:
		
							parent
							
								
									c240a17bda
								
							
						
					
					
						commit
						561d04a2b5
					
				
					 3 changed files with 47 additions and 19 deletions
				
			
		
							
								
								
									
										12
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
										
									
									
									
								
							|  | @ -162,9 +162,13 @@ The default macOS configuration looks like this: | ||||||
| guest_os="macos" | guest_os="macos" | ||||||
| img="macos-big-sur/RecoveryImage.img" | img="macos-big-sur/RecoveryImage.img" | ||||||
| disk_img="macos-big-sur/disk.qcow2" | disk_img="macos-big-sur/disk.qcow2" | ||||||
|  | macos_release="big-sur" | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|   * The `guest_os="macos"` line instructs Quickemu to optimise for macOS. |   * The `guest_os="macos"` line instructs Quickemu to optimise for macOS. | ||||||
|  |   * The `macos_release="big-sur"` line instructs Quickemu to optimise for a particular macOS release. | ||||||
|  |     * For example VirtIO Network and Memory Ballooning are available in Big Sir, but not previous releases. | ||||||
|  |     * And VirtIO Block Media (disks) are supported/stable in Catalina and newer. | ||||||
|   * If you want to disable VirtIO Block Media and use SATA emulation add `virtio_blk="off"` to your configuration. |   * If you want to disable VirtIO Block Media and use SATA emulation add `virtio_blk="off"` to your configuration. | ||||||
|     * `quickget` disables VirtIO Block Media for High Sierra and Mojave by default since it is not supported on those releases. |     * `quickget` disables VirtIO Block Media for High Sierra and Mojave by default since it is not supported on those releases. | ||||||
| 
 | 
 | ||||||
|  | @ -181,10 +185,12 @@ There are some considerations when running macOS via Quickemu. | ||||||
|     * Big Sur |     * Big Sur | ||||||
|   * Optimised by default |   * Optimised by default | ||||||
|     * Host CPU vendor is detected and guest CPU is optimised accordingly. |     * Host CPU vendor is detected and guest CPU is optimised accordingly. | ||||||
|     * [VirtIO block device](https://www.kraxel.org/blog/2019/06/macos-qemu-guest/) is used for the system disk where supported. |     * [VirtIO Block Media](https://www.kraxel.org/blog/2019/06/macos-qemu-guest/) is used for the system disk where supported. | ||||||
|     * [VirtIO `usb-tablet`](http://philjordan.eu/osx-virt/) is used for the mouse. |     * [VirtIO `usb-tablet`](http://philjordan.eu/osx-virt/) is used for the mouse. | ||||||
|     * `vmxnet3` network device is used. |     * VirtIO Network (`virtio-net`) is supported and enabled on macOS Big Sur but previous releases use `vmxnet3`. | ||||||
|   * USB host pass-through is limited to UHCI (USB 2.0). |     * VirtIO Memory Ballooning is supported and enabled on macOS Big Sur but disabled for other support macOS releases. | ||||||
|  |   * USB host pass-through is limited to UHCI (USB 2.0) on macOS Catalina and earlier. | ||||||
|  |     * macOS Big Sur support XHCI (USB 3.0) host-passthrough. | ||||||
|   * Display resolution can only be changed via macOS System Preferences. |   * Display resolution can only be changed via macOS System Preferences. | ||||||
|   * macOS Big Sur has no audio, but Full Duplex audio works on macOS Catalina is previous releases. |   * macOS Big Sur has no audio, but Full Duplex audio works on macOS Catalina is previous releases. | ||||||
|   * File sharing between guest and host is available via [virtio-9p](https://wiki.qemu.org/Documentation/9psetup). |   * File sharing between guest and host is available via [virtio-9p](https://wiki.qemu.org/Documentation/9psetup). | ||||||
|  |  | ||||||
							
								
								
									
										45
									
								
								quickemu
									
										
									
									
									
								
							
							
						
						
									
										45
									
								
								quickemu
									
										
									
									
									
								
							|  | @ -137,6 +137,7 @@ function vm_boot() { | ||||||
|   local GUEST_TWEAKS="" |   local GUEST_TWEAKS="" | ||||||
|   local HOST_CPU="" |   local HOST_CPU="" | ||||||
|   local MAC_MISSING="" |   local MAC_MISSING="" | ||||||
|  |   local MAC_VIRTIO_BLK="ide-hd,bus=ahci.2" | ||||||
|   local NET_DEVICE="virtio-net" |   local NET_DEVICE="virtio-net" | ||||||
|   local OSK="" |   local OSK="" | ||||||
|   local QEMU_VER="" |   local QEMU_VER="" | ||||||
|  | @ -205,7 +206,6 @@ function vm_boot() { | ||||||
|       disk="16G" |       disk="16G" | ||||||
|       ;; |       ;; | ||||||
|     macos) |     macos) | ||||||
|       BALLOON="" |  | ||||||
|       #https://www.nicksherlock.com/2020/06/installing-macos-big-sur-on-proxmox/ |       #https://www.nicksherlock.com/2020/06/installing-macos-big-sur-on-proxmox/ | ||||||
|       if [ "${HOST_CPU}" == "AuthenticIntel" ]; then |       if [ "${HOST_CPU}" == "AuthenticIntel" ]; then | ||||||
|         CPU="-cpu host,kvm=on,vendor=GenuineIntel,+hypervisor,+invtsc,+kvm_pv_eoi,+kvm_pv_unhalt" |         CPU="-cpu host,kvm=on,vendor=GenuineIntel,+hypervisor,+invtsc,+kvm_pv_eoi,+kvm_pv_unhalt" | ||||||
|  | @ -219,8 +219,36 @@ function vm_boot() { | ||||||
|       OSK=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | tr 'A-Za-z' 'N-ZA-Mn-za-m') |       OSK=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | tr 'A-Za-z' 'N-ZA-Mn-za-m') | ||||||
|       GUEST_TWEAKS="-device isa-applesmc,osk=${OSK} -global kvm-pit.lost_tick_policy=discard" |       GUEST_TWEAKS="-device isa-applesmc,osk=${OSK} -global kvm-pit.lost_tick_policy=discard" | ||||||
|       disk="64G" |       disk="64G" | ||||||
|       NET_DEVICE="vmxnet3" | 
 | ||||||
|       USB_HOST_PASSTHROUGH_CONTROLLER="usb-ehci" |       # Tune Qemu optimisations based on the macOS release, or fallback to lowest | ||||||
|  |       # common supported options if none is specificed. | ||||||
|  |       #   * VirtIO Block Media doesn't work in High Sierra or Mojave | ||||||
|  |       #   * VirtIO Network is supported in Big Sur | ||||||
|  |       #   * VirtIO Memory Balloning is supported in Big Sur (https://pmhahn.github.io/virtio-balloon/) | ||||||
|  |       #   * VirtIO RNG is supported in Big Sur, but exposed to all guests. | ||||||
|  |       case ${macos_release} in | ||||||
|  |           catalina) | ||||||
|  |             BALLOON="" | ||||||
|  |             MAC_DISK_DEV="virtio-blk-pci" | ||||||
|  |             NET_DEVICE="vmxnet3" | ||||||
|  |             USB_HOST_PASSTHROUGH_CONTROLLER="usb-ehci" | ||||||
|  |             ;; | ||||||
|  |           big-sur) | ||||||
|  |             BALLOON="-device virtio-balloon" | ||||||
|  |             MAC_DISK_DEV="virtio-blk-pci" | ||||||
|  |             NET_DEVICE="virtio-net" | ||||||
|  |             USB_HOST_PASSTHROUGH_CONTROLLER="qemu-xhci" | ||||||
|  |             ;; | ||||||
|  |           *) | ||||||
|  |             # Backwards compatibility if no macos_release is specified. | ||||||
|  |             # Also safe catch all for High Sierra and Mojave | ||||||
|  |             BALLOON="" | ||||||
|  |             MAC_DISK_DEV="ide-hd,bus=ahci.2" | ||||||
|  |             NET_DEVICE="vmxnet3" | ||||||
|  |             USB_HOST_PASSTHROUGH_CONTROLLER="usb-ehci" | ||||||
|  |             ;; | ||||||
|  |       esac | ||||||
|  | 
 | ||||||
|       ;; |       ;; | ||||||
|     windows) |     windows) | ||||||
|       CPU="-cpu host,kvm=on,+hypervisor,+invtsc,l3-cache=on,migratable=no,hv_frequencies,kvm_pv_unhalt,hv_reenlightenment,hv_relaxed,hv_spinlocks=8191,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vendor_id=1234567890ab,hv_vpindex" |       CPU="-cpu host,kvm=on,+hypervisor,+invtsc,l3-cache=on,migratable=no,hv_frequencies,kvm_pv_unhalt,hv_reenlightenment,hv_relaxed,hv_spinlocks=8191,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vendor_id=1234567890ab,hv_vpindex" | ||||||
|  | @ -556,13 +584,9 @@ function vm_boot() { | ||||||
|              -drive id=RecoveryImage,if=none,format=raw,file="${img}",cache=none,aio=native) |              -drive id=RecoveryImage,if=none,format=raw,file="${img}",cache=none,aio=native) | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|     # shellcheck disable=SC2054 |  | ||||||
|     case ${virtio_blk} in |  | ||||||
|       off) args+=(-device ide-hd,bus=ahci.2,drive=SystemDisk);; |  | ||||||
|       on)  args+=(-device virtio-blk-pci,drive=SystemDisk);; |  | ||||||
|     esac |  | ||||||
|     # shellcheck disable=SC2054,SC2206 |     # shellcheck disable=SC2054,SC2206 | ||||||
|     args+=(-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",cache=none,aio=native ${STATUS_QUO}) |     args+=(-device ${MAC_DISK_DEV},drive=SystemDisk | ||||||
|  |            -drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",cache=none,aio=native ${STATUS_QUO}) | ||||||
|   else |   else | ||||||
|     # shellcheck disable=SC2054,SC2206 |     # shellcheck disable=SC2054,SC2206 | ||||||
|     args+=(-device virtio-blk-pci,drive=SystemDisk |     args+=(-device virtio-blk-pci,drive=SystemDisk | ||||||
|  | @ -656,11 +680,12 @@ floppy="" | ||||||
| guest_os="linux" | guest_os="linux" | ||||||
| img="" | img="" | ||||||
| iso="" | iso="" | ||||||
|  | macos_release="" | ||||||
| port_forwards=() | port_forwards=() | ||||||
| preallocation="metadata" | preallocation="metadata" | ||||||
| ram="" | ram="" | ||||||
| usb_devices=() | usb_devices=() | ||||||
| virtio_blk="on" | 
 | ||||||
| 
 | 
 | ||||||
| DELETE=0 | DELETE=0 | ||||||
| FULLSCREEN="" | FULLSCREEN="" | ||||||
|  |  | ||||||
							
								
								
									
										9
									
								
								quickget
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								quickget
									
										
									
									
									
								
							|  | @ -148,12 +148,9 @@ EOF | ||||||
|             echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf" |             echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf" | ||||||
|         fi |         fi | ||||||
| 
 | 
 | ||||||
|         # VirtIO Block Media doesn't work in High Sierra or Mojave so use SATA |         if [ "${OS}" == "macos" ]; then | ||||||
|         case ${RELEASE} in |             echo "macos_release=\"${RELEASE}\"" >> "${OS}-${RELEASE}.conf" | ||||||
|             high-sierra|mojave) |         fi | ||||||
|                 echo "virtio_blk=\"off\"" >> "${OS}-${RELEASE}.conf" |  | ||||||
|                 ;; |  | ||||||
|         esac |  | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue