* Re: [PATCH v3] Improve handosff prepare on SoCFPGA
2026-04-20 19:32 ` Simon Glass
@ 2026-04-20 22:44 ` Sune Brian
2026-04-20 23:12 ` Sune Brian
1 sibling, 0 replies; 4+ messages in thread
From: Sune Brian @ 2026-04-20 22:44 UTC (permalink / raw)
To: Simon Glass; +Cc: u-boot, Tom Rini
On Tue, Apr 21, 2026 at 3:32 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Brian,
>
> On 2026-04-20T07:46:01, Brian Sune <briansune@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@gmail.com>
> >
> > arch/arm/mach-socfpga/config.mk | 29 ++++++++++++++++++++++++++---
> > 1 file changed, 26 insertions(+), 3 deletions(-)
>
> Typo in commit message: "handosff" should be "handoff".
Got it.
>
> > 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 \
>
Hi Simon,
Thanks for the feedback.
Before the patch was pushed I personally tested all these cases and
found no issue.
make w/o HANDOFF_KEEP=1 will link to clean vice versa.
You can use make HANDOFF_KEEP without =1 it will report
No rule to make target 'HANDOFF_KEEP'
Sorry, cannot see issue on this section.
Maybe you can try and test if it is the case.
Pure "brain processes code" sometimes is a bit tricky.
> HANDOFF_KEEP defaults to "0", so -n "0" is always true. I suspect you want:
>
> if [ "$$HANDOFF_KEEP" != "0" ]; then \
>
> 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
Sorry, again during the test I did not see any issue what you described.
The temp dir cleaned up w/o any issues.
Both condition branches keep and clean.
mv or python script will not break like exit 1
QUOTE --->
[INFO] Try BSP generator...
./board/altera/cyclone5-socdk/tmp.Z11PmKjAMg
Generating file: ./board/altera/cyclone5-socdk/tmp.Z11PmKjAMg/sdram_config.h...
Generating file: ./board/altera/cyclone5-socdk/tmp.Z11PmKjAMg/pinmux_config.h...
Generating file: ./board/altera/cyclone5-socdk/tmp.Z11PmKjAMg/pll_config.h
***Error: We don't handle more than one .hiof file yet
Only the last .hiof file in the list will be converted
hiof files found:
/media/sf_shared/loader/hps_isw_handoff/pcie_rp_ed_5csxfc6_hps_0/pcie_rp_ed_5csxfc6_hps_0
(copy).hiof
/media/sf_shared/loader/hps_isw_handoff/pcie_rp_ed_5csxfc6_hps_0/pcie_rp_ed_5csxfc6_hps_0.hiof
Reading file: /media/sf_shared/loader/hps_isw_handoff/pcie_rp_ed_5csxfc6_hps_0/pcie_rp_ed_5csxfc6_hps_0
(copy).hiof...
Generating file: ./board/altera/cyclone5-socdk/tmp.Z11PmKjAMg/iocsr_config.h...
Traceback (most recent call last):
File "/home/intel/u-boot_C5PRJ/./tools/cv_bsp_generator/cv_bsp_generator.py",
line 100, in <module>
iocsr = iocsr.IOCSRGrokker(hps.getDeviceFamily(), inputDir,
outputDir, hiof_file)
AttributeError: 'IOCSRGrokker' object has no attribute 'IOCSRGrokker'
[WARN] BSP generator failed!
ll ./board/altera/cyclone5-socdk/tmp.Z11PmKjAMg
ls: cannot access './board/altera/cyclone5-socdk/tmp.Z11PmKjAMg': No
such file or directory
<--- END QUOTE
QUOTE--->
UPD include/generated/timestamp_autogenerated.h
[INFO] Using manually specified handoff folder:
/media/sf_shared/loader/hps_isw_handoff/pcie_rp_ed_5csxfc6_hps_0
[INFO] Found hiof file:
/media/sf_shared/loader/hps_isw_handoff/pcie_rp_ed_5csxfc6_hps_0/pcie_rp_ed_5csxfc6_hps_0.hiof
[INFO] Try BSP generator...
Generating file: ./board/altera/cyclone5-socdk/tmp.TvQv88TcsZ/sdram_config.h...
Generating file: ./board/altera/cyclone5-socdk/tmp.TvQv88TcsZ/pinmux_config.h...
Generating file: ./board/altera/cyclone5-socdk/tmp.TvQv88TcsZ/pll_config.h
Reading file: /media/sf_shared/loader/hps_isw_handoff/pcie_rp_ed_5csxfc6_hps_0/pcie_rp_ed_5csxfc6_hps_0.hiof...
Generating file: ./board/altera/cyclone5-socdk/tmp.TvQv88TcsZ/iocsr_config.h...
[INFO] Clean old BSP files...
mv: target './board/altera/cyclone5-socdk/qts' is not a directory
[INFO] SoCFPGA QTS handoff conversion complete.
ll ./board/altera/cyclone5-socdk/tmp.TvQv88TcsZ
ls: cannot access './board/altera/cyclone5-socdk/tmp.TvQv88TcsZ': No
such file or directory
<--- END QUOTE
Thanks,
Brian
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3] Improve handosff prepare on SoCFPGA
2026-04-20 19:32 ` Simon Glass
2026-04-20 22:44 ` Sune Brian
@ 2026-04-20 23:12 ` Sune Brian
1 sibling, 0 replies; 4+ messages in thread
From: Sune Brian @ 2026-04-20 23:12 UTC (permalink / raw)
To: Simon Glass; +Cc: u-boot, Tom Rini
On Tue, Apr 21, 2026 at 3:32 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Brian,
>
> On 2026-04-20T07:46:01, Brian Sune <briansune@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@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
^ permalink raw reply [flat|nested] 4+ messages in thread