From 23e0ccf7b5a0ccea545f231d35dbecc00011a9de Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Thu, 24 Apr 2025 00:21:02 +0200 Subject: multiboot: add multiboot example kernel --- x86-bare-metal/multiboot/Makefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 x86-bare-metal/multiboot/Makefile (limited to 'x86-bare-metal/multiboot/Makefile') diff --git a/x86-bare-metal/multiboot/Makefile b/x86-bare-metal/multiboot/Makefile new file mode 100644 index 0000000..88772f5 --- /dev/null +++ b/x86-bare-metal/multiboot/Makefile @@ -0,0 +1,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 $< -- cgit v1.2.3