-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
47 lines (35 loc) · 845 Bytes
/
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
CROSS_COMPILE ?= arm-linux-gnueabi-
ARCH ?= arm
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
OBJCOPY := $(CROSS_COMPILE)objcopy
CPPFLAGS := -ggdb -nostdlib -nostdinc -ffreestanding -marm -O2 -march=armv6zk \
-Wall -Werror
LDFLAGS := -nostdlib -ffreestanding -Wl,--build-id=none
OBJS := entry.o \
kernel.o \
uart.o \
pinmux.o \
tzvecs.o \
gdbstub.o \
printk.o \
string.o
all: install
kernel.img: loader
$(OBJCOPY) -O binary $< $@
loader: loader.o
$(CC) $^ -o $@ $(LDFLAGS) -T ldscript_loader.X
loader.o: loader.S rsp.img
$(CC) -c $< -o $@ $(LDFLAGS)
rsp.img: rsp
$(OBJCOPY) -O binary $< $@
rsp: $(OBJS)
$(CC) $^ -o $@ $(LDFLAGS) -T ldscript.X
%.o: %.c
$(CC) -c $< -o $@ $(CPPFLAGS)
%.o: %.S
$(CC) -c $< -o $@ $(CPPFLAGS)
clean:
rm -f *.img *.o rsp loader
install: kernel.img
cp kernel.img /var/lib/tftpboot