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
+44 -16
View File
@@ -4,9 +4,11 @@
#
# Quick Start:
# make - Build for host arch (fastest profile, always)
# make T=raspi - Build for Raspberry Pi 4 (T= is a shorthand for ARCH=)
# make T=amd64 - Build for x86_64
# make T=riscv64 - Build for RISC-V 64
# make T=qemu - Build portable x86-64 for QEMU
# make T=pc - Build for x86-64 PC (native tuning)
# make T=pi4 - Cross-compile for Raspberry Pi 4 (Cortex-A72)
# make T=pi5 - Cross-compile for Raspberry Pi 5 (Cortex-A76)
# make T=milkv - Cross-compile for Milk-V Pioneer (RISC-V 64)
# make help - Show all available targets
#
# ==============================================================================
@@ -23,10 +25,8 @@ CC = gcc
# See docs/DEVELOPER.md for installation instructions
ISABELLE ?= isabelle
# Architecture / target selection — T= is a shorthand for ARCH= (board/SBC)
ifdef T
ARCH ?= $(T)
endif
# Board / architecture selection — T= picks a board (see mk/boards.mk)
include mk/boards.mk
ARCH ?= $(shell uname -m)
ARCH := $(strip $(ARCH))
TARGET := fastest
@@ -105,6 +105,33 @@ else
ASM_SYNTAX =
endif
# Board-specific overrides — refine arch defaults for exact hardware
# QEMU: use portable baseline, not -march=native
ifeq ($(BOARD),qemu)
ARCH_FLAGS := -march=x86-64 -mtune=generic
ARCH_DEFINES += -DBOARD_QEMU=1
# PC: native tuning (already the amd64 default; explicit for clarity)
else ifeq ($(BOARD),pc)
ARCH_FLAGS := -march=native
ARCH_DEFINES += -DBOARD_PC=1
# Raspberry Pi 4 — Cortex-A72, ARMv8-A
else ifeq ($(BOARD),pi4)
ARCH_FLAGS := -march=armv8-a+crc+simd -mtune=cortex-a72
ARCH_DEFINES += -DBOARD_RPI4=1 -DRASPBERRY_PI_BUILD=1
# Raspberry Pi 5 — Cortex-A76, ARMv8.2-A
else ifeq ($(BOARD),pi5)
ARCH_FLAGS := -march=armv8.2-a+crypto+fp16+rcpc+dotprod -mtune=cortex-a76
ARCH_DEFINES += -DBOARD_RPI5=1 -DRASPBERRY_PI_BUILD=1
# Milk-V Pioneer — SG2042 RISC-V 64
else ifeq ($(BOARD),milkv)
ARCH_FLAGS := -march=rv64gc -mabi=lp64d -mcmodel=medany
ARCH_DEFINES += -DBOARD_MILKV=1
endif
# Use board name in ARCH_NAME when T= is set
ifdef BOARD_NAME
ARCH_NAME := $(BOARD_NAME)
endif
# Compiler flags
# Feature switches (default: enabled)
# Physics/SSM knob family: repointed through the Kconfig bridge (see
@@ -1251,18 +1278,19 @@ help:
@echo "════════════════════════════════════════════════════════════"
@echo ""
@echo "🛠️ Variables:"
@echo " ARCH=<arch> (default: $(ARCH); canonical directory: $(ARCH_DIR))"
@echo " TARGET=<profile> (standard | fast | fastest | turbo)"
@echo " T=<board> Board target (preferred). Supported:"
@echo " qemu — portable x86-64 for QEMU"
@echo " pc — x86-64 PC (native tuning)"
@echo " pi4 — Raspberry Pi 4 (Cortex-A72)"
@echo " pi5 — Raspberry Pi 5 (Cortex-A76)"
@echo " milkv — Milk-V Pioneer (SG2042 RISC-V 64)"
@echo " ARCH=<arch> Low-level arch override (amd64 | arm64 | riscv64)"
@echo " Active: $(ARCH) / board: $(or $(BOARD_NAME),$(ARCH_NAME))"
@echo ""
@echo "🏆 OPTIMIZATION BUILDS:"
@echo " fastest - Maximum performance (ASM + direct threading + LTO)"
@echo " fast - Fast without LTO (easier debugging)"
@echo " turbo - Assembly optimizations only"
@echo "🏆 BUILD PROFILE: fastest (always — ASM + direct threading + LTO)"
@echo ""
@echo "🥧 PLATFORM-SPECIFIC BUILDS:"
@echo " rpi4 - Native build on Raspberry Pi 4"
@echo " rpi4-cross - Cross-compile from x86_64"
@echo " rpi4-fastest - Maximum optimization for RPi4"
@echo " rpi4-cross - Cross-compile for Raspberry Pi 4 (legacy; use T=pi4)"
@echo " riscv64-clang - Cross-compile for RISC-V 64 via clang (GCC fails here)"
@echo " minimal - Minimal/embedded build"
@echo ""