diff options
| author | Bradley Morgan <brads@mainlining.org> | 2026-10-03 18:57:38 +0000 |
|---|---|---|
| committer | Bradley Morgan <brads@mainlining.org> | 2026-10-03 18:57:38 +0000 |
| commit | 00fc82f17cff9295387d516384ecdc443acb1b22 (patch) | |
| tree | 798bef0185878286028fe0eaf7594616a66903e4 /Makefile | |
| parent | 7e8514efb64774b6a635b87ae945e519a7c38551 (diff) | |
tashaboot: arm64 bringup, semihosting payload loader
consoles on the pl011 the dtb points at, walks the memory node and
chosen, loads an arm64 kernel Image over semihosting and jumps to it
with the documented register state. string functions, printf and
libfdt are vendored from lk (lk2nd) and u-boot so the libc surface is
the one those projects already proved. built and booted on qemu virt,
payload exits clean through semihosting.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..023c383 --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +# tashaboot +# +# build: make CROSS=aarch64-linux-gnu- +# run: make run (qemu virt, semihosting, Image on the host) +# +# the dtb is the board config, no board.h exists anywhere. + +CROSS ?= aarch64-linux-gnu- +CC := $(CROSS)gcc +LD := $(CROSS)ld +OBJCOPY := $(CROSS)objcopy +DTC ?= dtc + +CFLAGS := -nostdlib -ffreestanding -mgeneral-regs-only \ + -fno-builtin -fno-stack-protector -fno-pie -no-pie \ + -Wall -Werror -O2 \ + -Iinclude -Iarch/arm64/include -Ilib/libfdt + +LDFLAGS := -T arch/arm64/kernel/tashaboot.lds + +OBJS := arch/arm64/kernel/start.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 \ + drivers/serial/pl011.o \ + lib/printf.o lib/itoa.o lib/semihosting.o \ + $(patsubst %.c,%.o,$(wildcard lib/string/*.c)) \ + $(patsubst %.c,%.o,$(filter-out lib/libfdt/libfdt_env.h,$(wildcard lib/libfdt/*.c))) + +all: build/tashaboot.bin build/qemu-virt.dtb + +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 $< $@ + +build/qemu-virt.dtb: dts/qemu-virt.dts + mkdir -p build + $(DTC) -o $@ $< + +%.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 config=all,enable=on -dtb build/qemu-virt.dtb \ + -kernel build/tashaboot.bin + +clean: + rm -rf build $(OBJS) + +.PHONY: all run clean |
