diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..be2cb63 --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +# tashaboot +# +# build: make CROSS=aarch64-linux-gnu- +# run: make run (qemu virt, semihosting, Image on the host) +# +# arm64 only. the architecture contract comes from the ARM ARM +# (DDI 0487), the payload protocol from the kernel booting docs. + +CROSS ?= aarch64-linux-gnu- +CC := $(CROSS)gcc +LD := $(CROSS)ld +OBJCOPY := $(CROSS)objcopy + +CFLAGS := -nostdlib -ffreestanding -mgeneral-regs-only \ + -fno-builtin -fno-stack-protector -fno-pie -no-pie \ + -Wall -Werror -O2 \ + -Iinclude -Iarch/arm64/include + +LDFLAGS := -T arch/arm64/kernel/tashaboot.lds + +OBJS := arch/arm64/kernel/start.o \ + arch/arm64/kernel/exceptions.o \ + arch/arm64/kernel/halt.o \ + arch/arm64/kernel/boot.o \ + arch/arm64/lib/cache.o \ + arch/arm64/lib/semihosting.o \ + common/main.o common/console.o common/image.o common/load.o \ + lib/printf.o lib/itoa.o lib/semihosting.o \ + $(patsubst %.c,%.o,$(wildcard lib/string/*.c)) + +all: build/tashaboot.bin + +build/tashaboot.elf: $(OBJS) arch/arm64/kernel/tashaboot.lds + mkdir -p build + $(LD) $(LDFLAGS) -o $@ $(OBJS) + +build/tashaboot.bin: build/tashaboot.elf + $(OBJCOPY) -O binary $< $@ + +%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< + +%.o: %.S + $(CC) $(CFLAGS) -c -o $@ $< + +run: all + qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -no-reboot \ + -semihosting -kernel build/tashaboot.bin + +clean: + rm -rf build $(OBJS) + +.PHONY: all run clean |
