[PATCH v3] Improve handosff prepare on SoCFPGA
Simon Glass
sjg at chromium.org
Wed Apr 22 00:38:59 CEST 2026
Hi Brian,
On Tue, 21 Apr 2026 at 11:12, Sune Brian <briansune at gmail.com> wrote:
>
> 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.
I'd suggest either dropping the assignment to '0', since someone
reading the Makefile will reasonably expect the shell to see it as
'off'.
In any case, how about a comment above to explain what the argument is
for and what it does?
>
> 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
OK I had that wrong. If someone presses Ctrl-C while Python is running
it would not clean up, but that's a minor issue...
Please note that you should add a change log for version 2, 3, etc. -
see here for details:
https://docs.u-boot.org/en/latest/develop/sending_patches.html
Regards,
Simon
More information about the U-Boot
mailing list