summaryrefslogtreecommitdiff
path: root/x86-bare-metal/multiboot/Makefile
blob: 88772f5be5c43bf531120f300e8bef139d1ca492 (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
O := BUILD

$(O)/disk.img: $(O)/kern grub
	mkdir -p $(O)/iso/boot
	rsync -rav $^ $(O)/iso/boot
	grub-mkrescue -o '$@' $(O)/iso

# When building the kernel we explicitly let the zig compiler emit code for a
# very old cpu.  This way we ensure it does not emit any sse instructions, which
# first need to be enabled before the can be used (setting up ctrl registers and
# sse state).
$(O)/kern: kern.ld kern.zig
	mkdir -p $(O)
	zig build-exe -fno-unwind-tables -femit-bin=$@ -target x86-freestanding-none -mcpu i386 -O Debug -fno-strip --script $^
	xxd -d -e -c4 $@ | awk -f scripts/check_mbhdr.awk
	objdump -d $@ | awk -f scripts/check_sse.awk

clean:
	$(RM) -r $(O)

run: $(O)/kern
	qemu-system-i386 -kernel $< -append mode=raw-elf

run-img: $(O)/disk.img
	qemu-system-i386 -hda $<