.PHONY: all clean whole = _build/whole.img key = _build/key.img all: $(whole) stage0_efi_file = ../import-grub-bootx64-efi/3/BOOTX64.EFI $(stage0_efi_file): make -C ../import-grub-bootx64-efi ver=3 $(whole): $(stage0_efi_file) partvi $(key): $(stage0_efi_file) partvi key _liveboot: btrfs subvolume create $@ PERSIST_SIZE=20G PERSIST_FILE=_liveboot/persist.img $(PERSIST_FILE): | _liveboot [ ! -e $@ ] fallocate -l "$(PERSIST_SIZE)" $@ truncate -s 0 $@ truncate -s "$(PERSIST_SIZE)" $@ optional_persist_disk != [ ! -e $(PERSIST_FILE) ] || printf %s '-drive file=$(PERSIST_FILE),media=disk,driver=raw' .PHONY: usb emu key emu-key keymu usb: $(whole) usb=$$(usb) && sudo dd status=progress if="$<" of="$$usb" # QEMU_DISPLAY_OPTIONS = -nographic QEMU_DISPLAY_OPTIONS = -display gtk define QEMU_OPTIONS -global isa-fdc.fdtypeA=none $(QEMU_BIOS_OPTIONS) $(QEMU_DISPLAY_OPTIONS) endef define emu NO_AT_BRIDGE=1 qemu-system-x86_64 \ ${QEMU_OPTIONS:%=%} \ -m 800 -enable-kvm -boot c \ -drive file=$(1),media=disk,driver=raw \ $(optional_persist_disk) endef emu: $(whole) $(call emu,$<) emu-key keymu: $(key) $(call emu,$<) key: $(key) usb=$$(usb) && \ sudo dd status=progress bs=1048576 if="$<" of="$$usb" && \ sudo $(call emu,"$$usb") efi: QEMU_BIOS_OPTIONS = -bios /usr/share/ovmf/OVMF.fd efi: emu efi-ventoy: QEMU_BIOS_OPTIONS = -bios /usr/share/ovmf/OVMF.fd efi-ventoy: ventoy-efi-example.img $(call emu,$<) clean: rm -rf _build .PHONY: total-destroy total-destroy: clean rm -f $(PERSIST_FILE) $(MAKE) $(PERSIST_FILE)