From: Brian Sune <briansune@gmail.com>
To: Tom Rini <trini@konsulko.com>, u-boot@lists.denx.de
Subject: [PATCH v3] Add make feature support for SoCFPGA Handoff
Date: Tue, 4 Nov 2025 06:28:40 +0800 [thread overview]
Message-ID: <20251103222840.458-1-briansune@gmail.com> (raw)
Introduce socfpga_gen5_handoff_prepare target in U-Boot Makefile
Automatically detects Altera/Intel SoCFPGA boards from .config
Checks for presence of hps_isw_handoff folder and .hiof files
Runs BSP generator script tools/cv_bsp_generator/cv_bsp_generator.py
if files exist.
Non-blocking: prepare continues even if handoff folder or files are missing
Signed-off-by: Brian Sune <briansune@gmail.com>
---
Makefile | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 750f8a84b1f..32568a6c477 100644
--- a/Makefile
+++ b/Makefile
@@ -2158,7 +2158,7 @@ scripts: scripts_basic scripts_dtc
# archprepare is used in arch Makefiles and when processed asm symlink,
# version.h and scripts_basic is processed / created.
-PHONY += prepare archprepare prepare1 prepare3
+PHONY += prepare archprepare prepare1 prepare3 socfpga_g5_hanoff_prepare
# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
@@ -2190,8 +2190,45 @@ archprepare: prepare1 scripts
prepare0: archprepare
$(Q)$(MAKE) $(build)=.
+# Intel-Altera SoCFPGA GEN5 prepare handoff file conversion
+socfpga_g5_hanoff_prepare:
+ @VENDOR=$$(grep -E '^CONFIG_SYS_VENDOR=' .config | cut -d'"' -f2); \
+ BOARD=$$(grep -E '^CONFIG_SYS_BOARD=' .config | cut -d'"' -f2); \
+ if [ -z "$$VENDOR" ] || [ -z "$$BOARD" ]; then \
+ exit 0; \
+ fi; \
+ if grep -q 'CONFIG_TARGET_SOCFPGA_CYCLONE5=y' .config; then \
+ SOCFAMILY=cyclone5; \
+ elif grep -q 'CONFIG_TARGET_SOCFPGA_ARRIA5=y' .config; then \
+ SOCFAMILY=arria5; \
+ elif grep -q 'CONFIG_TARGET_SOCFPGA_ARRIA10=y' .config; then \
+ SOCFAMILY=arria10; \
+ else \
+ exit 0; \
+ fi; \
+ BOARD_DIR=board/$$VENDOR/$$BOARD; \
+ HANDOFF_BASE=$$BOARD_DIR/hps_isw_handoff; \
+ if [ ! -d $$HANDOFF_BASE ]; then \
+ exit 0; \
+ fi; \
+ echo "[INFO] Handoff folder found: $$HANDOFF_BASE"; \
+ HANDOFF_FOLDER_NAME=$$(basename "$$(find $$HANDOFF_BASE -mindepth 1 -maxdepth 1 -type d | head -n1)"); \
+ if [ -z "$$HANDOFF_FOLDER_NAME" ]; then \
+ exit 0; \
+ fi; \
+ echo "[INFO] Handoff subfolder found under $$HANDOFF_BASE"; \
+ if [ -f $$HANDOFF_BASE/$$HANDOFF_FOLDER_NAME/$$HANDOFF_FOLDER_NAME.hiof ]; then \
+ echo "[INFO] Found hiof file: $$HANDOFF_BASE/$$HANDOFF_FOLDER_NAME/$$HANDOFF_FOLDER_NAME.hiof"; \
+ echo "[INFO] Using handoff folder: $$HANDOFF_FOLDER_NAME"; \
+ echo "[INFO] Running BSP generator..."; \
+ fi; \
+ python3 tools/cv_bsp_generator/cv_bsp_generator.py \
+ -i $$BOARD_DIR/hps_isw_handoff/$$HANDOFF_FOLDER_NAME \
+ -o $$BOARD_DIR/qts || echo "[WARN] BSP generator failed, continuing..."; \
+ echo "[DONE] SoCFPGA QTS handoff conversion complete."
+
# All the preparing..
-prepare: prepare0 prepare-objtool
+prepare: prepare0 prepare-objtool socfpga_g5_hanoff_prepare
# Support for using generic headers in asm-generic
asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
--
2.25.1
next reply other threads:[~2025-11-03 22:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 22:28 Brian Sune [this message]
2025-11-03 22:33 ` [PATCH v3] Add make feature support for SoCFPGA Handoff Tom Rini
2025-11-03 22:52 ` Sune Brian
2025-11-03 23:05 ` Tom Rini
2025-11-03 23:10 ` Sune Brian
2025-11-03 23:23 ` Tom Rini
2025-11-03 23:40 ` Sune Brian
2025-11-04 0:16 ` Sune Brian
2025-11-03 22:58 ` Sune Brian
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=20251103222840.458-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.