Skip to contentSkip to conversation

Add optimized Makefile support for SoCFPGA handoff

PATCH Superseded Brian Sune 2 participants 8 messages Nov 4, 2025 – Nov 21, 2025

Subsystems (3)

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Brian Sune

author
#0 lore raw

PATCH v7 1/1 Add optimized Makefile support for SoCFPGA handoff

Add optimized Makefile support for SoCFPGA handoff

- Introduce socfpga_g5_hanoff_prepare target in U-Boot arch/arm/mach-socfpga/config.mk
- Users can convert the handoff via make prepare.
- Detects Altera/Intel SoCFPGA boards from .config
- Combines vendor/board extraction into a single shell call
- Checks for hps_isw_handoff folder and .hiof files
- Uses ls -d instead of find for faster folder detection
- Runs BSP generator script only if files exist
- Non-blocking: continues if handoff folder or files are missing
- HANDOFF_PATH user define allows overriding auto-detected folder
- Minimizes subshells and other slow constructs for faster CI

---
 arch/arm/mach-socfpga/config.mk | 50 +++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/config.mk
arch/arm/mach-socfpga/config.mk new file +50 -0
new file mode 100644
index 00000000000..df1eb909129
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Brian Sune <[email protected]>
+
+ifeq ($(CONFIG_TARGET_SOCFPGA_CYCLONE5),y)
+archprepare: socfpga_g5_hanoff_prepare
+else ifeq ($(CONFIG_TARGET_SOCFPGA_ARRIA5),y)
+archprepare: socfpga_g5_hanoff_prepare
+else ifeq ($(CONFIG_TARGET_SOCFPGA_ARRIA10),y)
+archprepare: socfpga_g5_hanoff_prepare
+endif
+
+socfpga_g5_hanoff_prepare:
+	@SOCFAMILY="$(SOCFAMILY)"; \
+		if [ -z "$$SOCFAMILY" ]; then \
+			exit 0; \
+		fi; \
+		echo "[INFO] SOC family detected: $$SOCFAMILY";
+		@set -- $$(awk -F'"' ' \
+		    /^CONFIG_SYS_VENDOR=/ {v=$$2} \
+		    /^CONFIG_SYS_BOARD=/ {b=$$2} \
+		    END {print v, b}' .config); \
+		VENDOR=$$1; \
+		BOARD=$$2; \
+		if [ -z "$$VENDOR" ] || [ -z "$$BOARD" ]; then \
+			exit 0; \
+		fi; \
+		BOARD_DIR=$(src)/board/$$VENDOR/$$BOARD; \
+		if [ "$$HANDOFF_PATH" ]; then \
+			echo "[INFO] Using manually specified handoff folder: $$HANDOFF_PATH"; \
+		else \
+			HANDOFF_BASE=$$BOARD_DIR/hps_isw_handoff; \
+			if [ ! -d "$$HANDOFF_BASE" ]; then \
+				exit 0; \
+			fi; \
+			HANDOFF_PATH=$$(ls -d "$$HANDOFF_BASE"/*/ 2>/dev/null | head -n1); \
+			if [ -z "$$HANDOFF_PATH" ]; then \
+				exit 0; \
+			fi; \
+			echo "[INFO] Auto-detected handoff folder: $$HANDOFF_PATH"; \
+		fi; \
+		HIOF_FILE=$$HANDOFF_PATH/$$(basename $$HANDOFF_PATH).hiof; \
+		if [ ! -f "$$HIOF_FILE" ]; then \
+			echo "[WARN] No .hiof file found in $$HANDOFF_PATH, skipping BSP generation."; \
+			exit 0; \
+		fi; \
+		echo "[INFO] Found hiof file: $$HIOF_FILE"; \
+		echo "[INFO] Running BSP generator..."; \
+		python3 $(src)/tools/cv_bsp_generator/cv_bsp_generator.py -i "$$HANDOFF_PATH" -o "$$BOARD_DIR/qts" || echo "[WARN] BSP generator failed, continuing..."; \
+		echo "[DONE] SoCFPGA QTS handoff conversion complete."
Signature · 1 line
2.25.1
author
#1 lore raw
Quoted 13 lines

Add optimized Makefile support for SoCFPGA handoff

- Introduce socfpga_g5_hanoff_prepare target in U-Boot arch/arm/mach-socfpga/config.mk
- Users can convert the handoff via make prepare.
- Detects Altera/Intel SoCFPGA boards from .config
- Combines vendor/board extraction into a single shell call
- Checks for hps_isw_handoff folder and .hiof files
- Uses ls -d instead of find for faster folder detection
- Runs BSP generator script only if files exist
- Non-blocking: continues if handoff folder or files are missing
- HANDOFF_PATH user define allows overriding auto-detected folder
- Minimizes subshells and other slow constructs for faster CI

Any trouble on this new compile flow?

Brian

#2 lore raw
In reply to Brian Sune

Hi Brian,

Quoted 26 lines · Brian Sune

Add optimized Makefile support for SoCFPGA handoff

- Introduce socfpga_g5_hanoff_prepare target in U-Boot arch/arm/mach-socfpga/config.mk
- Users can convert the handoff via make prepare.
- Detects Altera/Intel SoCFPGA boards from .config
- Combines vendor/board extraction into a single shell call
- Checks for hps_isw_handoff folder and .hiof files
- Uses ls -d instead of find for faster folder detection
- Runs BSP generator script only if files exist
- Non-blocking: continues if handoff folder or files are missing
- HANDOFF_PATH user define allows overriding auto-detected folder
- Minimizes subshells and other slow constructs for faster CI

---
  arch/arm/mach-socfpga/config.mk | 50 +++++++++++++++++++++++++++++++++
  1 file changed, 50 insertions(+)

create mode 100644 arch/arm/mach-socfpga/config.mk

arch/arm/mach-socfpga/config.mk new file +0 -0
new file mode 100644
index 00000000000..df1eb909129

arch/arm/mach-socfpga/config.mk line 6

Quoted 6 lines
arch/arm/mach-socfpga/config.mk new file +6 -0
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Brian Sune<[email protected]>
+
+ifeq ($(CONFIG_TARGET_SOCFPGA_CYCLONE5),y)
+archprepare: socfpga_g5_hanoff_prepare

Typo: socfpga_g5_hanoff_prepar, it should be socfpga_g5_handoff_prepare

arch/arm/mach-socfpga/config.mk line 9

Quoted 3 lines
arch/arm/mach-socfpga/config.mk new file +3 -0
+else ifeq ($(CONFIG_TARGET_SOCFPGA_ARRIA5),y)
+archprepare: socfpga_g5_hanoff_prepare
+else ifeq ($(CONFIG_TARGET_SOCFPGA_ARRIA10),y)

You are binding the rule to:
Cyclone V
Arria V
Arria 10

However, cv_bsp_generator.py applies only to Cyclone V and Arria V. Arria 10 does not use |.hiof| and does**not**use the CV BSP generator.

So this part should /not/ include Arria 10

Quoted 30 lines
arch/arm/mach-socfpga/config.mk new file +30 -0
+archprepare: socfpga_g5_hanoff_prepare
+endif
+
+socfpga_g5_hanoff_prepare:
+	@SOCFAMILY="$(SOCFAMILY)"; \
+		if [ -z "$$SOCFAMILY" ]; then \
+			exit 0; \
+		fi; \
+		echo "[INFO] SOC family detected: $$SOCFAMILY";
+		@set -- $$(awk -F'"' ' \
+		    /^CONFIG_SYS_VENDOR=/ {v=$$2} \
+		    /^CONFIG_SYS_BOARD=/ {b=$$2} \
+		    END {print v, b}' .config); \
+		VENDOR=$$1; \
+		BOARD=$$2; \
+		if [ -z "$$VENDOR" ] || [ -z "$$BOARD" ]; then \
+			exit 0; \
+		fi; \
+		BOARD_DIR=$(src)/board/$$VENDOR/$$BOARD; \
+		if [ "$$HANDOFF_PATH" ]; then \
+			echo "[INFO] Using manually specified handoff folder: $$HANDOFF_PATH"; \
+		else \
+			HANDOFF_BASE=$$BOARD_DIR/hps_isw_handoff; \
+			if [ ! -d "$$HANDOFF_BASE" ]; then \
+				exit 0; \
+			fi; \
+			HANDOFF_PATH=$$(ls -d "$$HANDOFF_BASE"/*/ 2>/dev/null | head -n1); \
+			if [ -z "$$HANDOFF_PATH" ]; then \
+				exit 0; \
+			fi; \

arch/arm/mach-socfpga/config.mk line 49

Quoted 10 lines
arch/arm/mach-socfpga/config.mk new file +10 -0
+			echo "[INFO] Auto-detected handoff folder: $$HANDOFF_PATH"; \
+		fi; \
+		HIOF_FILE=$$HANDOFF_PATH/$$(basename $$HANDOFF_PATH).hiof; \
+		if [ ! -f "$$HIOF_FILE" ]; then \
+			echo "[WARN] No .hiof file found in $$HANDOFF_PATH, skipping BSP generation."; \
+			exit 0; \
+		fi; \
+		echo "[INFO] Found hiof file: $$HIOF_FILE"; \
+		echo "[INFO] Running BSP generator..."; \
+		python3 $(src)/tools/cv_bsp_generator/cv_bsp_generator.py -i "$$HANDOFF_PATH" -o "$$BOARD_DIR/qts" || echo "[WARN] BSP generator failed, continuing..."; \

Arria 10 boards require the A10-specific filter script under: arch/arm/mach-socfpga/qts-filter-a10.sh

Invocation pattern: qts-filter-a10.sh <handoff-input-directory> <output-qts-dir>

It processes a set of A10-specific XML and RBF inputs such as:

pinmux.xml
arria10_hps.xml
pll.xml
emif.xml
core.rbf
other Qsys-exported XML files

Because of this, the .hiof detection logic you added will always fail on Arria 10, and the QTS conversion will silently be skipped.

arch/arm/mach-socfpga/config.mk line 50

Quoted 1 line
arch/arm/mach-socfpga/config.mk new file +1 -0
+		echo "[DONE] SoCFPGA QTS handoff conversion complete."

Thanks.

Tien Fong

author
#3 lore raw

typo aligned on both so it wont be an issue from first place. However indeed should be fixed to let user readable.

Remove: else ifeq ($(CONFIG_TARGET_SOCFPGA_ARRIA10),y) is enough meanwhile when users don't place any folder or path parameter it will simply bypassed.

Brian

Quoted 87 lines
(quoted diff) +2 -0
+ifeq ($(CONFIG_TARGET_SOCFPGA_CYCLONE5),y)
+archprepare: socfpga_g5_hanoff_prepare

Typo: socfpga_g5_hanoff_prepar, it should be socfpga_g5_handoff_prepare

arch/arm/mach-socfpga/config.mk new file +3 -0
+else ifeq ($(CONFIG_TARGET_SOCFPGA_ARRIA5),y)
+archprepare: socfpga_g5_hanoff_prepare
+else ifeq ($(CONFIG_TARGET_SOCFPGA_ARRIA10),y)

You are binding the rule to:
Cyclone V
Arria V
Arria 10

However, cv_bsp_generator.py applies only to Cyclone V and Arria V. Arria 10 does not use .hiof and does not use the CV BSP generator.

So this part should not include Arria 10

arch/arm/mach-socfpga/config.mk new file +40 -0
+archprepare: socfpga_g5_hanoff_prepare
+endif
+
+socfpga_g5_hanoff_prepare:
+ @SOCFAMILY="$(SOCFAMILY)"; \
+ if [ -z "$$SOCFAMILY" ]; then \
+ exit 0; \
+ fi; \
+ echo "[INFO] SOC family detected: $$SOCFAMILY";
+ @set -- $$(awk -F'"' ' \
+    /^CONFIG_SYS_VENDOR=/ {v=$$2} \
+    /^CONFIG_SYS_BOARD=/ {b=$$2} \
+    END {print v, b}' .config); \
+ VENDOR=$$1; \
+ BOARD=$$2; \
+ if [ -z "$$VENDOR" ] || [ -z "$$BOARD" ]; then \
+ exit 0; \
+ fi; \
+ BOARD_DIR=$(src)/board/$$VENDOR/$$BOARD; \
+ if [ "$$HANDOFF_PATH" ]; then \
+ echo "[INFO] Using manually specified handoff folder: $$HANDOFF_PATH"; \
+ else \
+ HANDOFF_BASE=$$BOARD_DIR/hps_isw_handoff; \
+ if [ ! -d "$$HANDOFF_BASE" ]; then \
+ exit 0; \
+ fi; \
+ HANDOFF_PATH=$$(ls -d "$$HANDOFF_BASE"/*/ 2>/dev/null | head -n1); \
+ if [ -z "$$HANDOFF_PATH" ]; then \
+ exit 0; \
+ fi; \
+ echo "[INFO] Auto-detected handoff folder: $$HANDOFF_PATH"; \
+ fi; \
+ HIOF_FILE=$$HANDOFF_PATH/$$(basename $$HANDOFF_PATH).hiof; \
+ if [ ! -f "$$HIOF_FILE" ]; then \
+ echo "[WARN] No .hiof file found in $$HANDOFF_PATH, skipping BSP generation."; \
+ exit 0; \
+ fi; \
+ echo "[INFO] Found hiof file: $$HIOF_FILE"; \
+ echo "[INFO] Running BSP generator..."; \
+ python3 $(src)/tools/cv_bsp_generator/cv_bsp_generator.py -i "$$HANDOFF_PATH" -o "$$BOARD_DIR/qts" || echo "[WARN] BSP generator failed, continuing..."; \

Arria 10 boards require the A10-specific filter script under: arch/arm/mach-socfpga/qts-filter-a10.sh

Invocation pattern: qts-filter-a10.sh <handoff-input-directory> <output-qts-dir>

It processes a set of A10-specific XML and RBF inputs such as:

pinmux.xml
arria10_hps.xml
pll.xml
emif.xml
core.rbf
other Qsys-exported XML files

Because of this, the .hiof detection logic you added will always fail on Arria 10, and the QTS conversion will silently be skipped.

+ echo "[DONE] SoCFPGA QTS handoff conversion complete."

Thanks.

Tien Fong

author
#4 lore raw
In reply to Chee, Tien Fong
Quoted 4 lines

Arria 10 boards require the A10-specific filter script under: arch/arm/mach-socfpga/qts-filter-a10.sh

Invocation pattern: qts-filter-a10.sh <handoff-input-directory> <output-qts-dir>

Quoted 8 lines

It processes a set of A10-specific XML and RBF inputs such as:

pinmux.xml
arria10_hps.xml
pll.xml
emif.xml
core.rbf
other Qsys-exported XML files

I had provided new patch and removed the A10.

Second because this is bash script and according to what the new tools are supposed to look like. Python script is new tools language and should be followed accordingly.

As such I will not going to merge A10 to this build flow. And any new family handoff should also put to the same location as Tom suggestion and also make things more clean and better on manage. u-boot/tools/a10_bsp_generator.

Meantime, I think it is even better on generalizing one folder for all Altera socfpga tools, with requirements.txt as well.

Brian

#5 lore raw

Hi Brian,

Quoted 27 lines · Sune Brian

[CAUTION: This email is from outside your organization. Unless you trust the sender, do not click on links or open attachments as it may be a fraudulent email attempting to steal your information and/or compromise your computer.]

Quoted 4 lines

Arria 10 boards require the A10-specific filter script under: arch/arm/mach-socfpga/qts-filter-a10.sh

Invocation pattern: qts-filter-a10.sh <handoff-input-directory> <output-qts-dir>

Quoted 8 lines

It processes a set of A10-specific XML and RBF inputs such as:

pinmux.xml
arria10_hps.xml
pll.xml
emif.xml
core.rbf
other Qsys-exported XML files

I had provided new patch and removed the A10.

Second because this is bash script and according to what the new tools are supposed to look like. Python script is new tools language and should be followed accordingly.

As such I will not going to merge A10 to this build flow. And any new family handoff should also put to the same location as Tom suggestion and also make things more clean and better on manage. u-boot/tools/a10_bsp_generator.

Quoted 3 lines

Meantime, I think it is even better on generalizing one folder for all Altera socfpga tools, with requirements.txt as well.

Thanks for the clarification.

Understood on the removal of Arria 10 from this flow, since its handoff mechanism is different and not based on the |.hiof| format.

Noted on your point about keeping the tooling consistent. We can keep this in mind during future clean-ups.

All good from my side. Thanks for the update.

Tien Fong

author
#6 lore raw
Quoted 9 lines

Thanks for the clarification.

Understood on the removal of Arria 10 from this flow, since its handoff mechanism is different and not based on the .hiof format.

Noted on your point about keeping the tooling consistent. We can keep this in mind during future clean-ups.

All good from my side. Thanks for the update.

Tien Fong

Hi T.F.

Can try to convert to python script but don't have actual A10 on hand. So may be a test folder with generated outputs to diff the new script for sanity check.

Brian

#7 lore raw

Hi Brian,

Quoted 8 lines · Sune Brian

[CAUTION: This email is from outside your organization. Unless you trust the sender, do not click on links or open attachments as it may be a fraudulent email attempting to steal your information and/or compromise your computer.]

Quoted 6 lines

Thanks for the clarification.

Understood on the removal of Arria 10 from this flow, since its handoff mechanism is different and not based on the .hiof format.

Noted on your point about keeping the tooling consistent. We can keep this in mind during future clean-ups.

Quoted 8 lines
Quoted 3 lines

All good from my side. Thanks for the update.

Tien Fong

Hi T.F.

Can try to convert to python script but don't have actual A10 on hand. So may be a test folder with generated outputs to diff the new script for sanity check.

I don’t have any Arria 10 handoff samples or generated QTS output on my side either, so I’m unable to supply a test folder for diff-checking.

If there is any reference handoff or sample output provided in the future, we can help review or sanity-check, but for now it’s fine to leave the A10 part as-is.

Thanks,
Tien Fong