summaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorBenji Dial <benji3.141@gmail.com>2020-05-16 13:25:46 -0400
committerBenji Dial <benji3.141@gmail.com>2020-05-16 13:25:46 -0400
commit53801b9baed096e57b40df6147d9ff0f3da0c737 (patch)
tree4d1987c277cc02b53ff06ee756f67f85b62d1acc /makefile
parentc0daede46df4f546639bd2d3e11dcf064d554966 (diff)
downloadportland-os-53801b9baed096e57b40df6147d9ff0f3da0c737.tar.gz
Hello world
Diffstat (limited to 'makefile')
-rw-r--r--makefile21
1 files changed, 21 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..efb5cf8
--- /dev/null
+++ b/makefile
@@ -0,0 +1,21 @@
+floppy: kernel boot
+ mkdir -p obj out
+ /sbin/mkfs.fat -C -R 17 -n "PORTLAND OS" obj/shadow.img 1440
+ echo -n -e '\xeb\x3c' > obj/jmp.bin
+ dd if=obj/jmp.bin of=obj/shadow.img obs=2 conv=notrunc
+ dd if=out/boot.bin of=obj/shadow.img obs=1 seek=62 conv=notrunc
+ dd if=out/kernel.bin of=obj/shadow.img seek=1 conv=notrunc
+ mv obj/shadow.img out/floppy.img
+
+kernel:
+ mkdir -p obj/kernel out
+ gcc -m32 -ffreestanding -c src/kernel/main.c -o obj/kernel/main.o
+ gcc -m32 -ffreestanding -c src/kernel/vga.c -o obj/kernel/vga.o
+ ld -T src/kernel/link.ld obj/kernel/main.o obj/kernel/vga.o -o out/kernel.bin
+
+boot:
+ mkdir -p out
+ nasm src/boot.asm -o out/boot.bin
+
+clean:
+ rm -r obj out \ No newline at end of file