build: introduce mk/boards.mk board target table, T= selects board
Build / build-amd64-iso (push) Failing after 38s
Build / build-aarch64-iso (push) Failing after 34s
Build / build-riscv64-img (push) Failing after 28s

T= now names a specific board (qemu, pc, pi4, pi5, milkv) rather than
an arch alias. mk/boards.mk is the single table: sets ARCH, BOARD, and
BOARD_NAME. Each Makefile applies board-specific compiler flags after its
arch block — pi5 gets Cortex-A76 tuning, pi4 gets Cortex-A72, qemu uses
portable x86-64 baseline instead of -march=native. Zynq-7020 is stubbed
in comments for future 32-bit ARM support. ARCH= override still works
for raw arch selection without a named board.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 04:10:07 +00:00
co-authored by Claude Sonnet 4.6
parent 81caf71511
commit 0820ee7d32
3 changed files with 117 additions and 27 deletions
+25 -11
View File
@@ -26,10 +26,8 @@ canon_arch = $(strip \
$(if $(filter riscv riscv64,$1),riscv64,$1))))))
UNAME_M := $(shell uname -m)
# T= is a shorthand for ARCH= (board/SBC selection)
ifdef T
ARCH ?= $(T)
endif
# T= selects the board target (see mk/boards.mk for the full table)
include mk/boards.mk
ARCH ?= $(call canon_arch,$(UNAME_M))
override ARCH := $(call canon_arch,$(ARCH))
@@ -245,6 +243,13 @@ endif
LOADER_CC ?= $(CC)
LOADER_LD ?= $(LD)
# Board-specific ARCH_CFLAGS overrides — refine CPU tuning beyond arch default
ifeq ($(BOARD),pi4)
ARCH_CFLAGS := -march=armv8-a -mcpu=cortex-a72 -DARCH_AARCH64 -mno-outline-atomics
else ifeq ($(BOARD),pi5)
ARCH_CFLAGS := -march=armv8.2-a -mcpu=cortex-a76 -DARCH_AARCH64 -mno-outline-atomics
endif
# ==============================================================================
# COMPILER FLAGS
# ==============================================================================
@@ -1246,6 +1251,7 @@ endif
info:
@echo "StarKernel Build Configuration"
@echo "==============================="
@echo "Board: $(or $(BOARD_NAME),$(ARCH) (no board selected))"
@echo "Architecture: $(ARCH)"
@echo "Target: $(TARGET)"
@echo "Compiler: $(CC)"
@@ -1263,10 +1269,17 @@ help:
@echo "StarKernel Build System"
@echo "======================="
@echo ""
@echo "Usage: make -f Makefile.starkernel [ARCH=<arch>] [TARGET=<target>] <goal>"
@echo "Usage: make -f Makefile.starkernel [T=<board>] [TARGET=<target>] <goal>"
@echo ""
@echo "Architectures (aliases accepted):"
@echo " ARCH=amd64 / x86_64 — x86-64 (default on x86 host)"
@echo "Board targets (T=):"
@echo " T=qemu — QEMU x86_64 (portable baseline)"
@echo " T=pc — x86_64 PC (native tuning)"
@echo " T=pi4 — Raspberry Pi 4 (Cortex-A72, aarch64)"
@echo " T=pi5 — Raspberry Pi 5 (Cortex-A76, aarch64)"
@echo " T=milkv — Milk-V Pioneer (SG2042, riscv64)"
@echo ""
@echo "Low-level arch override (bypasses board table):"
@echo " ARCH=amd64 / x86_64 — x86-64"
@echo " ARCH=aarch64 / arm64 — ARM64"
@echo " ARCH=riscv64 / riscv — RISC-V 64-bit"
@echo ""
@@ -1293,8 +1306,9 @@ help:
@echo " help — show this message"
@echo ""
@echo "Examples:"
@echo " make -f Makefile.starkernel ARCH=amd64 qemu"
@echo " make -f Makefile.starkernel ARCH=aarch64 clean qemu"
@echo " make -f Makefile.starkernel ARCH=riscv64 clean qemu"
@echo " make -f Makefile.starkernel ARCH=x86_64 qemu # alias works"
@echo " make -f Makefile.starkernel T=qemu qemu"
@echo " make -f Makefile.starkernel T=pi4 clean qemu"
@echo " make -f Makefile.starkernel T=pi5 clean qemu"
@echo " make -f Makefile.starkernel T=milkv clean all"
@echo " make -f Makefile.starkernel kernel-all"
@echo " make -f Makefile.starkernel ARCH=riscv64 clean qemu # arch override still works"