run rule master
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 30 May 2021 12:37:46 +0000 (15:37 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 30 May 2021 12:37:46 +0000 (15:37 +0300)
Makefile

index 787921f..46739e6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,23 @@ $(efibin): $(efiso)
        objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
                -j .rela -j .reloc --target=efi-app-x86_64 $< $@
 
+part.img: $(efibin)
+       dd if=/dev/zero of=$@ bs=1024 count=2080
+       mkfs -t vfat $@
+       mmd -i $@ ::/EFI
+       mmd -i $@ ::/EFI/BOOT
+       mcopy -i $@ $< ::/EFI/BOOT
+
+disk.img: part.img
+       dd if=/dev/zero of=$@ bs=1024 count=2048
+       echo start=2048 type=ef | sfdisk $@
+       dd if=$< of=$@ bs=512 seek=2048 conv=notrunc
+
 
 .PHONY: clean
 clean:
-       rm -f $(obj) $(efibin) $(efiso)
+       rm -f $(obj) $(efibin) $(efiso) *.img
+
+.PHONY: run
+run: disk.img
+       qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd  -hda $<