This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·79 lines (64 loc) · 1.73 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
OVMF := assets/OVMF.fd
ESP := esp
BUILD_ARGS :=
QEMU_ARGS := -m 96M
QEMU_OUTPUT := -nographic
MODE ?= release
CUR_PATH := $(shell pwd)
DBG_INFO ?= false
# Only add debug info for kernel
# this is required for VSCode GUI debugging
ifeq (${DBG_INFO}, true)
PROFILE = release-with-debug
PROFILE_ARGS = --profile=release-with-debug
else
PROFILE = ${MODE}
PROFILE_ARGS = $(BUILD_ARGS)
endif
ifeq (${MODE}, release)
BUILD_ARGS := --release
endif
.PHONY: build run debug clean launch intdbg \
target/x86_64-unknown-uefi/$(MODE)/ysos_boot.efi \
target/x86_64-unknown-none/$(PROFILE)/ysos_kernel
run: build launch
launch:
@qemu-system-x86_64 \
-bios ${OVMF} \
-net none \
$(QEMU_ARGS) \
$(QEMU_OUTPUT) \
-drive format=raw,file=fat:rw:${ESP}
intdbg:
@qemu-system-x86_64 \
-bios ${OVMF} \
-net none \
$(QEMU_ARGS) \
$(QEMU_OUTPUT) \
-drive format=raw,file=fat:rw:${ESP} \
-no-reboot -d int,cpu_reset
debug:
@qemu-system-x86_64 \
-bios ${OVMF} \
-net none \
$(QEMU_ARGS) \
$(QEMU_OUTPUT) \
-drive format=raw,file=fat:rw:${ESP} \
-s -S
clean:
@cargo clean
build: $(ESP)
$(ESP): $(ESP)/EFI/BOOT/BOOTX64.EFI $(ESP)/KERNEL.ELF $(ESP)/EFI/BOOT/boot.conf
$(ESP)/EFI/BOOT/BOOTX64.EFI: target/x86_64-unknown-uefi/$(MODE)/ysos_boot.efi
@mkdir -p $(@D)
cp $< $@
$(ESP)/EFI/BOOT/boot.conf: pkg/kernel/config/boot.conf
@mkdir -p $(@D)
cp $< $@
$(ESP)/KERNEL.ELF: target/x86_64-unknown-none/$(PROFILE)/ysos_kernel
@mkdir -p $(@D)
cp $< $@
target/x86_64-unknown-uefi/$(MODE)/ysos_boot.efi: pkg/boot
cd pkg/boot && cargo build $(BUILD_ARGS)
target/x86_64-unknown-none/$(PROFILE)/ysos_kernel: pkg/kernel
cd pkg/kernel && cargo build $(PROFILE_ARGS)