From d8b53a78fcb131235c1e83fe7d6600ab50560420 Mon Sep 17 00:00:00 2001 From: hachem Date: Thu, 10 Sep 2026 05:49:32 +0200 Subject: setup: initialize repo + limine as a bootloader --- Makefile | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6252139 --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +# Revel — build the kernel, assemble a Limine ISO, boot it in QEMU. +# +# make build the ISO (default) +# make run build and boot it headless (serial on stdout) +# make kernel just compile the kernel ELF +# make clean remove build output (kernel, ISO, caches) +# make distclean also remove Limine's built host tool + +ZIG ?= zig +QEMU ?= qemu-system-x86_64 + +KERNEL := zig-out/bin/revel +ISO := revel.iso + +.PHONY: all kernel iso run clean distclean + +all: iso + +kernel: + $(ZIG) build + +limine/limine: + $(MAKE) -C limine + +iso: kernel limine/limine + rm -rf iso_root + mkdir -p iso_root/boot/limine iso_root/EFI/BOOT + cp $(KERNEL) iso_root/boot/revel + cp boot/limine.conf iso_root/boot/limine/ + cp limine/limine-bios.sys \ + limine/limine-bios-cd.bin \ + limine/limine-uefi-cd.bin iso_root/boot/limine/ + cp limine/BOOTX64.EFI \ + limine/BOOTIA32.EFI iso_root/EFI/BOOT/ + xorriso -as mkisofs -R -r -J \ + -b boot/limine/limine-bios-cd.bin \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -hfsplus -apm-block-size 2048 \ + --efi-boot boot/limine/limine-uefi-cd.bin \ + -efi-boot-part --efi-boot-image --protective-msdos-label \ + iso_root -o $(ISO) + ./limine/limine bios-install $(ISO) + +# for now this is just going to be a headless run +# all I need this for is to check for kernel panics +# and limine related failures. +run: iso + $(QEMU) -M q35 -m 256M -cdrom $(ISO) -boot d \ + -display none -serial stdio -no-reboot \ + -no-shutdown + +clean: + rm -rf iso_root zig-out .zig-cache $(ISO) + +distclean: clean + rm -f limine/limine -- cgit v1.3