diff --git a/Makefile b/Makefile index 0ef9e4b..f558602 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,19 @@ +FD_CYLINDERS = 40 +FD_HEADS = 2 +FD_SECTORS = 9 + default: kernel.com -boot.bin: kernel/*.asm +kernel.bin: kernel/*.asm nasm -s -o $@ -I kernel kernel/main.asm -%.bin: boot/%.asm +boot/%.bin: boot/%.asm nasm -s -o $@ -I lib $< -fdimage.img: fat12vbr.bin boot.bin - dd if=/dev/zero bs=512 count=720 of=$@ - mformat -i $@ -f 360 -B fat12vbr.bin :: - mcopy -i fdimage.img boot.bin ::boot.bin +fdimage.img: boot/floppy.bin kernel.bin + dd if=/dev/zero bs=512 count=$$(( $(FD_CYLINDERS) * $(FD_HEADS) * $(FD_SECTORS) )) of=$@ + mformat -i $@ -t $(FD_CYLINDERS) -h $(FD_HEADS) -n $(FD_SECTORS) -B boot/floppy.bin :: + mcopy -i fdimage.img kernel.bin ::boot.bin clean: - rm -f *.com *.bin *.img + rm -f *.com *.bin *.img boot/*.bin diff --git a/boot/fat12vbr.asm b/boot/floppy.asm similarity index 100% rename from boot/fat12vbr.asm rename to boot/floppy.asm