Blob


1 AS = clang
2 CXX = clang++
3 LD = ld.lld
4 OBJCOPY = llvm-objcopy
6 ARCH = aarch64
7 TARGET = ${ARCH}-none-elf
8 BOARD = virt
10 ASFLAGS = -target ${TARGET}
11 ASFILES = boot.S
13 CXXFLAGS = -target ${TARGET}
14 CXXFLAGS +=-Wall -Wextra -Werror
15 CXXFLAGS +=-nostdlib -fno-exceptions -std=c++11
16 CXXFLAGS +=-ffreestanding -mgeneral-regs-only
17 CXXFLAGS +=-Iinclude
18 CXXFILES = kernel.cc uart_${BOARD}.cc
20 OBJS = ${ASFILES:.S=.o} ${CXXFILES:.cc=.o}
22 -include config.mk
24 .PHONY: clean qemu gdb-remote
26 all: squat.img
28 squat.img: squat.elf
29 ${OBJCOPY} squat.elf -O binary squat.img
31 squat.elf: linker.ld ${OBJS}
32 ${LD} -T linker.ld -o squat.elf ${OBJS}
34 .S.o:
35 ${AS} ${ASFLAGS} -c $< -o $@
37 clean:
38 rm -rf *.o squat.elf squat.img
40 qemu: squat.img
41 qemu-system-${ARCH} -M ${BOARD} -cpu cortex-a53 \
42 -kernel squat.img -nographic -monitor none -serial stdio
43 gdb-remote: squat.img
44 qemu-system-${ARCH} -s -S -M ${BOARD} -cpu cortex-a53 \
45 -kernel squat.img -nographic -monitor none -serial stdio