Created
May 5, 2023 08:51
-
-
Save inclyc/12c901f4023e0b4d7ed669e673d6d130 to your computer and use it in GitHub Desktop.
QEMU - Windows 10 startup script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MACHINE_NAME=win10 | |
MACHINE_PATH=$PWD | |
SPICE_LINK=/tmp/vm-spice-$MACHINE_NAME.socket | |
# shellcheck disable=SC2054 | |
qemu_cmd=( | |
qemu-system-x86_64 | |
"$MACHINE_PATH/win10-overlay.qcow2" | |
-name "$MACHINE_NAME" | |
# [ uefi ] | |
-drive "if=pflash,format=raw,readonly=on,file=$MACHINE_PATH/OVMF_CODE.fd" | |
-drive "if=pflash,format=raw,file=$MACHINE_PATH/win10_VARS.fd" | |
# [ cpu ] | |
-accel kvm | |
-cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time | |
-smp | |
8,sockets=1,cores=1,threads=8 | |
# [ memory ] | |
-m 8192 | |
# [ networking ] | |
-nic user,model=virtio-net-pci | |
) | |
# shellcheck disable=SC2054 | |
# [ local-display ] | |
qemu_cmd_local=( | |
# [ audio ] | |
-audiodev pa,id=snd0 | |
-device ich9-intel-hda | |
-device hda-output,audiodev=snd0 | |
# [ display.virtio.sdl ] | |
-device "virtio-vga-gl" | |
-display "sdl,gl=on" | |
# [ bus.usb ] | |
-device usb-ehci,id=ehci | |
-device "usb-host,bus=ehci.0,hostbus=1,hostaddr=6" | |
) | |
# shellcheck disable=SC2054 | |
# [ spice ] | |
qemu_cmd_spice=( | |
# [ audio ] | |
-audiodev spice,id=snd0 | |
-device ich9-intel-hda | |
-device hda-output,audiodev=snd0 | |
# [ connection ] | |
-spice disable-ticketing=on,unix=on,addr="$SPICE_LINK" | |
# [ display ] | |
-vga qxl | |
# [ usbredirect ] | |
-device ich9-usb-ehci1,id=usb | |
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on | |
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2 | |
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4 | |
-chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 | |
-chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 | |
-chardev spicevmc,name=usbredir,id=usbredirchardev3 -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3 | |
) | |
# qemu_cmd+=("${qemu_cmd_spice[@]}") | |
qemu_cmd+=("${qemu_cmd_local[@]}") | |
# qemu_cmd+=("${qemu_cmd_vnc[@]}") | |
"${qemu_cmd[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment