summaryrefslogtreecommitdiff
path: root/partitions/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'partitions/Makefile')
-rw-r--r--partitions/Makefile33
1 files changed, 20 insertions, 13 deletions
diff --git a/partitions/Makefile b/partitions/Makefile
index 1007a5c..91a60d9 100644
--- a/partitions/Makefile
+++ b/partitions/Makefile
@@ -1,29 +1,36 @@
1 1
2.PHONY: all clean 2.PHONY: all clean
3 3
4all: whole.img 4whole = _build/whole.img
5key = _build/key.img
6
7all: $(whole)
5 8
6stage0_efi_file = ../import-grub-bootx64-efi/3/BOOTX64.EFI 9stage0_efi_file = ../import-grub-bootx64-efi/3/BOOTX64.EFI
7$(stage0_efi_file): 10$(stage0_efi_file):
8 make -C ../import-grub-bootx64-efi ver=3 11 make -C ../import-grub-bootx64-efi ver=3
9 12
10whole.img: $(stage0_efi_file) 13$(whole): $(stage0_efi_file)
11 partvi 14 partvi
12 15
13key.img: $(stage0_efi_file) 16$(key): $(stage0_efi_file)
14 partvi key 17 partvi key
15 18
19_liveboot:
20 btrfs subvolume create $@
21
16PERSIST_SIZE=20G 22PERSIST_SIZE=20G
17persist.img: 23PERSIST_FILE=_liveboot/persist.img
24$(PERSIST_FILE): | _liveboot
18 [ ! -e $@ ] 25 [ ! -e $@ ]
19 fallocate -l "$(PERSIST_SIZE)" $@ 26 fallocate -l "$(PERSIST_SIZE)" $@
20 truncate -s 0 $@ 27 truncate -s 0 $@
21 truncate -s "$(PERSIST_SIZE)" $@ 28 truncate -s "$(PERSIST_SIZE)" $@
22 29
23persist := $(shell [ -e persist.img ] && printf %s '-drive file=persist.img,media=disk,driver=raw' || true) 30optional_persist_disk != [ ! -e $(PERSIST_FILE) ] || printf %s '-drive file=$(PERSIST_FILE),media=disk,driver=raw'
24 31
25.PHONY: usb emu key emu-key keymu 32.PHONY: usb emu key emu-key keymu
26usb: whole.img 33usb: $(whole)
27 usb=$$(usb) && sudo dd status=progress if="$<" of="$$usb" 34 usb=$$(usb) && sudo dd status=progress if="$<" of="$$usb"
28 35
29# QEMU_DISPLAY_OPTIONS = -nographic 36# QEMU_DISPLAY_OPTIONS = -nographic
@@ -34,16 +41,16 @@ QEMU_OPTIONS = $(QEMU_BIOS_OPTIONS) $(QEMU_DISPLAY_OPTIONS)
34define emu 41define emu
35 NO_AT_BRIDGE=1 qemu-system-x86_64 ${QEMU_OPTIONS} -m 800 -enable-kvm -boot c \ 42 NO_AT_BRIDGE=1 qemu-system-x86_64 ${QEMU_OPTIONS} -m 800 -enable-kvm -boot c \
36 -drive file=$(1),media=disk,driver=raw \ 43 -drive file=$(1),media=disk,driver=raw \
37 $(persist) 44 $(optional_persist_disk)
38endef 45endef
39 46
40emu: whole.img 47emu: $(whole)
41 $(call emu,$<) 48 $(call emu,$<)
42 49
43emu-key keymu: key.img 50emu-key keymu: $(key)
44 $(call emu,$<) 51 $(call emu,$<)
45 52
46key: key.img 53key: $(key)
47 usb=$$(usb) && \ 54 usb=$$(usb) && \
48 sudo dd status=progress bs=1048576 if="$<" of="$$usb" && \ 55 sudo dd status=progress bs=1048576 if="$<" of="$$usb" && \
49 sudo $(call emu,"$$usb") 56 sudo $(call emu,"$$usb")
@@ -56,9 +63,9 @@ efi-ventoy: ventoy-efi-example.img
56 $(call emu,$<) 63 $(call emu,$<)
57 64
58clean: 65clean:
59 rm -rf _build whole.img key.img 66 rm -rf _build
60 67
61.PHONY: total-destroy 68.PHONY: total-destroy
62total-destroy: clean 69total-destroy: clean
63 rm -f persist.img 70 rm -f $(PERSIST_FILE)
64 $(MAKE) persist.img 71 $(MAKE) $(PERSIST_FILE)