Improve handosff prepare on SoCFPGA
Subsystems (3)
PATCH 1/1 Improve handosff prepare on SoCFPGA
There are some cases that the Python scripts
are run and the qts files are not replaced.
Make sure qts folder h files are removed before
handoff script runs.
--- arch/arm/mach-socfpga/config.mk | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/mach-socfpga/config.mk +5 -0
@@ -43,6 +43,11 @@ socfpga_g5_handoff_prepare: exit 0; \ fi; \ echo "[INFO] Found hiof file: $$HIOF_FILE"; \ + echo "[INFO] Clean old BSP files..."; \ + if ls "$$BOARD_DIR/qts"/*.h >/dev/null 2>&1; then \ + rm -r "$$BOARD_DIR/qts"/*.h; \ + echo "[INFO] Removed old BSP files..."; \ + fi; \ echo "[INFO] Running BSP generator..."; \ python3 $(srctree)/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.34.1
Hi Brian,
Quoted 15 lines · Brian Sune
There are some cases that the Python scripts
are run and the qts files are not replaced.
Make sure qts folder h files are removed before
handoff script runs.Signed-off-by Brian Sune<[email protected]>--- arch/arm/mach-socfpga/config.mk | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/mach-socfpga/config.mk +0
-0
arch/arm/mach-socfpga/config.mk socfpga_g5_handoff_prepare: · line 50
Quoted 8 lines
arch/arm/mach-socfpga/config.mk +5
-0@@ -43,6 +43,11 @@ socfpga_g5_handoff_prepare: exit 0; \ fi; \ echo "[INFO] Found hiof file: $$HIOF_FILE"; \ + echo "[INFO] Clean old BSP files..."; \ + if ls "$$BOARD_DIR/qts"/*.h >/dev/null 2>&1; then \ + rm -r "$$BOARD_DIR/qts"/*.h; \ + echo "[INFO] Removed old BSP files..."; \ + fi; \
Thanks for tackling stale qts/*.h when the BSP generator does not refresh outputs.
Concern: the series deletes existing board/.../qts/*.h before running cv_bsp_generator.py, while the recipe still continues on generator failure (|| … continuing). If Python fails or produces no headers, the tree can be left without the previous QTS headers but the build still proceeds, that is a regression risk.
Nits: rm -r …/*.h on plain files is unusual; rm -f is clearer.
Suggestion: generate into a temporary directory (e.g. mktemp -d under qts/), and only replace existing *.h after a successful run (optionally copy the old set to qts/.handoff_backup.<timestamp>/ first for diff). That keeps the “stale vs new” comparison you want without breaking builds when generation fails.
Best regards,
Tien Fong
Quoted 31 lines · Tien Fong
Hi Brian,
On 12/4/2026 1:27 am, Brian Sune wrote:
There are some cases that the Python scripts
are run and the qts files are not replaced.
Make sure qts folder h files are removed before
handoff script runs.Signed-off-by Brian Sune <[email protected]>--- arch/arm/mach-socfpga/config.mk | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/mach-socfpga/config.mk +5
-0@@ -43,6 +43,11 @@ socfpga_g5_handoff_prepare: exit 0; \ fi; \ echo "[INFO] Found hiof file: $$HIOF_FILE"; \ + echo "[INFO] Clean old BSP files..."; \ + if ls "$$BOARD_DIR/qts"/*.h >/dev/null 2>&1; then \ + rm -r "$$BOARD_DIR/qts"/*.h; \ + echo "[INFO] Removed old BSP files..."; \ + fi; \
Quoted 2 lines
Thanks for tackling stale qts/*.h when the BSP generator does not refresh outputs.
Hi T.F.,
The idea was intended for the preparation phase, not the build phase. aka > make prepare
So if the preparation phase is having issues, users should take care before cont'd.
As handoff script originally is a preparation not build operation. However, I think it is better to do a file check after py script.
Quoted 2 lines
Concern: the series deletes existing board/.../qts/*.h before running
cv_bsp_generator.py, while the recipe still continues on generator failure (|| … continuing). If Python fails or produces no headers, the tree can be left without the previous QTS headers but the build still proceeds, that is a regression risk.
You are right I included an extra repeat flag on file rm. Bad habit on -r on very things.
Quoted 3 lines
Nits: rm -r …/*.h on plain files is unusual; rm -f is clearer.
Suggestion: generate into a temporary directory (e.g. mktemp -d under qts/), and only replace existing *.h after a successful run (optionally copy the old set to qts/.handoff_backup.<timestamp>/ first for diff). That keeps the “stale vs new” comparison you want without breaking builds when generation fails.
Release a 2nd patch on both modifications.
Thanks,
Brian
Quoted 3 lines
Best regards,
Tien Fong