@echo off Setlocal EnableDelayedExpansion SET GTK_CSD=0 SET qemu_path=%~dp0 IF "%qemu_exec%"=="" ( SET "qemu_exec=!qemu_path!qemu-system-x86_64.exe" ) IF "%qemu_cpu%"=="" ( SET "qemu_cpu=kvm64" ) IF "%qemu_ram%"=="" ( SET "qemu_ram=256" ) IF "%qemu_accel%"=="" ( SET "qemu_accel=whpx" ) IF "%qemu_cores%"=="" ( SET "qemu_cores=1" ) SET "qemu_opts=-accel !qemu_accel! -cpu !qemu_cpu! -m !qemu_ram! -smp %qemu_cores%" SET "qemu_opts=!qemu_opts! -device pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f" SET "qemu_opts=!qemu_opts! -device pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e" SET "qemu_opts=!qemu_opts! -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2" SET "qemu_opts=!qemu_opts! -device usb-tablet,id=tablet,bus=uhci.0,port=1" SET "qemu_opts=!qemu_opts! -device VGA,id=vga,bus=pci.0,addr=0x2" SET "qemu_opts=!qemu_opts! -device virtio-scsi-pci,id=scsi0" IF NOT "%qemu_serialport%"=="" ( SET "qemu_opts=!qemu_opts! -serial %qemu_serialport%" ) IF NOT "%qemu_isofile%"=="" ( IF "%qemu_bootindexcd%"=="" ( SET "qemu_bootindexcd=100" ) SET "qemu_opts=!qemu_opts! -drive file=%qemu_isofile%,if=none,id=idecd0,media=cdrom,aio=threads" SET "qemu_opts=!qemu_opts! -device ide-cd,bus=ide.1,unit=0,drive=idecd0,id=idecd0.0,bootindex=!qemu_bootindexcd!" ) IF NOT "%qemu_disk1%"=="" ( IF "%qemu_bootindexdisk1%"=="" ( SET "qemu_bootindexdisk1=200" ) IF "%qemu_disk1options%"=="" ( SET "qemu_disk1options=cache=writeback,aio=native" ) IF "%qemu_disk1format%"=="" ( FOR %%i IN ("%qemu_disk1%") DO ( SET "qemu_disk1format=%%~xi" SET "qemu_disk1format=!qemu_disk1format:.=!" ) ) SET "qemu_opts=!qemu_opts! -drive file="%qemu_disk1%",if=none,format=!qemu_disk1format!,id=scsidisk0,!qemu_disk1options!" SET "qemu_opts=!qemu_opts! -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=scsidisk0,id=scsidisk0.0,bootindex=!qemu_bootindexdisk1!" ) IF NOT "%qemu_disk2%"=="" ( IF "%qemu_bootindexdisk2%"=="" ( SET "qemu_bootindexdisk2=300" ) IF "%qemu_disk2options%"=="" ( SET "qemu_disk2options=cache=writeback,aio=native" ) IF "%qemu_disk2format%"=="" ( FOR %%i IN ("%qemu_disk2%") DO ( SET "qemu_disk2format=%%~xi" SET "qemu_disk2format=!qemu_disk2format:.=!" ) ) SET "qemu_opts=!qemu_opts! -drive file="%qemu_disk2%",if=none,format=!qemu_disk2format!,id=scsidisk1,!qemu_disk2options!" SET "qemu_opts=!qemu_opts! -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=scsidisk1,id=scsidisk1.0,bootindex=!qemu_bootindexdisk2!" ) IF NOT "%qemu_ifname%"=="" ( IF "%qemu_bootindexlan%"=="" ( SET "qemu_bootindexlan=400" ) IF "%qemu_macaddr%"=="" ( call "!qemu_path!qemu-gen-mac.bat" ) SET "qemu_opts=!qemu_opts! -netdev tap,id=wininet0,ifname=%qemu_ifname%" SET "qemu_opts=!qemu_opts! -device virtio-net-pci,mac=%qemu_macaddr%,netdev=wininet0,id=wininet0.0,bus=pci.0,addr=0x12,id=net0,bootindex=!qemu_bootindexlan!" ) IF NOT "%qemu_vmname%"=="" ( TITLE QEmu Virtual Machine: %qemu_vmname% ) !qemu_exec! !qemu_opts! %* call S:\bin\qemu\qemu-resetvar.bat