summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..54aa45f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+# FoolOS Makefile
+#
+
+IMAGE_SIZE=4096
+
+all: FoolOS.img
+
+FoolOS.img: mbr.bin kernel.bin fill.bin
+ cat $^ | head -c $(IMAGE_SIZE) > $@
+
+fill.bin: boot/fill.asm
+ nasm -f bin $^ -o $@
+
+mbr.bin: boot/mbr.asm
+ nasm -f bin $^ -o $@
+
+kernel_entry.o: boot/kernel_entry.asm
+ nasm -f elf $^ -o $@
+
+kernel.o: kernel/kernel.c
+ gcc -ffreestanding -m32 -o $@ -c $^ -fno-asynchronous-unwind-tables
+
+kernel.bin: kernel_entry.o kernel.o
+ ld -o $@ -Ttext 0x1000 --oformat binary -melf_i386 $^
+clean:
+ rm *.bin *.o *.img
+
+.PHONY: all clean