summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBradley Morgan <brads@mainlining.org>2026-10-04 10:42:10 +0000
committerBradley Morgan <brads@mainlining.org>2026-10-04 10:46:46 +0000
commit5ff54a875642962fc857cee00bde17f9a465f1fa (patch)
treeb265a12d538167c3bbb86b24118a7ad7a062fc74 /Makefile
tashaboot: arm64 bootloaderHEADmain
holy shit it's here, Tashaboot, based from arm arm, enjoy reading this masterpiece Signed-off-by: Bradley Morgan <brads@mainlining.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile61
1 files changed, 61 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..eff00a7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,61 @@
+# 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/monitor.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 arch/arm64/lib/gic.o \
+ arch/arm64/lib/mmu.o \
+ arch/arm64/lib/psci.o \
+ arch/arm64/lib/system.o \
+ arch/arm64/lib/cache_va.o \
+ arch/arm64/lib/timer.o \
+ common/main.o common/console.o common/image.o common/load.o \
+ common/mmutest.o common/dtb_patch.o common/dtb_reloc.o \
+ common/dtb_grow.o common/dtb_find.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 $< $@
+ python3 tools/fillsize.py $@
+
+%.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