summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--partitions/Makefile20
1 files changed, 16 insertions, 4 deletions
diff --git a/partitions/Makefile b/partitions/Makefile
index f8ef259..1e40c07 100644
--- a/partitions/Makefile
+++ b/partitions/Makefile
@@ -9,22 +9,34 @@ whole.img:
9key.img: 9key.img:
10 partvi key 10 partvi key
11 11
12persist.img:
13 [ ! -e $@ ]
14 fallocate -l 20G $@
15 truncate -s 0 $@
16 truncate -s 20G $@
17
18persist := $(shell [ -e persist.img ] && printf %s '-drive file=persist.img,media=disk,driver=raw' || true)
19
12.PHONY: usb emu key emu-key keymu 20.PHONY: usb emu key emu-key keymu
13usb: whole.img 21usb: whole.img
14 usb=$$(usb) && sudo dd status=progress if="$<" of="$$usb" 22 usb=$$(usb) && sudo dd status=progress if="$<" of="$$usb"
15 23
16emu = qemu-system-x86_64 -m 800 -enable-kvm -boot c 24define emu
25 qemu-system-x86_64 -m 800 -enable-kvm -boot c \
26 -drive file=$(1),media=disk,driver=raw \
27 $(persist)
28endef
17 29
18emu: whole.img 30emu: whole.img
19 $(emu) $< 31 $(call emu,$<)
20 32
21emu-key keymu: key.img 33emu-key keymu: key.img
22 $(emu) $< 34 $(call emu,$<)
23 35
24key: key.img 36key: key.img
25 usb=$$(usb) && \ 37 usb=$$(usb) && \
26 sudo dd status=progress bs=1048576 if="$<" of="$$usb" && \ 38 sudo dd status=progress bs=1048576 if="$<" of="$$usb" && \
27 sudo $(emu) "$$usb" 39 sudo "$(call emu,"$$usb")"
28 40
29clean: 41clean:
30 rm -rf _build whole.img key.img 42 rm -rf _build whole.img key.img