[PATCH v1] Improve handosff prepare on SoCFPGA

Sune Brian briansune at gmail.com
Mon Apr 20 07:30:12 CEST 2026


On Mon, Apr 20, 2026 at 1:02 PM Chee, Tien Fong
<tien.fong.chee at altera.com> wrote:
>
> 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 <briansune at gmail.com>
> ---
>  arch/arm/mach-socfpga/config.mk | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/arm/mach-socfpga/config.mk b/arch/arm/mach-socfpga/config.mk
> index 1ca1d33cb16..d9d9d4f2373 100644
> --- a/arch/arm/mach-socfpga/config.mk
> +++ b/arch/arm/mach-socfpga/config.mk
> @@ -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.
>
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.

> 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.

> 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

> Best regards,
>
> Tien Fong


More information about the U-Boot mailing list