aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: b1b15c44f0d4d220a6da3d1535f12d349564de89 (about) (plain)
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
CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu99 -Wall -Wextra -I.

all : kernel7.img

kernel.o : kernel.c
	arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@

uart.o : uart.c
	arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@

boot.o : boot.S
	arm-none-eabi-as -mcpu=cortex-a7 $^ -o $@

kernel.elf : boot.o kernel.o uart.o
	arm-none-eabi-gcc -T linker.ld -o $@ -ffreestanding -O2 -nostdlib boot.o kernel.o uart.o -lgcc -I.

kernel7.img : kernel.elf
	arm-none-eabi-objcopy $^ -O binary $@

qemu-elf : kernel.elf
	qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $^

qemu-bin : kernel7.img
	qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $^

clean :
	-rm kernel7.img kernel.elf boot.o kernel.o uart.o

.PHONY: all qemu-elf qemu-bin clean