aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-09-22 17:00:53 -0700
committerEugene Triguba <hello@eugenetriguba.com>2026-10-11 18:33:35 -0700
commitc9cfdbf86f2bf620c986abb2f67dcaabf5b01047 (patch)
tree23be01d9eb5cee38e1919e83d633ceff977f8f78 /Makefile
parentRemove need for explicit memory var override (diff)
downloadsite-server-images-c9cfdbf86f2bf620c986abb2f67dcaabf5b01047.zip
Add support for hcloud openbsd image snapshot
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile72
1 files changed, 0 insertions, 72 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c1343f9..0000000
--- a/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-SHELL := /bin/sh
-
-ARCH ?= arm64
-BUILD_DIR := build
-EDK2_DIR := /opt/homebrew/share/qemu
-SSH_PORT := 2222
-SSH_USER := admin
-SSH_KEY := ~/.ssh/id_rsa
-CPU := 1
-MEMORY := 4096M
-PACKER_LOG := 1
-
-VERSION := 7.9
-VERSION_SHORT := 79
-QEMU_ARCH := $(if $(filter arm64,$(ARCH)),aarch64,x86_64)
-VARS_FILE := openbsd$(VERSION_SHORT)-$(ARCH).pkvars.hcl
-DISK := $(BUILD_DIR)/openbsd-$(VERSION)-$(QEMU_ARCH).qcow2
-EFIVARS_RUN := $(BUILD_DIR)/efivars-run.fd
-EDK2_CODE := $(EDK2_DIR)/edk2-aarch64-code.fd
-EDK2_VARS := edk2-arm-vars.fd
-
-export PACKER_LOG
-
-.PHONY: all init build run ssh clean
-
-all: build
-
-init:
- packer init .
-
-build: init clean
-ifeq ($(ARCH),arm64)
- cp $(EDK2_DIR)/$(EDK2_VARS) ./$(EDK2_VARS)
-endif
- packer build -only qemu.openbsd-$(ARCH) -var-file=$(VARS_FILE) .
-
-# Run the headless VM (SSH via port-forwarded localhost:$(SSH_PORT))
-run:
-ifeq ($(ARCH),arm64)
- cp ./$(EDK2_VARS) $(EFIVARS_RUN)
- qemu-system-aarch64 \
- -machine type=virt,accel=hvf \
- -cpu host \
- -m $(MEMORY) \
- -smp $(CPU) \
- -nographic \
- -device qemu-xhci,id=xhci \
- -device usb-kbd,bus=xhci.0 \
- -device virtio-gpu-pci \
- -netdev user,id=net0,hostfwd=tcp::$(SSH_PORT)-:22 \
- -device virtio-net,netdev=net0 \
- -drive file=$(DISK),if=virtio,cache=writeback,discard=ignore,format=qcow2 \
- -drive file=$(EDK2_CODE),if=pflash,unit=0,format=raw,readonly=on \
- -drive file=$(EFIVARS_RUN),if=pflash,unit=1,format=raw
-else
- qemu-system-x86_64 \
- -machine type=q35,accel=tcg \
- -cpu max \
- -m $(MEMORY) \
- -smp $(CPU) \
- -nographic \
- -netdev user,id=net0,hostfwd=tcp::$(SSH_PORT)-:22 \
- -device virtio-net,netdev=net0 \
- -drive file=$(DISK),if=virtio,cache=writeback,discard=ignore,format=qcow2
-endif
-
-ssh:
- ssh -i $(SSH_KEY) -p $(SSH_PORT) $(SSH_USER)@127.0.0.1
-
-clean:
- rm -rf $(BUILD_DIR)
-