-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (35 loc) · 1.05 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
LAB := 5
V := @
PROJECT_DIR := .
BUILD_DIR := $(PROJECT_DIR)/build
KERNEL_IMG := $(BUILD_DIR)/kernel.img
QEMU := qemu-system-aarch64
_QEMU := $(PROJECT_DIR)/scripts/qemu/qemu_wrapper.sh $(QEMU)
QEMU_GDB_PORT := 1234
QEMU_OPTS := -machine raspi3b -nographic -serial null -serial mon:stdio -m size=1G -kernel $(KERNEL_IMG)
GDB := gdb-multiarch
CHBUILD := $(PROJECT_DIR)/chbuild
.PHONY: all
all: build
.PHONY: defconfig build clean distclean
defconfig:
$(V)$(CHBUILD) defconfig
build:
$(V)test -f $(PROJECT_DIR)/.config || $(CHBUILD) defconfig
$(V)$(CHBUILD) rebuild
clean:
$(V)$(CHBUILD) clean
distclean:
$(V)$(CHBUILD) distclean
.PHONY: qemu qemu-gdb gdb
qemu:
$(V)$(_QEMU) $(QEMU_OPTS)
qemu-gdb:
$(V)$(_QEMU) -S -gdb tcp::$(QEMU_GDB_PORT) $(QEMU_OPTS)
gdb:
$(V)gdb-multiarch -x $(PROJECT_DIR)/.gdbinit
.PHONY: grade
grade:
$(V)test -f $(PROJECT_DIR)/.config && cp $(PROJECT_DIR)/.config $(PROJECT_DIR)/.config.bak
$(V)$(PROJECT_DIR)/scripts/grade/lab$(LAB).sh
$(V)test -f $(PROJECT_DIR)/.config.bak && mv $(PROJECT_DIR)/.config.bak $(PROJECT_DIR)/.config