From: Jan Kiszka Date: Fri, 1 May 2020 10:31:42 +0200 Subject: am65x build issues In-Reply-To: <386890e5-f82a-80a9-9212-785a75b31bb5@ti.com> References: <04446bbd-6858-b8ba-0328-ba7c10291d68@web.de> <386890e5-f82a-80a9-9212-785a75b31bb5@ti.com> Message-ID: <3f800895-7366-d60d-b67b-87a295d7a714@web.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 30.04.20 23:16, Andrew F. Davis wrote: > On 4/30/20 3:03 PM, Jan Kiszka wrote: >> 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? >> >> diff --git a/arch/arm/mach-k3/config_secure.mk b/arch/arm/mach-k3/config_secure.mk >> index 6d63c57665..cbe9b684fb 100644 >> --- a/arch/arm/mach-k3/config_secure.mk >> +++ b/arch/arm/mach-k3/config_secure.mk >> @@ -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) >> > > > Because then no one will depend on the _HS versions of the .dtb files, > so they wont get built. Indeed, missed that. > > 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