From fc2dc900cca6cb0bf47629575787a4314d860378 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 25 Jun 2025 17:21:46 -0400 Subject: [PATCH] Makefile: add system-vm target and GUI=true option --- Makefile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Makefile b/Makefile index 5f35df0..6e00ce6 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ GIT_AUTHOR := $(shell git log -1 --format=%an) GIT_PUBKEY := $(shell git log -1 --format=%GK) GIT_TIMESTAMP := $(shell git log -1 --format=%cd --date=iso) EFI := false +GUI := false ,:=, export @@ -51,6 +52,32 @@ out/dev-shell.digest: Containerfile | out shell: out/dev-shell.digest docker run -it $(shell cat $<) /bin/sh +.PHONY: system-vm +system-vm: + qemu-system-x86_64 \ + -m 4G \ + -machine q35,kernel-irqchip=split \ + -usb \ + -device sdhci-pci \ + -device sd-card,drive=external \ + -drive id=external,if=none,format=raw,file=out/sdcard.img \ + -device usb-storage,drive=usbdrive \ + -device intel-iommu,intremap=on \ + -netdev user,id=net0 \ + -device e1000,netdev=net0 \ + -chardev socket,path=out/qga.sock,server=on,wait=off,id=qga0 \ + -device virtio-serial \ + -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \ + $(if $(filter $(EFI),true) ,\ + -bios /usr/share/ovmf/OVMF.fd \ + -drive id=boot$(,)if=virtio$(,)format=raw$(,)file=out/airgap.iso \ + ,\ + -drive id=usbdrive,if=none,format=raw,file=out/airgap.iso \ + -boot order=c \ + ) \ + $(if (,$(wildcard /dev/kvm)),-cpu host --accel kvm,) \ + $(if $(filter $(GUI),true),,-nographic) + .PHONY: vm vm: out/dev-shell.digest out/airgap.iso out/sdcard.img docker run -it -v ./out:/out $(shell cat $<) sh -c "\