mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Merge branch 'macos'
This commit is contained in:
		
						commit
						485aaed7c7
					
				
					 2 changed files with 197 additions and 42 deletions
				
			
		
							
								
								
									
										75
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										75
									
								
								README.md
									
										
									
									
									
								
							|  | @ -155,6 +155,78 @@ Starting /media/martin/Quickemu/windows10.conf | ||||||
|   * Complete the installation as you normally would. |   * Complete the installation as you normally would. | ||||||
|   * Post-install you should run the VirtIO installer from the CD-ROM: drive. |   * Post-install you should run the VirtIO installer from the CD-ROM: drive. | ||||||
| 
 | 
 | ||||||
|  | ### macOS | ||||||
|  | 
 | ||||||
|  | There are some considerations when running macOS via Quickemu. | ||||||
|  | 
 | ||||||
|  |   * `quickemu` will automatically download the required [Clover EFI bootloader](https://sourceforge.net/projects/cloverefiboot/) and OVMF firmware from [the macOS-Simple-KVM project](https://github.com/foxlet/macOS-Simple-KVM). | ||||||
|  |   * **macOS 10.14.3 or newer is supported**: | ||||||
|  |     * [VirtIO block devices QEMU standard VGA are supported](https://www.kraxel.org/blog/2019/06/macos-qemu-guest/) since macOS 10.14.3 (Mohave). | ||||||
|  |     * [VirtIO `usb-tablet` devices are supported](http://philjordan.eu/osx-virt/) since macOS 10.11 (El Capitan). | ||||||
|  |     * [vmxnet3 network devices are supported](https://github.com/foxlet/macOS-Simple-KVM/blob/master/docs/guide-networking.md) since macOS 10.11 (El Capitan). | ||||||
|  |     * Running macOS on QEMU required the guest CPU is set to `Penryn`. | ||||||
|  |     *   This is a very old architecture, [so to unlock higher CPU performance; AVX, AES-NI, SSE et al are enabled](https://www.nicksherlock.com/2017/10/passthrough-of-advanced-cpu-features-for-macos-high-sierra-guests/). | ||||||
|  |   * UHCI USB (USB 2.0) is the fastest supported. | ||||||
|  |     * USB pass-through has not been tested. | ||||||
|  | 
 | ||||||
|  | You can use `quickemu` to run a macOS virtual machine. | ||||||
|  | 
 | ||||||
|  |   * Download macOS using `fetch-macos.py` | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | wget https://raw.githubusercontent.com/foxlet/macOS-Simple-KVM/master/tools/FetchMacOS/fetch-macos.py -O fetch-macos.py | ||||||
|  | chmod +x fetch-macos.py | ||||||
|  | ./fetch-macos.py | ||||||
|  | qemu-virgil.qemu-img convert BaseSystem/BaseSystem.dmg -O raw BaseSystem.img | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  |   * Create a VM configuration file; for example `macos.conf` | ||||||
|  |     * The `guest_os="macos"` line instructs `quickemu` to use optimise for macOS. | ||||||
|  |     * The `img=` sets the boot disk that you downloaded with `fetch-macos.py` | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | guest_os="macos" | ||||||
|  | img="/media/$USER/Quickemu/macos/BaseSystem.img" | ||||||
|  | disk_img="/media/$USER/Quickemu/macos/macos.qcow2" | ||||||
|  | disk=128G | ||||||
|  | usb_devices=("046d:082d" "046d:085e") | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  |   * Use `quickemu` to start the virtual machine: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | ./quickemu --vm macos.conf | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Which will output something like this: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | Starting macos.conf | ||||||
|  |  - QEMU:     /snap/bin/qemu-virgil v4.2.0 | ||||||
|  |  - BOOT:     EFI | ||||||
|  |  - Guest:    Macos optimised | ||||||
|  |  - Disk:     /media/martin/Quickemu/macos/macos.qcow2 (64G) | ||||||
|  |              Just created, booting from /media/martin/Quickemu/macos/BaseSystem.img | ||||||
|  |  - CPU:      4 Core(s) | ||||||
|  |  - RAM:      4G | ||||||
|  |  - Screen:   1664x936 | ||||||
|  |  - Video:    VGA | ||||||
|  |  - GL:       ON | ||||||
|  |  - Virgil3D: OFF | ||||||
|  |  - Display:  SDL | ||||||
|  |  - smbd:     /home/martin will be exported to the guest via smb://10.0.2.4/qemu | ||||||
|  |  - ssh:      22223/tcp is connected. Login via 'ssh user@localhost -p 22223' | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  |   * Boot from the BaseSystem | ||||||
|  |     * Click **Disk Utility** and **Continue** | ||||||
|  |     * Select `Apple Inc. VirtIO Block Media` that is ~68GB from the list and click **Erase**. | ||||||
|  |     * Enter a `Name:` for the disk and click **Erase**. | ||||||
|  |     * Click **Done**. | ||||||
|  |     * Close Disk Utility | ||||||
|  |     * Click **Reinstall macOS** and **Continue** | ||||||
|  |   * Complete the installation as you normally would. | ||||||
|  | 
 | ||||||
| ### All the options | ### All the options | ||||||
| 
 | 
 | ||||||
| Here are the full usage instructions: | Here are the full usage instructions: | ||||||
|  | @ -184,4 +256,5 @@ You can also pass optional parameters | ||||||
|   - [x] Make display configuration more robust |   - [x] Make display configuration more robust | ||||||
|   - [x] Improve snapshot management |   - [x] Improve snapshot management | ||||||
|   - [x] Improve stdout presentation |   - [x] Improve stdout presentation | ||||||
|   - [x] Make disk image size configurable |   - [x] Make disk image size configurable | ||||||
|  |   - [ ] [Add Faux OEM](# https://code.launchpad.net/~ubuntu-installer/ubiquity/+git/ubiquity/+merge/379899) | ||||||
							
								
								
									
										164
									
								
								quickemu
									
										
									
									
									
								
							
							
						
						
									
										164
									
								
								quickemu
									
										
									
									
									
								
							|  | @ -1,6 +1,18 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
| export LC_ALL=C | export LC_ALL=C | ||||||
| 
 | 
 | ||||||
|  | function web_get() { | ||||||
|  |   local URL="${1}" | ||||||
|  |   local FILE=$(echo "${URL##*/}") | ||||||
|  |   if [ ! -e "${VMDIR}/${FILE}" ]; then | ||||||
|  |     wget -q -c "${URL}" -O "${VMDIR}/${FILE}" | ||||||
|  |     if [ $? -ne 0 ]; then | ||||||
|  |       echo "ERROR! Failed to download ${URL}" | ||||||
|  |       exit 1 | ||||||
|  |     fi | ||||||
|  |   fi | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function disk_delete() { | function disk_delete() { | ||||||
|   if [ -e "${disk_img}" ]; then |   if [ -e "${disk_img}" ]; then | ||||||
|     rm "${disk_img}" |     rm "${disk_img}" | ||||||
|  | @ -113,8 +125,7 @@ enable_usb_passthrough() { | ||||||
|       USB_DEV=$(lsusb -d ${VENDOR_ID}:${PRODUCT_ID} | cut -d' ' -f4 | cut -d':' -f1) |       USB_DEV=$(lsusb -d ${VENDOR_ID}:${PRODUCT_ID} | cut -d' ' -f4 | cut -d':' -f1) | ||||||
|       USB_NAME=$(lsusb -d ${VENDOR_ID}:${PRODUCT_ID} | cut -d' ' -f7-) |       USB_NAME=$(lsusb -d ${VENDOR_ID}:${PRODUCT_ID} | cut -d' ' -f7-) | ||||||
|       echo "              - ${USB_NAME}" |       echo "              - ${USB_NAME}" | ||||||
|       USB_PASSTHROUGH="${USB_PASSTHROUGH} -usb -device usb-host,vendorid=0x${VENDOR_ID},productid=0x${PRODUCT_ID}" |       USB_PASSTHROUGH="${USB_PASSTHROUGH} -device usb-host,vendorid=0x${VENDOR_ID},productid=0x${PRODUCT_ID},bus=usb.0" | ||||||
|        |  | ||||||
|       if [ ! -w /dev/bus/usb/${USB_BUS}/${USB_DEV} ]; then |       if [ ! -w /dev/bus/usb/${USB_BUS}/${USB_DEV} ]; then | ||||||
|         local EXEC_SCRIPT=1 |         local EXEC_SCRIPT=1 | ||||||
|         echo "chown root:${USER} /dev/bus/usb/${USB_BUS}/${USB_DEV}" >> "${TEMP_SCRIPT}" |         echo "chown root:${USER} /dev/bus/usb/${USB_BUS}/${USB_DEV}" >> "${TEMP_SCRIPT}" | ||||||
|  | @ -156,12 +167,26 @@ function vm_boot() { | ||||||
| 
 | 
 | ||||||
|   # Force to lowercase. |   # Force to lowercase. | ||||||
|   boot=$(echo ${boot,,}) |   boot=$(echo ${boot,,}) | ||||||
|  | 
 | ||||||
|  |   # A;ways Boot macOS using EFI | ||||||
|  |   if [ "${guest_os}" == "macos" ]; then | ||||||
|  |     boot="efi" | ||||||
|  |   fi | ||||||
|  | 
 | ||||||
|   if [ "${boot}" == "efi" ] || [ "${boot}" == "uefi" ]; then |   if [ "${boot}" == "efi" ] || [ "${boot}" == "uefi" ]; then | ||||||
|     if [ -e "${VIRGIL_PATH}/usr/share/qemu/edk2-x86_64-code.fd" ] ; then |     if [ -e "${VIRGIL_PATH}/usr/share/qemu/edk2-x86_64-code.fd" ] ; then | ||||||
|       local EFI_CODE="${VIRGIL_PATH}/usr/share/qemu/edk2-x86_64-code.fd" |       if [ "${guest_os}" == "macos" ]; then | ||||||
|       local EFI_VARS="${VMDIR}/${VMNAME}-vars.fd" |         web_get "https://github.com/foxlet/macOS-Simple-KVM/raw/master/ESP.qcow2" | ||||||
|       if [ ! -e "${EFI_VARS}" ]; then |         web_get "https://github.com/foxlet/macOS-Simple-KVM/raw/master/firmware/OVMF_CODE.fd" | ||||||
|         cp "${VIRGIL_PATH}/usr/share/qemu/edk2-i386-vars.fd" "${EFI_VARS}" |         web_get "https://github.com/foxlet/macOS-Simple-KVM/raw/master/firmware/OVMF_VARS-1024x768.fd" | ||||||
|  |         local EFI_CODE="${VMDIR}/OVMF_CODE.fd" | ||||||
|  |         local EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd" | ||||||
|  |       else | ||||||
|  |         local EFI_CODE="${VIRGIL_PATH}/usr/share/qemu/edk2-x86_64-code.fd" | ||||||
|  |         local EFI_VARS="${VMDIR}/${VMNAME}-vars.fd" | ||||||
|  |         if [ ! -e "${EFI_VARS}" ]; then | ||||||
|  |           cp "${VIRGIL_PATH}/usr/share/qemu/edk2-i386-vars.fd" "${EFI_VARS}" | ||||||
|  |         fi | ||||||
|       fi |       fi | ||||||
|       echo " - BOOT:     EFI" |       echo " - BOOT:     EFI" | ||||||
|     else |     else | ||||||
|  | @ -179,6 +204,14 @@ function vm_boot() { | ||||||
|     linux) |     linux) | ||||||
|       DISPLAY_DEVICE="virtio-vga" |       DISPLAY_DEVICE="virtio-vga" | ||||||
|       ;; |       ;; | ||||||
|  |     macos) | ||||||
|  |       CPU="-cpu Penryn,vendor=GenuineIntel,kvm=on,+aes,+avx,+avx2,+bmi1,+bmi2,+fma,+invtsc,+movbe,+pcid,+smep,+sse3,+sse4.2,+xgetbv1,+xsave,+xsavec,+xsaveopt" | ||||||
|  |       readonly ROT_OSK="bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | ||||||
|  |       readonly OSK=$(echo ${ROT_OSK} | rot13) | ||||||
|  |       GUEST_TWEAKS="-device isa-applesmc,osk=${OSK}" | ||||||
|  |       DISPLAY_DEVICE="VGA" | ||||||
|  |       VIRGL="off" | ||||||
|  |       ;; | ||||||
|     windows) |     windows) | ||||||
|       CPU="${CPU},hv_time" |       CPU="${CPU},hv_time" | ||||||
|       GUEST_TWEAKS="-no-hpet" |       GUEST_TWEAKS="-no-hpet" | ||||||
|  | @ -200,11 +233,11 @@ function vm_boot() { | ||||||
|         echo "ERROR! Failed to create ${disk_img}" |         echo "ERROR! Failed to create ${disk_img}" | ||||||
|         exit 1 |         exit 1 | ||||||
|       fi |       fi | ||||||
|       if [ -z "${iso}" ]; then |       if [ -z "${iso}" ] && [ -z "${img}" ]; then | ||||||
|         echo "ERROR! You haven't specified a .iso image to boot from." |         echo "ERROR! You haven't specified a .iso or .img image to boot from." | ||||||
|         exit 1 |         exit 1 | ||||||
|       fi |       fi | ||||||
|       echo "             Just created, booting from ${iso}" |       echo "             Just created, booting from ${iso}${img}" | ||||||
|     if [ $? -ne 0 ]; then |     if [ $? -ne 0 ]; then | ||||||
|       echo "ERROR! Failed to create ${disk_img} of ${disk}. Stopping here." |       echo "ERROR! Failed to create ${disk_img} of ${disk}. Stopping here." | ||||||
|       exit 1 |       exit 1 | ||||||
|  | @ -218,15 +251,16 @@ function vm_boot() { | ||||||
|     else |     else | ||||||
|       DISK_CURR_SIZE=$(stat -c%s "${disk_img}") |       DISK_CURR_SIZE=$(stat -c%s "${disk_img}") | ||||||
|       if [ ${DISK_CURR_SIZE} -le ${DISK_MIN_SIZE} ]; then |       if [ ${DISK_CURR_SIZE} -le ${DISK_MIN_SIZE} ]; then | ||||||
|         echo "             Looks unused, booting from ${iso}" |         echo "             Looks unused, booting from ${iso}${img}" | ||||||
|         if [ -z "${iso}" ]; then |         if [ -z "${iso}" ] && [ -z "${img}" ]; then | ||||||
|           echo "ERROR! You haven't specified a .iso image to boot from." |           echo "ERROR! You haven't specified a .iso or .img image to boot from." | ||||||
|           exit 1 |           exit 1 | ||||||
|         fi |         fi | ||||||
|       else |       else | ||||||
|         # If there is a disk image, that appears to have an install |         # If there is a disk image, that appears to have an install | ||||||
|         # then do not boot from the iso |         # then do not boot from the iso/img | ||||||
|         iso="" |         iso="" | ||||||
|  |         img="" | ||||||
|       fi |       fi | ||||||
|     fi |     fi | ||||||
|   fi |   fi | ||||||
|  | @ -251,6 +285,7 @@ function vm_boot() { | ||||||
|   elif [ ${CORES_HOST} -ge 4 ]; then |   elif [ ${CORES_HOST} -ge 4 ]; then | ||||||
|     CORES_VM="2" |     CORES_VM="2" | ||||||
|   fi |   fi | ||||||
|  |   local SMP="-smp ${CORES_VM},sockets=1,cores=${CORES_VM},threads=1" | ||||||
|   echo " - CPU:      ${CORES_VM} Core(s)" |   echo " - CPU:      ${CORES_VM} Core(s)" | ||||||
| 
 | 
 | ||||||
|   local RAM_VM="2G" |   local RAM_VM="2G" | ||||||
|  | @ -296,7 +331,7 @@ function vm_boot() { | ||||||
|   elif [ "${DISPLAY_DEVICE}" == "virtio-vga" ]; then |   elif [ "${DISPLAY_DEVICE}" == "virtio-vga" ]; then | ||||||
|     VIDEO="-device ${DISPLAY_DEVICE},virgl=${VIRGL},xres=${X_RES},yres=${Y_RES}" |     VIDEO="-device ${DISPLAY_DEVICE},virgl=${VIRGL},xres=${X_RES},yres=${Y_RES}" | ||||||
|   else |   else | ||||||
|     VIDEO=" -device VGA,vgamem_mb=32,xres=${X_RES},yres=${Y_RES}" |     VIDEO="-device VGA,vgamem_mb=128,xres=${X_RES},yres=${Y_RES}" | ||||||
|   fi |   fi | ||||||
| 
 | 
 | ||||||
|   echo " - Video:    ${DISPLAY_DEVICE}" |   echo " - Video:    ${DISPLAY_DEVICE}" | ||||||
|  | @ -331,43 +366,89 @@ function vm_boot() { | ||||||
| 
 | 
 | ||||||
|   # Boot the iso image |   # Boot the iso image | ||||||
|   if [ "${boot}" == "efi" ] || [ "${boot}" == "uefi" ]; then |   if [ "${boot}" == "efi" ] || [ "${boot}" == "uefi" ]; then | ||||||
|     ${QEMU} \ |     if [ "${guest_os}" == "macos" ]; then | ||||||
|       -name ${VMNAME},process=${VMNAME} \ |       if [ -z "${img}" ]; then | ||||||
|       -enable-kvm -machine q35 ${GUEST_TWEAKS} \ |         ${QEMU} \ | ||||||
|       ${CPU} -smp ${CORES_VM} \ |           -name ${VMNAME},process=${VMNAME} \ | ||||||
|       -m ${RAM_VM} -device virtio-balloon \ |           -enable-kvm -machine q35 ${GUEST_TWEAKS} \ | ||||||
|       -drive if=pflash,format=raw,readonly,file="${EFI_CODE}" \ |           ${CPU} ${SMP} \ | ||||||
|       -drive if=pflash,format=raw,file="${EFI_VARS}" \ |           -m ${RAM_VM} -device virtio-balloon \ | ||||||
|       -drive media=cdrom,index=0,file="${iso}" \ |           -drive if=pflash,format=raw,readonly,file="${EFI_CODE}" \ | ||||||
|       -drive media=cdrom,index=1,file="${driver_iso}" \ |           -drive if=pflash,format=raw,file="${EFI_VARS}" \ | ||||||
|       -drive if=none,id=drive0,cache=directsync,aio=native,format=qcow2,file="${disk_img}" \ |           -drive id=ESP,cache=directsync,aio=native,if=none,format=qcow2,file="${VMDIR}/ESP.qcow2" \ | ||||||
|       -device virtio-blk-pci,drive=drive0,scsi=off ${STATUS_QUO} \ |           -device virtio-blk-pci,drive=ESP,scsi=off \ | ||||||
|       ${VIDEO} -display ${OUTPUT},gl=${GL}${OUTPUT_EXTRA} \ |           -drive id=SystemDisk,cache=directsync,aio=native,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO} \ | ||||||
|       -device qemu-xhci,id=xhci,p2=8,p3=8 -device usb-kbd,bus=xhci.0 -device usb-tablet,bus=xhci.0 ${USB_PASSTHROUGH} \ |           -device virtio-blk-pci,drive=SystemDisk,scsi=off \ | ||||||
|       -device virtio-net,netdev=nic -netdev ${NET},id=nic \ |           ${VIDEO} -display ${OUTPUT},gl=${GL}${OUTPUT_EXTRA} \ | ||||||
|       -audiodev pa,id=pa,server=unix:${XDG_RUNTIME_DIR}/pulse/native,out.stream-name=${LAUNCHER}-${VMNAME},in.stream-name=${LAUNCHER}-${VMNAME} \ |           -device usb-ehci,id=usb -device usb-kbd,bus=usb.0 -device usb-tablet,bus=usb.0 ${USB_PASSTHROUGH} \ | ||||||
|       -device intel-hda -device hda-duplex,audiodev=pa,mixer=off \ |           -device vmxnet3,netdev=nic -netdev ${NET},id=nic \ | ||||||
|       -rtc base=localtime,clock=host \ |           -audiodev pa,id=pa,server=unix:${XDG_RUNTIME_DIR}/pulse/native,out.stream-name=${LAUNCHER}-${VMNAME},in.stream-name=${LAUNCHER}-${VMNAME} \ | ||||||
|       -object rng-random,id=rng0,filename=/dev/urandom \ |           -device intel-hda -device hda-duplex,audiodev=pa,mixer=off \ | ||||||
|       -device virtio-rng-pci,rng=rng0 \ |           -rtc base=localtime,clock=host \ | ||||||
|       -spice port=5930,disable-ticketing \ |           -serial mon:stdio \ | ||||||
|       -device virtio-serial-pci \ |           "${@}" | ||||||
|       -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \ |       else | ||||||
|       -chardev spicevmc,id=spicechannel0,name=vdagent \ |         ${QEMU} \ | ||||||
|       -serial mon:stdio \ |           -name ${VMNAME},process=${VMNAME} \ | ||||||
|       "${@}" |           -enable-kvm -machine q35 ${GUEST_TWEAKS} \ | ||||||
|  |           ${CPU} ${SMP} \ | ||||||
|  |           -m ${RAM_VM} -device virtio-balloon \ | ||||||
|  |           -drive if=pflash,format=raw,readonly,file="${EFI_CODE}" \ | ||||||
|  |           -drive if=pflash,format=raw,file="${EFI_VARS}" \ | ||||||
|  |           -drive id=ESP,cache=directsync,aio=native,if=none,format=qcow2,file="${VMDIR}/ESP.qcow2" \ | ||||||
|  |           -device virtio-blk-pci,drive=ESP,scsi=off \ | ||||||
|  |           -drive id=InstallMedia,cache=directsync,aio=native,if=none,format=raw,readonly,file="${img}" \ | ||||||
|  |           -device virtio-blk-pci,drive=InstallMedia,scsi=off \ | ||||||
|  |           -drive id=SystemDisk,cache=directsync,aio=native,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO} \ | ||||||
|  |           -device virtio-blk-pci,drive=SystemDisk,scsi=off \ | ||||||
|  |           ${VIDEO} -display ${OUTPUT},gl=${GL}${OUTPUT_EXTRA} \ | ||||||
|  |           -device usb-ehci,id=usb -device usb-kbd,bus=usb.0 -device usb-tablet,bus=usb.0 ${USB_PASSTHROUGH} \ | ||||||
|  |           -device vmxnet3,netdev=nic -netdev ${NET},id=nic \ | ||||||
|  |           -audiodev pa,id=pa,server=unix:${XDG_RUNTIME_DIR}/pulse/native,out.stream-name=${LAUNCHER}-${VMNAME},in.stream-name=${LAUNCHER}-${VMNAME} \ | ||||||
|  |           -device intel-hda -device hda-duplex,audiodev=pa,mixer=off \ | ||||||
|  |           -rtc base=localtime,clock=host \ | ||||||
|  |           -serial mon:stdio \ | ||||||
|  |           "${@}" | ||||||
|  |         fi | ||||||
|  |     else | ||||||
|  |       ${QEMU} \ | ||||||
|  |         -name ${VMNAME},process=${VMNAME} \ | ||||||
|  |         -enable-kvm -machine q35 ${GUEST_TWEAKS} \ | ||||||
|  |         ${CPU} ${SMP} \ | ||||||
|  |         -m ${RAM_VM} -device virtio-balloon \ | ||||||
|  |         -drive if=pflash,format=raw,readonly,file="${EFI_CODE}" \ | ||||||
|  |         -drive if=pflash,format=raw,file="${EFI_VARS}" \ | ||||||
|  |         -drive media=cdrom,index=0,file="${iso}" \ | ||||||
|  |         -drive media=cdrom,index=1,file="${driver_iso}" \ | ||||||
|  |         -drive if=none,id=drive0,cache=directsync,aio=native,format=qcow2,file="${disk_img}" \ | ||||||
|  |         -device virtio-blk-pci,drive=drive0,scsi=off ${STATUS_QUO} \ | ||||||
|  |         ${VIDEO} -display ${OUTPUT},gl=${GL}${OUTPUT_EXTRA} \ | ||||||
|  |         -device qemu-xhci,id=usb,p2=8,p3=8 -device usb-kbd,bus=usb.0 -device usb-tablet,bus=usb.0 ${USB_PASSTHROUGH} \ | ||||||
|  |         -device virtio-net,netdev=nic -netdev ${NET},id=nic \ | ||||||
|  |         -audiodev pa,id=pa,server=unix:${XDG_RUNTIME_DIR}/pulse/native,out.stream-name=${LAUNCHER}-${VMNAME},in.stream-name=${LAUNCHER}-${VMNAME} \ | ||||||
|  |         -device intel-hda -device hda-duplex,audiodev=pa,mixer=off \ | ||||||
|  |         -rtc base=localtime,clock=host \ | ||||||
|  |         -object rng-random,id=rng0,filename=/dev/urandom \ | ||||||
|  |         -device virtio-rng-pci,rng=rng0 \ | ||||||
|  |         -spice port=5930,disable-ticketing \ | ||||||
|  |         -device virtio-serial-pci \ | ||||||
|  |         -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \ | ||||||
|  |         -chardev spicevmc,id=spicechannel0,name=vdagent \ | ||||||
|  |         -serial mon:stdio \ | ||||||
|  |         "${@}" | ||||||
|  |       fi | ||||||
|   else |   else | ||||||
|     ${QEMU} \ |     ${QEMU} \ | ||||||
|       -name ${VMNAME},process=${VMNAME} \ |       -name ${VMNAME},process=${VMNAME} \ | ||||||
|       -enable-kvm -machine q35 ${GUEST_TWEAKS} \ |       -enable-kvm -machine q35 ${GUEST_TWEAKS} \ | ||||||
|       ${CPU} -smp ${CORES_VM} \ |       ${CPU} ${SMP} \ | ||||||
|       -m ${RAM_VM} -device virtio-balloon \ |       -m ${RAM_VM} -device virtio-balloon \ | ||||||
|       -drive media=cdrom,index=0,file="${iso}" \ |       -drive media=cdrom,index=0,file="${iso}" \ | ||||||
|       -drive media=cdrom,index=1,file="${driver_iso}" \ |       -drive media=cdrom,index=1,file="${driver_iso}" \ | ||||||
|       -drive if=none,id=drive0,cache=directsync,aio=native,format=qcow2,file="${disk_img}" \ |       -drive if=none,id=drive0,cache=directsync,aio=native,format=qcow2,file="${disk_img}" \ | ||||||
|       -device virtio-blk-pci,drive=drive0,scsi=off ${STATUS_QUO} \ |       -device virtio-blk-pci,drive=drive0,scsi=off ${STATUS_QUO} \ | ||||||
|       ${VIDEO} -display ${OUTPUT},gl=${GL}${OUTPUT_EXTRA} \ |       ${VIDEO} -display ${OUTPUT},gl=${GL}${OUTPUT_EXTRA} \ | ||||||
|       -device qemu-xhci,id=xhci,p2=8,p3=8 -device usb-kbd,bus=xhci.0 -device usb-tablet,bus=xhci.0 ${USB_PASSTHROUGH} \ |       -device qemu-xhci,id=usb,p2=8,p3=8 -device usb-kbd,bus=usb.0 -device usb-tablet,bus=usb.0 ${USB_PASSTHROUGH} \ | ||||||
|       -device virtio-net,netdev=nic -netdev ${NET},id=nic \ |       -device virtio-net,netdev=nic -netdev ${NET},id=nic \ | ||||||
|       -audiodev pa,id=pa,server=unix:${XDG_RUNTIME_DIR}/pulse/native,out.stream-name=${LAUNCHER}-${VMNAME},in.stream-name=${LAUNCHER}-${VMNAME} \ |       -audiodev pa,id=pa,server=unix:${XDG_RUNTIME_DIR}/pulse/native,out.stream-name=${LAUNCHER}-${VMNAME},in.stream-name=${LAUNCHER}-${VMNAME} \ | ||||||
|       -device intel-hda -device hda-duplex,audiodev=pa,mixer=off \ |       -device intel-hda -device hda-duplex,audiodev=pa,mixer=off \ | ||||||
|  | @ -418,6 +499,7 @@ function usage() { | ||||||
| # Lowercase variables are used in the VM config file only | # Lowercase variables are used in the VM config file only | ||||||
| boot="legacy" | boot="legacy" | ||||||
| guest_os="linux" | guest_os="linux" | ||||||
|  | img="" | ||||||
| iso="" | iso="" | ||||||
| driver_iso="" | driver_iso="" | ||||||
| disk_img="" | disk_img="" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue