summaryrefslogtreecommitdiff
path: root/makefile
blob: 229b6657a6b3d2ac94d88ed0179d45c467ec64b0 (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
25
26
27
floppy: bootloader fs
	mkfs.fat -C -f 1 -F 12 -n "PORTLAND OS" -R 2 -S 512 out/floppy.img 1440
	mkdir out/floppy_mount
	mount out/floppy.img out/floppy_mount
	cp out/fs/* out/floppy_mount/
	umount out/floppy_mount
	dd if=obj/bootloader.bin of=out/floppy.img bs=1 seek=62 conv=notrunc

bootloader: obj
	nasm src/bootloader.asm -o obj/bootloader.bin

kernel: obj fs
	gcc src/kernel/*.c -o obj/kernel.elf -ffreestanding -nostdlib -m32 -fno-asynchronous-unwind-tables
	ld obj/kernel.elf -o obj/kernel-stripped.elf -T src/kernel/link.ld -s --orphan-handling=discard -m elf_i386
	objcopy obj/kernel-stripped.elf out/fs/kernel.sys -O binary

clean:
	rm -r obj out

fs: out
	mkdir -p out/fs

obj:
	mkdir -p obj

out:
	mkdir -p out