diff options
| author | hachem <im@hachem.wtf> | 2026-09-10 05:49:32 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-10 05:49:32 +0200 |
| commit | d8b53a78fcb131235c1e83fe7d6600ab50560420 (patch) | |
| tree | c51c4340826f391e576e484d39d8b9b4e04a5245 /Makefile | |
| parent | 5dfeadc5e32790c34b1d413d7be41771f68a5e95 (diff) | |
setup: initialize repo + limine as a bootloader
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 56 |
1 files changed, 56 insertions, 0 deletions
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 |
