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 -include config.mk
12 ASFLAGS = -target ${TARGET}
13 ASFILES = boot.o
15 CXXFLAGS = -target ${TARGET} -Wall -Wextra -nostdlib -fno-exceptions
16 CXXFLAGS +=-ffreestanding -mgeneral-regs-only
17 CXXFLAGS +=-Iinclude -std=c++11
18 CXXFILES = kernel.cc uart_${BOARD}.cc
20 OBJS = ${ASFILES:.S=.o} ${CXXFILES:.cc=.o}
22 .PHONY: clean qemu gdb-remote
24 all: squat.img
26 squat.img: squat.elf
27 ${OBJCOPY} squat.elf -O binary squat.img
29 squat.elf: linker.ld ${OBJS}
30 ${LD} -T linker.ld -o squat.elf ${OBJS}
32 .S.o:
33 ${AS} ${ASFLAGS} -c boot.S -o boot.o
35 clean:
36 rm -rf *.o squat.elf squat.img
38 qemu: squat.img
39 qemu-system-${ARCH} -M ${BOARD} -cpu cortex-a53 \
40 -kernel squat.img -nographic -monitor none -serial stdio
41 gdb-remote: squat.img
42 qemu-system-${ARCH} -s -S -M ${BOARD} -cpu cortex-a53 \
43 -kernel squat.img -nographic -monitor none -serial stdio