[PATCH v3] Improve handosff prepare on SoCFPGA
Sune Brian
briansune at gmail.com
Wed Apr 22 01:17:08 CEST 2026
On Wed, Apr 22, 2026 at 6:39 AM Simon Glass <sjg at chromium.org> wrote:
>
> 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.
>
Hi Simon,
> I'd suggest either dropping the assignment to '0', since someone
> reading the Makefile will reasonably expect the shell to see it as
> 'off'.
>
Yes indeed so I had pushed patch v4 and fixed what you suggested with
my inheritance idea.
> In any case, how about a comment above to explain what the argument is
> for and what it does?
I guess patch v4 has no issue self explaining the check condition has
undergone those expected logic cases and exists HANDOFF_KEEP.
So v4 simply:
HANDOFF_KEEP= <- keep
HANDOFF_KEEP=0 <- no keep
HANDOFF_KEEP=1 <- keep
HANDOFF_KEEP='0' <- no keep
HANDOFF_KEEP='1' <- keep
etc.
Thanks,
Brian
>
> >
> > 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