Skip to content

Instantly share code, notes, and snippets.

@f0ster
Created December 19, 2025 05:09
Show Gist options
  • Select an option

  • Save f0ster/6c4832901ab79952de2d94866ac68526 to your computer and use it in GitHub Desktop.

Select an option

Save f0ster/6c4832901ab79952de2d94866ac68526 to your computer and use it in GitHub Desktop.
qemu makefile
QEMU ?= qemu-system-x86_64
UBUNTU_INSTALL_CDROM ?= ~/Downloads/ubuntu-24.04.3-desktop-amd64.iso
DISK ?= disk/disk.qcow2
RAM ?= 32768
CPUS ?= 16
PORT ?= 2222
DISPLAY_WIDTH ?= 1920
DISPLAY_HEIGHT ?= 1080
# QXL for stable single display (defaults)
GPU_FLAGS = -display gtk,zoom-to-fit=off \
-vga qxl
COMMON_FLAGS = \
-enable-kvm \
-smp $(CPUS) \
-m $(RAM) \
-cpu host \
-machine type=q35,accel=kvm \
-netdev user,id=net0,hostfwd=tcp::$(PORT)-:22 \
-device virtio-net-pci,netdev=net0 \
-device qemu-xhci,id=xhci \
-device usb-host,vendorid=0x1415,productid=0x2000 \
-drive file=$(DISK),format=qcow2
boot-cd:
$(QEMU) \
$(COMMON_FLAGS) \
-boot d \
-cdrom $(UBUNTU_INSTALL_CDROM) \
$(GPU_FLAGS)
boot-disk:
$(QEMU) \
$(COMMON_FLAGS) \
-boot c \
$(GPU_FLAGS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment