summaryrefslogtreecommitdiff
path: root/makefile
blob: 0de951a65c67d47d5e9e924c871a40a4ed4a0abc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
qemu: floppy
	qemu-system-i386 out/floppy.img

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