Skip to contentSkip to conversation

Add make feature support for SoCFPGA Handoff

PATCH Superseded Brian Sune 1 participant 1 message Nov 1, 2025 Kbuild

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Brian Sune

author
#0 lore raw

PATCH 1/1 Add make feature support for SoCFPGA Handoff

Added new make command to support Altera GEN5 SoCFPGA handoff conversion. The new make qts_handoff_gen will use two parameters QTS_DIR and HANDOFF_DIR. Checking is done via .config SoCFPGA family selection and directory existency.

---
 Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
Makefile +42 -0
index 750f8a84b1f..74474368413 100644
@@ -485,6 +485,48 @@ CFLAGS_KERNEL	=
 AFLAGS_KERNEL	=
 LDFLAGS_vmlinux =
 
+# Intel-Altera Gen5 SoCFPGA QTS Handoff generator target (detect SoC from .config)
+QTS_HANDOFF_GEN_PY  := $(CURDIR)/tools/cv_bsp_generator/cv_bsp_generator.py
+
+# Detect SOC family from .config
+SOC_FAMILY := $(shell \
+	if grep -q '^CONFIG_TARGET_SOCFPGA_CYCLONE5=y' .config; then \
+		echo cyclone5; \
+	elif grep -q '^CONFIG_TARGET_SOCFPGA_ARRIA5=y' .config; then \
+		echo arria5; \
+	elif grep -q '^CONFIG_TARGET_SOCFPGA_ARRIA10=y' .config; then \
+		echo arria10; \
+	else \
+		echo unknown; \
+	fi)
+
+.PHONY: qts_handoff_gen
+qts_handoff_gen:
+	@if [ ! -f .config ]; then \
+		echo "Error: .config not found. Run 'make <defconfig>' first."; \
+		exit 1; \
+	fi
+	@if [ "$(SOC_FAMILY)" = "unknown" ]; then \
+		echo "Error: Could not detect SoCFPGA family from .config"; \
+		exit 1; \
+	fi
+	@if [ ! -d "$(HANDOFF_DIR)" ]; then \
+		echo "Error: handoff directory '$(HANDOFF_DIR)' does not exist."; \
+		exit 1; \
+	fi
+	@if [ -z "$(QTS_DIR)" ]; then \
+		echo "Error: QTS_DIR is not defined."; \
+		exit 1; \
+	fi
+	@if [ ! -d "$(CURDIR)/board/$(QTS_DIR)/qts" ]; then \
+		echo "Creating QTS output directory: $(CURDIR)/board/$(QTS_DIR)/qts"; \
+		exit 1; \
+	fi
+	@echo "=== Detected SoCFPGA family: $(SOC_FAMILY) ==="
+	@echo "=== Generating BSP to $(CURDIR)/board/$(QTS_DIR)/qts ==="
+	python3 $(QTS_HANDOFF_GEN_PY) -i $(HANDOFF_DIR) -o $(CURDIR)/board/$(QTS_DIR)/qts
+	@echo "=== QTS generation complete ==="
+
 # Use USERINCLUDE when you must reference the UAPI directories only.
 USERINCLUDE    := \
 		-I$(srctree)/arch/$(SRCARCH)/include/uapi \
Signature · 1 line
2.25.1