Add make feature support for SoCFPGA Handoff
PATCH v3 1/1 Add make feature support for SoCFPGA Handoff
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
--- Makefile | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-)
Makefile +39 -2
@@ -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
Signature · 1 line
2.25.1
Quoted 26 lines · Brian Sune
Introduce
socfpga_gen5_handoff_preparetarget in U-BootMakefileAutomatically detects Altera/Intel SoCFPGA boards from .config Checks for presence ofhps_isw_handofffolder and .hiof files Runs BSP generator scripttools/cv_bsp_generator/cv_bsp_generator.pyif files exist.
Non-blocking: prepare continues even if handoff folder or files are missingSigned-off-by Brian Sune <[email protected]>--- Makefile | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-)Makefile +1
-1@@ -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:
Makefile archprepare: prepare1 scripts · line 2195
Quoted 6 lines
Makefile +3
-0@@ -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!
Signature · 1 line
Tom
Quoted 1 line
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?
Quoted 3 lines
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
Quoted 2 lines
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
Quoted 4 lines · Sune Brian
Quoted 1 line
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).
Quoted 5 lines
Quoted 3 lines
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.
Signature · 1 line
Tom
Quoted 3 lines
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.
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
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.
Quoted 7 lines
I do forget off-hand which methods of doing "something" in a
Makefileare 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 underarch/arm/mach-socfpga/config.mkand so only get invoked at all there.
If config.mk can also do this job why not just move it.
Brian
Quoted 18 lines · Sune Brian
Quoted 3 lines
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. ```
Quoted 1 line
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.
Quoted 14 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
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.
Quoted 7 lines
I do forget off-hand which methods of doing "something" in a
Makefileare 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 underarch/arm/mach-socfpga/config.mkand so only get invoked at all there.
Quoted 1 line
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.
Quoted 2 lines
Brian
Signature · 1 line
Tom
Quoted 3 lines
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
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
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.mkand 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