Repo link
Makefile
# $@ = target file
# $< = first dependency
# $^ = all dependencies
LDFLAGS = --oformat binary -N
CFLAGS = -ffreestanding -fno-pie
all: run
out/%.o: %.asm
as -o $@ $<
bin/kernel: out/kernel.o
ld -o $@ -T../link.ld $(LDFLAGS) $^
bin/bootsect: out/bootloader.o
ld -o $@ -Ttext 0x7c00 $(LDFLAGS) $<
os-img.bin: bin/bootsect bin/kernel
cat $^ > $@
truncate -s 10240 $@
run: os-img.bin
qemu-system-x86_64 -drive format=raw,file=$<
Top comments (0)