diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-04-24 00:21:02 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-04-24 00:21:02 +0200 |
commit | 23e0ccf7b5a0ccea545f231d35dbecc00011a9de (patch) | |
tree | fcabb2e084297bb51c2a12ee77404b891cca0df6 /x86-bare-metal/multiboot/Makefile | |
parent | 20a854354918735c3289c5576a28fad18ca21757 (diff) | |
download | zig-playground-main.tar.gz zig-playground-main.zip |
Diffstat (limited to 'x86-bare-metal/multiboot/Makefile')
-rw-r--r-- | x86-bare-metal/multiboot/Makefile | 25 |
1 files changed, 25 insertions, 0 deletions
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 $< |