Created
October 4, 2022 20:54
-
-
Save luqmana/e229141e697cbea04b10882cdd0cde50 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
ip tuntap add dev wintestnet mode tap 2>/dev/null | |
ip link set dev wintestnet master vmbr 2>/dev/null | |
ip link set dev wintestnet up 2>/dev/null | |
# Edit these | |
WIN_IMAGE=/oxide/VMs/IMGs/windows.img | |
OVMF_PATH=/oxide/VMs/OVMF_CODE.fd | |
WIN_ISO=/lfs/ISOs/OSs/en_windows_10_business_editions_version_2004_updated_nov_2020_x64_dvd_29ee42db.iso | |
VIRTIO_ISO=/lfs/ISOs/Support/virtio-win.iso | |
QEMU_ARGS=( | |
-nodefaults | |
-name guest=wintest,debug-threads=on | |
-enable-kvm | |
-M pc,accel=kvm | |
-m 2048 -mem-prealloc | |
-cpu host | |
-smp 4,sockets=1,cores=4 | |
-rtc base=localtime | |
-drive if=pflash,format=raw,readonly=on,file=$OVMF_PATH | |
-device nvme,drive=drivec,serial=deadbeef,physical_block_size=512,logical_block_size=512 | |
-drive if=none,id=drivec,file=$WIN_IMAGE,format=raw | |
-netdev tap,ifname=wintestnet,id=net0,script=no,downscript=no | |
-device virtio-net-pci,netdev=net0 | |
-device ramfb | |
-serial tcp:127.0.0.1:9999 | |
#-serial stdio | |
) | |
if [ "$1" == "install" ]; then | |
QEMU_ARGS+=( | |
-device ide-cd,drive=win-disk,id=cd-disk1,unit=0,bus=ide.0 | |
-drive file=$WIN_ISO,if=none,id=win-disk,media=cdrom | |
-device ide-cd,drive=virtio-disk,id=cd-disk2,unit=0,bus=ide.1 | |
-drive file=$VIRTIO_ISO,if=none,id=virtio-disk,media=cdrom | |
) | |
fi | |
qemu-system-x86_64 "${QEMU_ARGS[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment