reorganization
[eightysix] / kern / Makefile
diff --git a/kern/Makefile b/kern/Makefile
new file mode 100644 (file)
index 0000000..44d9d66
--- /dev/null
@@ -0,0 +1,38 @@
+disk_numsec = 720
+#disk_numsec = 2880
+
+bin = bootldr
+img = bootldr.img
+
+CC = ia16-elf-gcc
+LD = ia16-elf-ld
+
+CFLAGS = -march=i8088 -mtune=i8088
+
+$(img): $(bin)
+       dd if=/dev/zero of=$@ bs=512 count=$(disk_numsec)
+       dd if=$< of=$@ bs=512 conv=notrunc
+
+$(bin): boot/boot.o boot/boot2.o boot/main.o
+       $(LD) -T boot.ld -Map boot.map -o $@ $^
+
+%.o: %.asm
+       nasm -o $@ -f elf $<
+
+.PHONY: clean
+clean:
+       rm -f boot/*.o $(bin)
+
+
+.PHONY: run
+run: $(img)
+       qemu-system-i386 -fda $(img) -serial file:serial.log
+
+.PHONY: debug
+debug: $(img)
+       qemu-system-i386 -fda $(img) -serial file:serial.log -s -S
+
+.PHONY: disasm
+disasm: $(bin)
+       ndisasm -o 0x7c00 $< >dis1
+       ndisasm -o 0x80000 -e 512 $< >dis2