-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathMakefile
58 lines (43 loc) · 1.41 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
# Test commands.
# make run
# Ctrl-A X (Exit)
IMAGE := kernel.elf
CROSS = aarch64-linux-gnu
CC = ${CROSS}-gcc
AS = ${CROSS}-as
LD = ${CROSS}-ld
OBJDUMP = ${CROSS}-objdump
CFLAGS = -mcpu=cortex-a57 -Wall -Wextra -g
# -mcpu=name
# Specify the name of the target processor
# -Wall
# Turns on all optional warnings which are desirable for normal code
# -Wextra
# This enables some extra warning flags that are not enabled by -Wall
# -g Produce debugging information in the operating system's native format.
# GDB can work with this debugging information.
ASM_FLAGS = -mcpu=cortex-a57 -g
OBJS = boot.o vector.o exception.o kernel.o gic_v3.o uart.o psw.o aarch64.o timer.o
# OBJS = boot.o gic-pl390.o kernel.o
all: $(IMAGE)
${IMAGE}: linker.ld ${OBJS}
${LD} -T linker.ld $^ -o $@
${OBJDUMP} -D kernel.elf > kernel.list
#boot.o: boot.S
%.o: %.S
# ${AS} ${ASM_FLAGS} -c $< -o $@
$(CC) ${CFLAGS} -c $< -o $@ # for include header file in assembly
%.o : %.c
$(CC) ${CFLAGS} -c $<
run:
$(MAKE) kernel.elf
# qemu-system-aarch64 -machine virt -cpu cortex-a57 -m 128 -serial stdio -nographic -nodefaults -kernel kernel.elf
# qemu-system-aarch64 -machine virt,gic_version=3 -cpu cortex-a57 -nographic -kernel kernel.elf
qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -kernel kernel.elf
gen_tags:
./gen_tags.sh
clean_tags:
rm -rf tags cscope*
clean:
rm -f *.o *.elf *.list
.PHONY: run gen_tags clean_tags clean