public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Brian Sune <briansune@gmail.com>
To: Tom Rini <trini@konsulko.com>, u-boot@lists.denx.de
Subject: [PATCH v1] Add make feature support for SoCFPGA Handoff
Date: Sat,  1 Nov 2025 11:28:50 +0800	[thread overview]
Message-ID: <20251101032850.1674-1-briansune@gmail.com> (raw)

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.

Signed-off-by: Brian Sune <briansune@gmail.com>
---
 Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/Makefile b/Makefile
index 750f8a84b1f..74474368413 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \
-- 
2.25.1


                 reply	other threads:[~2025-11-01  3:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251101032850.1674-1-briansune@gmail.com \
    --to=briansune@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox