* [PATCH v3] Add make feature support for SoCFPGA Handoff
@ 2025-11-03 22:28 Brian Sune
2025-11-03 22:33 ` Tom Rini
0 siblings, 1 reply; 9+ messages in thread
From: Brian Sune @ 2025-11-03 22:28 UTC (permalink / raw)
To: Tom Rini, u-boot
Introduce socfpga_gen5_handoff_prepare target in U-Boot Makefile
Automatically detects Altera/Intel SoCFPGA boards from .config
Checks for presence of hps_isw_handoff folder and .hiof files
Runs BSP generator script tools/cv_bsp_generator/cv_bsp_generator.py
if files exist.
Non-blocking: prepare continues even if handoff folder or files are missing
Signed-off-by: Brian Sune <briansune@gmail.com>
---
Makefile | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 750f8a84b1f..32568a6c477 100644
--- a/Makefile
+++ b/Makefile
@@ -2158,7 +2158,7 @@ scripts: scripts_basic scripts_dtc
# archprepare is used in arch Makefiles and when processed asm symlink,
# version.h and scripts_basic is processed / created.
-PHONY += prepare archprepare prepare1 prepare3
+PHONY += prepare archprepare prepare1 prepare3 socfpga_g5_hanoff_prepare
# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
@@ -2190,8 +2190,45 @@ archprepare: prepare1 scripts
prepare0: archprepare
$(Q)$(MAKE) $(build)=.
+# Intel-Altera SoCFPGA GEN5 prepare handoff file conversion
+socfpga_g5_hanoff_prepare:
+ @VENDOR=$$(grep -E '^CONFIG_SYS_VENDOR=' .config | cut -d'"' -f2); \
+ BOARD=$$(grep -E '^CONFIG_SYS_BOARD=' .config | cut -d'"' -f2); \
+ if [ -z "$$VENDOR" ] || [ -z "$$BOARD" ]; then \
+ exit 0; \
+ fi; \
+ if grep -q 'CONFIG_TARGET_SOCFPGA_CYCLONE5=y' .config; then \
+ SOCFAMILY=cyclone5; \
+ elif grep -q 'CONFIG_TARGET_SOCFPGA_ARRIA5=y' .config; then \
+ SOCFAMILY=arria5; \
+ elif grep -q 'CONFIG_TARGET_SOCFPGA_ARRIA10=y' .config; then \
+ SOCFAMILY=arria10; \
+ else \
+ exit 0; \
+ fi; \
+ BOARD_DIR=board/$$VENDOR/$$BOARD; \
+ HANDOFF_BASE=$$BOARD_DIR/hps_isw_handoff; \
+ if [ ! -d $$HANDOFF_BASE ]; then \
+ exit 0; \
+ fi; \
+ echo "[INFO] Handoff folder found: $$HANDOFF_BASE"; \
+ HANDOFF_FOLDER_NAME=$$(basename "$$(find $$HANDOFF_BASE -mindepth 1 -maxdepth 1 -type d | head -n1)"); \
+ if [ -z "$$HANDOFF_FOLDER_NAME" ]; then \
+ exit 0; \
+ fi; \
+ echo "[INFO] Handoff subfolder found under $$HANDOFF_BASE"; \
+ if [ -f $$HANDOFF_BASE/$$HANDOFF_FOLDER_NAME/$$HANDOFF_FOLDER_NAME.hiof ]; then \
+ echo "[INFO] Found hiof file: $$HANDOFF_BASE/$$HANDOFF_FOLDER_NAME/$$HANDOFF_FOLDER_NAME.hiof"; \
+ echo "[INFO] Using handoff folder: $$HANDOFF_FOLDER_NAME"; \
+ echo "[INFO] Running BSP generator..."; \
+ fi; \
+ python3 tools/cv_bsp_generator/cv_bsp_generator.py \
+ -i $$BOARD_DIR/hps_isw_handoff/$$HANDOFF_FOLDER_NAME \
+ -o $$BOARD_DIR/qts || echo "[WARN] BSP generator failed, continuing..."; \
+ echo "[DONE] SoCFPGA QTS handoff conversion complete."
+
# All the preparing..
-prepare: prepare0 prepare-objtool
+prepare: prepare0 prepare-objtool socfpga_g5_hanoff_prepare
# Support for using generic headers in asm-generic
asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 22:28 [PATCH v3] Add make feature support for SoCFPGA Handoff Brian Sune
@ 2025-11-03 22:33 ` Tom Rini
2025-11-03 22:52 ` Sune Brian
2025-11-03 22:58 ` Sune Brian
0 siblings, 2 replies; 9+ messages in thread
From: Tom Rini @ 2025-11-03 22:33 UTC (permalink / raw)
To: Brian Sune; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]
On Tue, Nov 04, 2025 at 06:28:40AM +0800, Brian Sune wrote:
> Introduce socfpga_gen5_handoff_prepare target in U-Boot Makefile
> Automatically detects Altera/Intel SoCFPGA boards from .config
> Checks for presence of hps_isw_handoff folder and .hiof files
> Runs BSP generator script tools/cv_bsp_generator/cv_bsp_generator.py
> if files exist.
> Non-blocking: prepare continues even if handoff folder or files are missing
>
> Signed-off-by: Brian Sune <briansune@gmail.com>
> ---
> Makefile | 41 +++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 750f8a84b1f..32568a6c477 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2158,7 +2158,7 @@ scripts: scripts_basic scripts_dtc
> # archprepare is used in arch Makefiles and when processed asm symlink,
> # version.h and scripts_basic is processed / created.
>
> -PHONY += prepare archprepare prepare1 prepare3
> +PHONY += prepare archprepare prepare1 prepare3 socfpga_g5_hanoff_prepare
>
> # prepare3 is used to check if we are building in a separate output directory,
> # and if so do:
> @@ -2190,8 +2190,45 @@ archprepare: prepare1 scripts
> prepare0: archprepare
> $(Q)$(MAKE) $(build)=.
>
> +# Intel-Altera SoCFPGA GEN5 prepare handoff file conversion
> +socfpga_g5_hanoff_prepare:
> + @VENDOR=$$(grep -E '^CONFIG_SYS_VENDOR=' .config | cut -d'"' -f2); \
This won't work with separate object directories. Please give things a
spin with "make O=/tmp/somedir". It also looks like it's going to impact
every board, and either fail or add some build time? Make sure both say
"sandbox" and "qemu_arm" both build at least, if not a full CI run.
Thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 22:33 ` Tom Rini
@ 2025-11-03 22:52 ` Sune Brian
2025-11-03 23:05 ` Tom Rini
2025-11-03 22:58 ` Sune Brian
1 sibling, 1 reply; 9+ messages in thread
From: Sune Brian @ 2025-11-03 22:52 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
> This won't work with separate object directories. Please give things a
I am not too getting this, why? The checking stage is not enough to
block the below script execute?
> spin with "make O=/tmp/somedir". It also looks like it's going to impact
> every board, and either fail or add some build time? Make sure both say
> "sandbox" and "qemu_arm" both build at least, if not a full CI run.
For build time -> There could be 4 line of code to check.
For sandbox:
```
make clean && make mrproper
CLEAN cmd
CLEAN dts/../arch/sandbox/dts
CLEAN dts
CLEAN lib/efi_loader
CLEAN lib/efi_selftest
CLEAN lib
CLEAN tools
CLEAN tools/generated
CLEAN include/autoconf.mk include/autoconf.mk.dep
include/bmp_logo.h include/bmp_logo_data.h include/config.h
include/generated/env.in include/generated/env.txt
drivers/video/u_boot_logo.S u-boot-nodtb.bin u-boot.lds u-boot.bin
u-boot.sym u-boot-dtb.bin u-boot.srec u-boot u-boot.map u-boot.cfg
u-boot.dtb.out u-boot.dtb System.map keep-syms-lto.c
lib/efi_loader/helloworld_efi.S Test03 Test113 Test01 Test12 Test111
Test102 Test11 Test103 Test02 Test112 Test101
capsule_in.capsule5.efi-capsule capsule_in.capsule3.efi-capsule
capsule_in.capsule8.efi-capsule capsule.capsule3.efi-capsule
capsule.capsule10.efi-capsule capsule.capsule9.efi-capsule
capsule.capsule6.efi-capsule capsule.capsule1.efi-capsule
capsule_in.capsule9.efi-capsule capsule_in.capsule10.efi-capsule
capsule.capsule5.efi-capsule capsule.capsule2.efi-capsule
capsule_in.capsule2.efi-capsule capsule.capsule4.efi-capsule
capsule.capsule11.efi-capsule capsule.capsule7.efi-capsule
capsule_in.capsule7.efi-capsule capsule_in.capsule4.efi-capsule
capsule.capsule8.efi-capsule capsule_in.capsule11.efi-capsule
capsule_in.capsule6.efi-capsule capsule_in.capsule1.efi-capsule
capsule1.map capsule8.map capsule5.map capsule7.map capsule4.map
capsule6.map capsule10.map capsule3.map capsule9.map capsule2.map
capsule11.map
CLEAN scripts/basic
CLEAN scripts/dtc/pylibfdt
CLEAN scripts/dtc
CLEAN scripts/kconfig
CLEAN scripts
CLEAN include/config include/generated
CLEAN .config .config.old drivers/video/fonts/cantoraone_regular.S
drivers/video/fonts/nimbus_sans_l_regular.S
```
For qemu_arm:
```
make clean && make mrproper
CLEAN dts/../arch/arm/dts
CLEAN dts
CLEAN env
CLEAN lib/efi_loader
CLEAN lib/efi_selftest
CLEAN tools
CLEAN tools/generated
CLEAN include/autoconf.mk include/autoconf.mk.dep
include/bmp_logo.h include/bmp_logo_data.h include/config.h
include/generated/env.in include/generated/env.txt
drivers/video/u_boot_logo.S u-boot-nodtb.bin u-boot.lds u-boot.map
u-boot.srec u-boot.cfg u-boot.bin u-boot u-boot.sym System.map
lib/efi_loader/helloworld_efi.S
CLEAN scripts/basic
CLEAN scripts/dtc
CLEAN scripts/kconfig
CLEAN include/config include/generated
CLEAN .config .config.old
```
I am not too sure full CL run?
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 22:33 ` Tom Rini
2025-11-03 22:52 ` Sune Brian
@ 2025-11-03 22:58 ` Sune Brian
1 sibling, 0 replies; 9+ messages in thread
From: Sune Brian @ 2025-11-03 22:58 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
> This won't work with separate object directories. Please give things a
> spin with "make O=/tmp/somedir". It also looks like it's going to impact
Okay you got a point here, but before repatch add an additional
USER_HANDOFF_DIR=xxxx parameter to override the auto
qts+handoff folder build.
I don't understand what is the issue you mentioned.
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 22:52 ` Sune Brian
@ 2025-11-03 23:05 ` Tom Rini
2025-11-03 23:10 ` Sune Brian
0 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2025-11-03 23:05 UTC (permalink / raw)
To: Sune Brian; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]
On Tue, Nov 04, 2025 at 06:52:14AM +0800, Sune Brian wrote:
> > This won't work with separate object directories. Please give things a
>
> I am not too getting this, why? The checking stage is not enough to
> block the below script execute?
Because ".config" isn't valid, you need to have $(objdir)/.config be
checked, and in turn that has to depend on the appropriate target (we
have some stage that says that we are configured, I forget which).
> > spin with "make O=/tmp/somedir". It also looks like it's going to impact
> > every board, and either fail or add some build time? Make sure both say
> > "sandbox" and "qemu_arm" both build at least, if not a full CI run.
>
> For build time -> There could be 4 line of code to check.
I do forget off-hand which methods of doing "something" in a Makefile
are cheap and which result in firing off a subshell. But for a handy
feature for one SoC I want to make sure we don't slow down say the world
build of all 1400 configurations. For a maybe useful example, see how
the "checkgcc6" target is handled, and maybe we can move all of this to
live under arch/arm/mach-socfpga/config.mk and so only get invoked at
all there.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 23:05 ` Tom Rini
@ 2025-11-03 23:10 ` Sune Brian
2025-11-03 23:23 ` Tom Rini
0 siblings, 1 reply; 9+ messages in thread
From: Sune Brian @ 2025-11-03 23:10 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
> Because ".config" isn't valid, you need to have $(objdir)/.config be
> checked, and in turn that has to depend on the appropriate target (we
> have some stage that says that we are configured, I forget which).
```
make clean && make mrproper
make
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make: *** No rule to make target '.config', needed by
'include/config/auto.conf'. Stop.
```
Still not getting this, sorry a bit.
> > > spin with "make O=/tmp/somedir". It also looks like it's going to impact
> > > every board, and either fail or add some build time? Make sure both say
> > > "sandbox" and "qemu_arm" both build at least, if not a full CI run.
> >
> > For build time -> There could be 4 line of code to check.
>
> I do forget off-hand which methods of doing "something" in a Makefile
> are cheap and which result in firing off a subshell. But for a handy
> feature for one SoC I want to make sure we don't slow down say the world
> build of all 1400 configurations. For a maybe useful example, see how
> the "checkgcc6" target is handled, and maybe we can move all of this to
> live under arch/arm/mach-socfpga/config.mk and so only get invoked at
> all there.
If config.mk can also do this job why not just move it.
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 23:10 ` Sune Brian
@ 2025-11-03 23:23 ` Tom Rini
2025-11-03 23:40 ` Sune Brian
2025-11-04 0:16 ` Sune Brian
0 siblings, 2 replies; 9+ messages in thread
From: Tom Rini @ 2025-11-03 23:23 UTC (permalink / raw)
To: Sune Brian; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]
On Tue, Nov 04, 2025 at 07:10:54AM +0800, Sune Brian wrote:
> > Because ".config" isn't valid, you need to have $(objdir)/.config be
> > checked, and in turn that has to depend on the appropriate target (we
> > have some stage that says that we are configured, I forget which).
>
> ```
> make clean && make mrproper
>
> make
> ***
> *** Configuration file ".config" not found!
> ***
> *** Please run some configurator (e.g. "make oldconfig" or
> *** "make menuconfig" or "make xconfig").
> ***
> make: *** No rule to make target '.config', needed by
> 'include/config/auto.conf'. Stop.
> ```
>
> Still not getting this, sorry a bit.
You need to do some builds with "make O=/tmp/somedir". But also, I'm
trying to make sure we avoid race conditions and that we don't try this
logic until after the step where we know we have configured the system.
> > > > spin with "make O=/tmp/somedir". It also looks like it's going to impact
> > > > every board, and either fail or add some build time? Make sure both say
> > > > "sandbox" and "qemu_arm" both build at least, if not a full CI run.
> > >
> > > For build time -> There could be 4 line of code to check.
> >
> > I do forget off-hand which methods of doing "something" in a Makefile
> > are cheap and which result in firing off a subshell. But for a handy
> > feature for one SoC I want to make sure we don't slow down say the world
> > build of all 1400 configurations. For a maybe useful example, see how
> > the "checkgcc6" target is handled, and maybe we can move all of this to
> > live under arch/arm/mach-socfpga/config.mk and so only get invoked at
> > all there.
>
> If config.mk can also do this job why not just move it.
Yes, I'm saying move this logic to that file where I think it should be
workable, still.
>
> Brian
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 23:23 ` Tom Rini
@ 2025-11-03 23:40 ` Sune Brian
2025-11-04 0:16 ` Sune Brian
1 sibling, 0 replies; 9+ messages in thread
From: Sune Brian @ 2025-11-03 23:40 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
> You need to do some builds with "make O=/tmp/somedir". But also, I'm
> trying to make sure we avoid race conditions and that we don't try this
> logic until after the step where we know we have configured the system.
Yes this part i had agreed.
HANDOFF_PATH parameter.
```
make prepare HANDOFF_PATH=/media/sf_shared/loader/hps_isw_handoff/ddr3_5128x4_hps_0
scripts/kconfig/conf --syncconfig Kconfig
UPD include/config.h
CFG u-boot.cfg
GEN include/autoconf.mk
GEN include/autoconf.mk.dep
CFG spl/u-boot.cfg
GEN spl/include/autoconf.mk
UPD include/config/uboot.release
UPD include/generated/version_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
UPD include/generated/dt.h
ENVC include/generated/env.txt
ENVP include/generated/env.in
ENVT include/generated/environment.h
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
LEX scripts/dtc/dtc-lexer.lex.c
YACC scripts/dtc/dtc-parser.tab.h
HOSTCC scripts/dtc/dtc-lexer.lex.o
YACC scripts/dtc/dtc-parser.tab.c
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
CC lib/asm-offsets.s
UPD include/generated/generic-asm-offsets.h
CC arch/arm/lib/asm-offsets.s
UPD include/generated/asm-offsets.h
[INFO] Using manually assigned handoff path:
/media/sf_shared/loader/hps_isw_handoff/ddr3_5128x4_hps_0
Generating file: board/altera/cyclone5-socdk/qts/sdram_config.h...
Generating file: board/altera/cyclone5-socdk/qts/pinmux_config.h...
Generating file: board/altera/cyclone5-socdk/qts/pll_config.h
Reading file: /media/sf_shared/loader/hps_isw_handoff/ddr3_5128x4_hps_0/ddr3_5128x4_hps_0.hiof...
Generating file: board/altera/cyclone5-socdk/qts/iocsr_config.h...
[DONE] SoCFPGA QTS handoff conversion complete.
```
export method
```
export HANDOFF_PATH=/media/sf_shared/loader/hps_isw_handoff/ddr3_5128x4_hps_0
make prepare
UPD include/config/uboot.release
UPD include/generated/version_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
UPD include/generated/dt.h
ENVC include/generated/env.txt
ENVP include/generated/env.in
ENVT include/generated/environment.h
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
LEX scripts/dtc/dtc-lexer.lex.c
YACC scripts/dtc/dtc-parser.tab.h
HOSTCC scripts/dtc/dtc-lexer.lex.o
YACC scripts/dtc/dtc-parser.tab.c
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
CC lib/asm-offsets.s
UPD include/generated/generic-asm-offsets.h
CC arch/arm/lib/asm-offsets.s
UPD include/generated/asm-offsets.h
[INFO] Using manually assigned handoff path:
/media/sf_shared/loader/hps_isw_handoff/ddr3_5128x4_hps_0
Generating file: board/altera/cyclone5-socdk/qts/sdram_config.h...
Generating file: board/altera/cyclone5-socdk/qts/pinmux_config.h...
Generating file: board/altera/cyclone5-socdk/qts/pll_config.h
Reading file: /media/sf_shared/loader/hps_isw_handoff/ddr3_5128x4_hps_0/ddr3_5128x4_hps_0.hiof...
Generating file: board/altera/cyclone5-socdk/qts/iocsr_config.h...
[DONE] SoCFPGA QTS handoff conversion complete.
```
I think for moving to that location it leave for another patch.
I had spent time and effort already on Makefile.
I repatch this version and if there are any trouble please explain a bit to fix.
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] Add make feature support for SoCFPGA Handoff
2025-11-03 23:23 ` Tom Rini
2025-11-03 23:40 ` Sune Brian
@ 2025-11-04 0:16 ` Sune Brian
1 sibling, 0 replies; 9+ messages in thread
From: Sune Brian @ 2025-11-04 0:16 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot
> > > build of all 1400 configurations. For a maybe useful example, see how
> > > the "checkgcc6" target is handled, and maybe we can move all of this to
> > > live under arch/arm/mach-socfpga/config.mk and so only get invoked at
> > > all there.
Yes this could be an issue, I had cross-check via several AIs feedbacks.
Even if the logic and syntax runs it doesn't mean it is optimized.
But same way in other locations as well.
Will check a bit on this.
Brian
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-04 0:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 22:28 [PATCH v3] Add make feature support for SoCFPGA Handoff Brian Sune
2025-11-03 22:33 ` Tom Rini
2025-11-03 22:52 ` Sune Brian
2025-11-03 23:05 ` Tom Rini
2025-11-03 23:10 ` Sune Brian
2025-11-03 23:23 ` Tom Rini
2025-11-03 23:40 ` Sune Brian
2025-11-04 0:16 ` Sune Brian
2025-11-03 22:58 ` Sune Brian
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.