-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (43 loc) · 1.06 KB
/
Makefile
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
MKCWD = @mkdir -p $(@D)
LIMINE_GEN = ./meta/scripts/limine-gen.sh
SYSROOT = ./.image/
CACHE = ./.cache/
LOADER = $(SYSROOT)/efi/boot/bootx64.efi
KERNEL = $(SYSROOT)/kernel.elf
FIRMWARE = $(CACHE)/OVMF.fd
SRC = $(shell find . -name '*.zig')
$(LOADER):
@$(MKCWD)
@curl -L https://github.com/limine-bootloader/limine/raw/refs/heads/v8.x-binary/BOOTX64.EFI -o $@
$(KERNEL): $(SRC)
@$(MKCWD)
@zig build
@cp ./zig-out/bin/kernel.elf $@
$(FIRMWARE):
@$(MKCWD)
@curl -L https://github.com/osdev0/edk2-ovmf-nightly/releases/latest/download/ovmf-code-x86_64.fd -o $@
.PHONY: build
build: $(KERNEL)
.PHONY: qemu
qemu: $(LOADER) $(KERNEL) $(FIRMWARE)
@bash $(LIMINE_GEN) $(SYSROOT)
qemu-system-x86_64 \
--no-reboot \
--no-shutdown \
-smp 4 \
-serial mon:stdio \
-display none \
-drive format=raw,file=fat:rw:$(SYSROOT) \
-bios $(FIRMWARE)
.PHONY: clean
clean:
rm -rf ./zig-cache/ ./zig-out/
.PHONY: nuke
nuke: clean
rm -rf $(SYSROOT)
.PHONY: path
path:
@echo $(KERNEL)
.PHONY: addr2line
addr2line: $(KERNEL)
@bash ./meta/scripts/addr2line.sh $(KERNEL) $(A)