[PATCH v4] Add make feature support for SoCFPGA Handoff

Brian Sune
2025-11-03T23:44:45Z

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
HANDOFF_PATH user define: override the auto detection in board folder

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

diff --git a/Makefile b/Makefile
index 32568a6c477..f5efe679259 100644
--- a/Makefile
+++ b/Makefile
@@ -2207,23 +2207,28 @@ socfpga_g5_hanoff_prepare:
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..."; \
+ if [ -n "$$HANDOFF_PATH" ]; then \
+ echo "[INFO] Using manually assigned handoff path: $$HANDOFF_PATH"; \
+ else \
+ 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; \
+ HANDOFF_PATH=$$BOARD_DIR/hps_isw_handoff/$$HANDOFF_FOLDER_NAME; \
fi; \
python3 tools/cv_bsp_generator/cv_bsp_generator.py \
- -i $$BOARD_DIR/hps_isw_handoff/$$HANDOFF_FOLDER_NAME \
+ -i $$HANDOFF_PATH \
-o $$BOARD_DIR/qts || echo "[WARN] BSP generator failed, continuing..."; \
echo "[DONE] SoCFPGA QTS handoff conversion complete."

--
2.25.1