+.PHONY: all
+all: disk.img #floppy.img
+
+disk.img: boot.img blank.img
+ @echo
+ @echo - patching pcboot onto the blank disk image ...
+ cp blank.img $@
+ dd if=boot.img of=$@ bs=512 status=none conv=notrunc
+ dd if=blank.img of=$@ bs=1 seek=440 skip=440 count=70 status=none conv=notrunc
+
+blank.img:
+ @echo
+ @echo - generating blank disk image with FAT partition ...
+ dd if=/dev/zero of=part.img bs=1024 count=63488
+ mkfs -t vfat -n PCBOOT part.img
+ dd if=/dev/zero of=$@ bs=1024 count=65536
+ echo start=2048 type=c | sfdisk $@
+ dd if=part.img of=$@ bs=512 seek=2048 conv=notrunc
+ rm part.img
+
+floppy.img: boot.img
+ dd if=/dev/zero of=$@ bs=512 count=2880
+ dd if=$< of=$@ conv=notrunc
+
+pcboot.iso: floppy.img
+ rm -rf cdrom
+ git archive --format=tar --prefix=cdrom/ HEAD | tar xf -
+ cp $< cdrom
+ mkisofs -o $@ -R -J -V pcboot -b $< cdrom
+
+
+boot.img: bootldr.bin $(bin)
+ cat bootldr.bin $(bin) >$@
+
+# bootldr.bin will contain .boot, .boot2, .bootend, and .lowtext
+bootldr.bin: $(elf)
+ objcopy -O binary -j '.boot*' -j .lowtext $< $@
+
+# the main binary will contain every section *except* those