Skip to contentSkip to conversation

am65x build issues

PATCH Jan Kiszka 2 participants 3 messages Apr 30, 2020 – May 1, 2020

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi all,

I've noticed that building am65x_evm_a53_defconfig causes the dtbs to be built twice, once for the main u-boot and once for the spl. This is because of an extra dependency in mach-k3/config_secure.mk added by 508369672ca3. Why should the produced dtbs depend on the target that produces them? Why not simply this?

arch/arm/mach-k3/config_secure.mk +1 -4
index 6d63c57665..cbe9b684fb 100644
@@ -34,11 +34,8 @@ MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
 	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
 	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
 
-OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
-$(OF_LIST_TARGETS): dtbs
-
 u-boot-nodtb.bin_HS: u-boot-nodtb.bin FORCE
 	$(call if_changed,k3secureimg)
 
-u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
+u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img dtbs FORCE
 	$(call if_changed,mkimage)

Disclaimer: I didn't actually test the HS path, just the unsigned build.

But also with this change, make -j remains broken for this target:

[...]
COPY u-boot.dtb
MKIMAGE u-boot-dtb.img
MKIMAGE u-boot.img

  CAT     u-boot-dtb.bin
  COPY    u-boot.bin
  CC      spl/./lib/asm-offsets.s
  CC      spl/./arch/arm/lib/asm-offsets.s

../tools/k3_fit_atf.sh \
spl/dts/k3-am654-base-board.dtb > u-boot-spl-k3.its
LDS spl/u-boot-spl.lds
FDTGREP spl/dts/k3-am654-base-board.dtb
Usage: fdtgrep - extract portions from device tree [...]

Error: Cannot open output file
make[2]: *** [../scripts/Makefile.spl:465: spl/dts/k3-am654-base-board.dtb] Error 1 make[2]: *** Waiting for unfinished jobs....

Something is fishy with dependencies here. Any ideas?

Thanks,
Jan

#1 lore raw
Quoted 16 lines · Jan Kiszka

Hi all,

I've noticed that building am65x_evm_a53_defconfig causes the dtbs to be built twice, once for the main u-boot and once for the spl. This is because of an extra dependency in mach-k3/config_secure.mk added by 508369672ca3. Why should the produced dtbs depend on the target that produces them? Why not simply this?

arch/arm/mach-k3/config_secure.mk +0 -0
index 6d63c57665..cbe9b684fb 100644
@@ -34,11 +34,8 @@ MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
 	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
 	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))

arch/arm/mach-k3/config_secure.mk MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ · line 41

Quoted 10 lines
arch/arm/mach-k3/config_secure.mk +1 -4
 
-OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
-$(OF_LIST_TARGETS): dtbs
-
 u-boot-nodtb.bin_HS: u-boot-nodtb.bin FORCE
 	$(call if_changed,k3secureimg)
 
-u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
+u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img dtbs FORCE
 	$(call if_changed,mkimage)

Because then no one will depend on the _HS versions of the .dtb files, so they wont get built.

I agree it's a huge mess right now, the "correct" thing to do would be for the %.dtb_HS files to depend on their corresponding %.dtb files from which they are generated. Which they do, kinda. But Make doesn't seem smart enough to know that at the start, it checks for the .dtb files and fails instantly during the first round of parsing, due to the .dtb files not existing and no rules existing for them. The .dtb files are not being generated by a rule with their name so Make doesn't understand they will be generated later, because U-Boot uses scripting for dtbs and uses target "dtbs". So we are stuck depending on that until someone does some major rework of the U-Boot/Linux makefiles.. Feel free :D

Andrew

Quoted 30 lines

Disclaimer: I didn't actually test the HS path, just the unsigned build.

But also with this change, make -j remains broken for this target:

[...]
COPY u-boot.dtb
MKIMAGE u-boot-dtb.img
MKIMAGE u-boot.img

  CAT     u-boot-dtb.bin
  COPY    u-boot.bin
  CC      spl/./lib/asm-offsets.s
  CC      spl/./arch/arm/lib/asm-offsets.s

../tools/k3_fit_atf.sh \
spl/dts/k3-am654-base-board.dtb > u-boot-spl-k3.its
LDS spl/u-boot-spl.lds
FDTGREP spl/dts/k3-am654-base-board.dtb
Usage: fdtgrep - extract portions from device tree [...]

Error: Cannot open output file
make[2]: *** [../scripts/Makefile.spl:465: spl/dts/k3-am654-base-board.dtb] Error 1 make[2]: *** Waiting for unfinished jobs....

Something is fishy with dependencies here. Any ideas?

Thanks,
Jan

author
#2 lore raw
Quoted 23 lines · Andrew F. Davis
Quoted 22 lines · Jan Kiszka

Hi all,

I've noticed that building am65x_evm_a53_defconfig causes the dtbs to be built twice, once for the main u-boot and once for the spl. This is because of an extra dependency in mach-k3/config_secure.mk added by 508369672ca3. Why should the produced dtbs depend on the target that produces them? Why not simply this?

arch/arm/mach-k3/config_secure.mk +0 -3
index 6d63c57665..cbe9b684fb 100644
@@ -34,11 +34,8 @@ MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
  	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
  	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
 
-OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
-$(OF_LIST_TARGETS): dtbs
-
  u-boot-nodtb.bin_HS: u-boot-nodtb.bin FORCE
  	$(call if_changed,k3secureimg)
 
Quoted 8 lines

arch/arm/mach-k3/config_secure.mk MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ · line 41

Quoted 4 lines
arch/arm/mach-k3/config_secure.mk +1 -1
-u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
+u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img dtbs FORCE
  	$(call if_changed,mkimage)

Because then no one will depend on the _HS versions of the .dtb files, so they wont get built.

Indeed, missed that.

Quoted 11 lines

I agree it's a huge mess right now, the "correct" thing to do would be for the %.dtb_HS files to depend on their corresponding %.dtb files from which they are generated. Which they do, kinda. But Make doesn't seem smart enough to know that at the start, it checks for the .dtb files and fails instantly during the first round of parsing, due to the .dtb files not existing and no rules existing for them. The .dtb files are not being generated by a rule with their name so Make doesn't understand they will be generated later, because U-Boot uses scripting for dtbs and uses target "dtbs". So we are stuck depending on that until someone does some major rework of the U-Boot/Linux makefiles.. Feel free :D

loop_cmd = $(echo-cmd) $(cmd_$(1)) || exit;

dtbs_HS: dtbs FORCE

	$(foreach dtb, ..., $(call, loop_cmd, ...))

This avoids per-dtb rules and dependencies. But it will require some variant of k3secureimg that takes the source as a parameter and not from the rule's dependency list. This is the same pattern I currently play with for injecting the public key into dtbs for fit image verification. I'll see if I can get something building with am65x_hs_evm_a53_defconfig to validate a concrete fix proposal.

Again my question: What can be the other broken dependency that causes "make -j" failures?

Jan