[PATCH v3] Improve handosff prepare on SoCFPGA

Sune Brian briansune at gmail.com
Tue Apr 21 01:12:27 CEST 2026


On Tue, Apr 21, 2026 at 3:32 AM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Brian,
>
> On 2026-04-20T07:46:01, Brian Sune <briansune at gmail.com> wrote:
> > 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.
> >
> > Signed-off-by: Brian Sune <briansune at gmail.com>
> >
> > arch/arm/mach-socfpga/config.mk | 29 ++++++++++++++++++++++++++---
> >  1 file changed, 26 insertions(+), 3 deletions(-)
>
> Typo in commit message: "handosff" should be "handoff".
>
> > diff --git a/arch/arm/mach-socfpga/config.mk b/arch/arm/mach-socfpga/config.mk
> > @@ -8,6 +8,8 @@ else ifeq ($(CONFIG_ARCH_SOCFPGA_ARRIA5),y)
> > +HANDOFF_KEEP ?= 0
>
> > diff --git a/arch/arm/mach-socfpga/config.mk b/arch/arm/mach-socfpga/config.mk
> > @@ -43,6 +45,27 @@ socfpga_g5_handoff_prepare:
> > +             if [ -n "$$HANDOFF_KEEP" ]; then \
>
> HANDOFF_KEEP defaults to "0", so -n "0" is always true. I suspect you want:
>
>     if [ "$$HANDOFF_KEEP" != "0" ]; then \

Hi Simon,

I think this is a misunderstanding.
My original idea is to use the HANDOFF_KEEP=(whatever is mistyped)
to run the keep branch.

While the absence of HANDOFF_KEEP(anything) will not keep.
But simply HANDOFF_KEEP will not work and need HANDOFF_KEEP=xxx.

Because the command >
"make prepare HANDOFF_KEEP=xxx" is very distinctly long
HANDOFF_KEEP=xxx so it must keep my thingy.
Even if I mistyped =0 etc.

And during the absence of HANDOFF_KEEP=xxxx
"make prepare " immediately, see ok clean so it will not keep good.

That's my original thought.
I think I should changed to:
if [ -n "$${HANDOFF_KEEP+x}" ]; then \


Need your comments on this.

Thanks,
Brian

>
> Otherwise the 'preserve' path is always taken and the 'clean' path is dead code.
>
> You could also have an empty variable meaning don't keep.
>
> > diff --git a/arch/arm/mach-socfpga/config.mk b/arch/arm/mach-socfpga/config.mk
> > @@ -43,6 +45,27 @@ socfpga_g5_handoff_prepare:
> > +             trap 'rm -rf "$$TEMP_DIR"' EXIT;
>
> The trap is set after TEMP_DIR has already been used. If the python
> script or mv fails partway through, the temporary directory won't be
> cleaned up. You could move the trap to immediately after mktemp
>
> Regards,
> Simon


More information about the U-Boot mailing list