@echo off rem QEMU Starting Script for an AMD64 VM rem rem Author: Andrea Allievi rem Last revision: 03/27/2023 rem setlocal enableextensions set EXECUTABLE=qemu-system-x86_64.exe rem Emulate 4 processors machine with 4 GB of RAM: set MACHINE=-m 4G -smp 4 rem The following line set up a emulated QEMU VM (compatible with KDNET) rem Note that you can replace “tcg” with “hax” or “whpx” for full speed support. set CPU=-machine q35 -cpu max,hypervisor=on,hv-time,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff -accel tcg rem Add the UEFI firmware: set BIOS=-drive file="share\edk2-x86_64-code.fd",if=pflash,format=raw,readonly=on set BIOS=%BIOS% -drive file="share\edk2-i386-vars.fd",if=pflash,format=raw,readonly=off rem rem Add the QXL high resolution graphic card (requires drivers) rem Add also support for VNC (note that you can use " vnc=:X" to start a VNC server on port 590X) rem set GFX=-display gtk -vga qxl -display vnc=:5 rem Add USB keyboard and mouse set USB_CTRL=-device usb-ehci,id=usbctrl set KEYB_MOUSE=-device usb-kbd -device usb-tablet rem rem Add an AHCI controller for the Virtual Hard Disk (and the disk itself): rem Note that, differently than VirtIo, no external drivers are required. rem set DRIVE0="-device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0" rem set DRIVE0=-device virtio-blk-pci,drive=hd0 set DISK0=-drive id=disk,file="",if=none rem The following line uses a standard IDE Disk controller instead (no drivers required) rem DISK0="-drive file="",if=ide" rem Add a CDROM (not mandatory) rem set CDROM=-cdrom "" set CDROM= rem Add the Intel network controller, and forward the TCP port 3389 on 53389 (for RDP) set NETHOST=-netdev user,id=net0,hostfwd=tcp::53389-:3389 set NETGUEST=-device virtio-net-pci,netdev=net0,disable-legacy=on set FULL_COMMAND=%EXECUTABLE% %MACHINE% %CPU% %BIOS% %MONITOR% %SERIAL% %GFX% %USB_CTRL% %DRIVE0% %DISK0% %CDROM% %KEYB_MOUSE% %NETHOST% %NETGUEST% rem Uncomment the following line to see the complete QEMU command: rem echo Full command: %FULL_COMMAND% %FULL_COMMAND%