Various build dependency fixes
Subsystems (3)
cover Various build dependency fixes
See patches for details.
Jan
Jan Kiszka (4):
kbuild: efi: Avoid rebuilding efi targets
kbuild: spl: Fix parallel build
kbuild: spl: Add shrunk arch-dtbs to targets list
kbuild: arm: Fix duplicate builds of dtbs
arch/arm/dts/Makefile | 6 ++++-- arch/arm/mach-k3/config_secure.mk | 19 ++++++++++++++----- lib/efi_loader/Makefile | 1 + scripts/Makefile.lib | 2 ++ scripts/Makefile.spl | 7 +++++-- 5 files changed, 26 insertions(+), 9 deletions(-)
--
2.26.1
PATCH 1/4 kbuild: efi: Avoid rebuilding efi targets
From: Jan Kiszka <[email protected]>
Add a couple of missing targets so that helloworld and other efi targets are not needlessly rebuilt.
--- lib/efi_loader/Makefile | 1 + scripts/Makefile.lib | 2 ++ 2 files changed, 3 insertions(+)
lib/efi_loader/Makefile +1 -0
@@ -17,6 +17,7 @@ CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI) ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),) always += helloworld.efi +targets += helloworld.o endif obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
scripts/Makefile.lib +2 -0
@@ -418,6 +418,8 @@ $(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcoun $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o $(call cmd,efi_ld) +targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o + # ACPI # --------------------------------------------------------------------------- #
--
2.26.1
PATCH 1/4 kbuild: efi: Avoid rebuilding efi targets
Quoted 7 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Add a couple of missing targets so that helloworld and other efi targets are not needlessly rebuilt.
CC Heinrich Schuchardt <[email protected]>Signed-off-by Jan Kiszka <[email protected]>
Quoted 33 lines
--- lib/efi_loader/Makefile | 1 + scripts/Makefile.lib | 2 ++ 2 files changed, 3 insertions(+)lib/efi_loader/Makefile +1
-0@@ -17,6 +17,7 @@ CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI) ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),) always += helloworld.efi +targets += helloworld.o endif obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.oscripts/Makefile.lib +2
-1@@ -418,6 +418,8 @@ $(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcoun $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o $(call cmd,efi_ld) +targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o + # ACPI # --------------------------------------------------------------------------- # --2.26.1
PATCH 2/4 kbuild: spl: Fix parallel build
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
The dts dir must exists when running this rule.
That missing dependency broke e.g. "make -j" for the am65x targets.
--- scripts/Makefile.spl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.spl +1 -1
@@ -461,7 +461,7 @@ dtbs: SHRUNK_ARCH_DTB = $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) .SECONDEXPANSION: -$(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, arch/$(ARCH)/dts/%, $$@) +$(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, arch/$(ARCH)/dts/%, $$@) dts_dir $(call if_changed,fdtgrep) MKIMAGEFLAGS_$(SPL_BIN).multidtb.fit = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
--
2.26.1
PATCH 2/4 kbuild: spl: Fix parallel build
Quoted 9 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
The dts dir must exists when running this rule.
That missing dependency broke e.g. "make -j" for the am65x targets.
Fixes 2f57c95100f2 ("spl: dm: Make it possible for the SPL to pick its own DTB from a FIT")CC Jean-Jacques Hiblot <[email protected]>Signed-off-by Jan Kiszka <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200514/00504ac6/attachment.sig>
PATCH 3/4 kbuild: spl: Add shrunk arch-dtbs to targets list
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
This avoids needless rebuilding.
--- scripts/Makefile.spl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.spl +4 -1
@@ -459,11 +459,14 @@ dtbs: # information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY) -SHRUNK_ARCH_DTB = $(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) +SPL_OF_LIST_TARGETS = $(patsubst %,dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) +SHRUNK_ARCH_DTB = $(addprefix $(obj)/,$(SPL_OF_LIST_TARGETS)) .SECONDEXPANSION: $(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, arch/$(ARCH)/dts/%, $$@) dts_dir $(call if_changed,fdtgrep) +targets += $(SPL_OF_LIST_TARGETS) + MKIMAGEFLAGS_$(SPL_BIN).multidtb.fit = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -n "Multi DTB fit image for $(SPL_BIN)" -E \ $(patsubst %,-b %,$(SHRUNK_ARCH_DTB))
--
2.26.1
PATCH 3/4 kbuild: spl: Add shrunk arch-dtbs to targets list
Quoted 7 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
This avoids needless rebuilding.
Fixes 2f57c95100f2 ("spl: dm: Make it possible for the SPL to pick its own DTB from a FIT")CC Jean-Jacques Hiblot <[email protected]>Signed-off-by Jan Kiszka <[email protected]>
Applied to u-boot/master, thanks!
[Aside, I'm assuming Andrew will reply back still on 4/4, but 2/4 and 3/4 are needed to fix building / testing right now]
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200514/8c3cfa71/attachment.sig>
PATCH 4/4 kbuild: arm: Fix duplicate builds of dtbs
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Build the secured board dtbs (.dtb_HS) as part of the regular dtb build on CONFIG_TI_SECURE_DEVICE targets. This avoids rebuilding them, possibly overwriting artifacts that are in use, as it is done so far.
In the same run, fix needless rebuilding of the secured spl dtb.
--- arch/arm/dts/Makefile | 6 ++++-- arch/arm/mach-k3/config_secure.mk | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-)
arch/arm/dts/Makefile +4 -2
@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ +include $(srctree)/arch/arm/mach-k3/config_secure.mk + dtb-$(CONFIG_TARGET_SMARTWEB) += at91sam9260-smartweb.dtb dtb-$(CONFIG_TARGET_TAURUS) += at91sam9g20-taurus.dtb dtb-$(CONFIG_TARGET_CORVUS) += at91sam9g45-corvus.dtb
@@ -927,13 +929,13 @@ dtb-$(CONFIG_TARGET_DURIAN) += phytium-durian.dtb dtb-$(CONFIG_TARGET_PRESIDIO_ASIC) += ca-presidio-engboard.dtb -targets += $(dtb-y) +targets += $(dtb-y) $(TI_SECURE_DTBS) # Add any required device tree compiler flags here DTC_FLAGS += PHONY += dtbs -dtbs: $(addprefix $(obj)/, $(dtb-y)) +dtbs: $(addprefix $(obj)/, $(dtb-y) $(TI_SECURE_DTBS)) @: clean-files := *.dtb *.dtbo *_HS
arch/arm/mach-k3/config_secure.mk +14 -5
@@ -26,7 +26,12 @@ endif $(obj)/u-boot-spl-nodtb.bin_HS: $(obj)/u-boot-spl-nodtb.bin FORCE $(call if_changed,k3secureimg) -tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst %,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST))) $(SPL_ITS) FORCE +SPL_OF_LIST_TARGETS = $(patsubst %,dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) +SPL_OF_LIST_TARGETS_HS = $(addsuffix _HS,$(SPL_OF_LIST_TARGETS)) + +targets += $(SPL_OF_LIST_TARGETS) $(SPL_OF_LIST_TARGETS_HS) + +tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(addprefix $(obj)/,$(SPL_OF_LIST_TARGETS_HS)) $(SPL_ITS) FORCE $(call if_changed,mkfitimage) MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
@@ -34,11 +39,15 @@ 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) + +# Used when included by arch-dts makefile +-include include/config/auto.conf + +ifeq ($(CONFIG_TI_SECURE_DEVICE),y) +TI_SECURE_DTBS = $(addsuffix _HS, $(dtb-y)) +endif
--
2.26.1
PATCH 4/4 kbuild: arm: Fix duplicate builds of dtbs
Quoted 21 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Build the secured board dtbs (.dtb_HS) as part of the regular dtb build on
CONFIG_TI_SECURE_DEVICEtargets. This avoids rebuilding them, possibly overwriting artifacts that are in use, as it is done so far.In the same run, fix needless rebuilding of the secured spl dtb.
Fixes 508369672ca3 ("arm: mach-k3: Add secure device build support")CC Andrew F. Davis <[email protected]>Signed-off-by Jan Kiszka <[email protected]>--- arch/arm/dts/Makefile | 6 ++++-- arch/arm/mach-k3/config_secure.mk | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-)arch/arm/dts/Makefile +0
-0
arch/arm/dts/Makefile line 4
Quoted 4 lines
arch/arm/dts/Makefile +2
-0@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ +include $(srctree)/arch/arm/mach-k3/config_secure.mk +
This is hacky, we should not in the top level dts makefile have a dependency on a specific platform configuration file.
What about mach-omap/config_secure.mk, etc..
The negative of building dtbs twice for HS is very minor compared to the extra complexity this patch adds. It will be much more difficult to clean this up later.
Andrew
Quoted 60 lines
arch/arm/dts/Makefile +2
-2dtb-$(CONFIG_TARGET_SMARTWEB) += at91sam9260-smartweb.dtb dtb-$(CONFIG_TARGET_TAURUS) += at91sam9g20-taurus.dtb dtb-$(CONFIG_TARGET_CORVUS) += at91sam9g45-corvus.dtb@@ -927,13 +929,13 @@ dtb-$(CONFIG_TARGET_DURIAN) += phytium-durian.dtb dtb-$(CONFIG_TARGET_PRESIDIO_ASIC) += ca-presidio-engboard.dtb -targets += $(dtb-y) +targets += $(dtb-y) $(TI_SECURE_DTBS) # Add any required device tree compiler flags here DTC_FLAGS += PHONY += dtbs -dtbs: $(addprefix $(obj)/, $(dtb-y)) +dtbs: $(addprefix $(obj)/, $(dtb-y) $(TI_SECURE_DTBS)) @: clean-files := *.dtb *.dtbo *_HSarch/arm/mach-k3/config_secure.mk +14
-6@@ -26,7 +26,12 @@ endif $(obj)/u-boot-spl-nodtb.bin_HS: $(obj)/u-boot-spl-nodtb.bin FORCE $(call if_changed,k3secureimg) -tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst %,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST))) $(SPL_ITS) FORCE +SPL_OF_LIST_TARGETS = $(patsubst %,dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST))) +SPL_OF_LIST_TARGETS_HS = $(addsuffix _HS,$(SPL_OF_LIST_TARGETS)) + +targets += $(SPL_OF_LIST_TARGETS) $(SPL_OF_LIST_TARGETS_HS) + +tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(addprefix $(obj)/,$(SPL_OF_LIST_TARGETS_HS)) $(SPL_ITS) FORCE $(call if_changed,mkfitimage) MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \@@ -34,11 +39,15 @@ 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) + +# Used when included by arch-dts makefile +-include include/config/auto.conf + +ifeq ($(CONFIG_TI_SECURE_DEVICE),y) +TI_SECURE_DTBS = $(addsuffix _HS, $(dtb-y)) +endif --2.26.1
PATCH 4/4 kbuild: arm: Fix duplicate builds of dtbs
Quoted 24 lines · Andrew F. Davis
Quoted 23 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Build the secured board dtbs (.dtb_HS) as part of the regular dtb build on
CONFIG_TI_SECURE_DEVICEtargets. This avoids rebuilding them, possibly overwriting artifacts that are in use, as it is done so far.In the same run, fix needless rebuilding of the secured spl dtb.
Fixes 508369672ca3 ("arm: mach-k3: Add secure device build support")CC Andrew F. Davis <[email protected]>Signed-off-by Jan Kiszka <[email protected]>--- arch/arm/dts/Makefile | 6 ++++-- arch/arm/mach-k3/config_secure.mk | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-)arch/arm/dts/Makefile +0
-0@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+
Quoted 8 lines
arch/arm/dts/Makefile line 4
Quoted 2 lines
arch/arm/dts/Makefile +2
-0+include $(srctree)/arch/arm/mach-k3/config_secure.mk +This is hacky, we should not in the top level dts makefile have a dependency on a specific platform configuration file.
What about
mach-omap/config_secure.mk, etc..
They don't need those special signing the k3 need. If they did, they could be included here as well.
Quoted 4 lines
The negative of building dtbs twice for HS is very minor compared to the extra complexity this patch adds. It will be much more difficult to clean this up later.
Overwriting a build artifacts that were already completed and may just be in use while doing so is broken. This must be fixed.
As I wrote, I will add support for injecting public keys into the dtbs, and that also revealed this issue.
Better suggestions welcome.
Jan
PATCH 4/4 kbuild: arm: Fix duplicate builds of dtbs
Quoted 32 lines · Jan Kiszka
Quoted 31 lines · Andrew F. Davis
Quoted 23 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Build the secured board dtbs (.dtb_HS) as part of the regular dtb build on
CONFIG_TI_SECURE_DEVICEtargets. This avoids rebuilding them, possibly overwriting artifacts that are in use, as it is done so far.In the same run, fix needless rebuilding of the secured spl dtb.
Fixes 508369672ca3 ("arm: mach-k3: Add secure device build support")CC Andrew F. Davis <[email protected]>Signed-off-by Jan Kiszka <[email protected]>---
?arch/arm/dts/Makefile???????????? |? 6 ++++--
?arch/arm/mach-k3/config_secure.mk| 19 ++++++++++++++----- ? 2 files changed, 18 insertions(+), 7 deletions(-)arch/arm/dts/Makefile +0
-0@@ -1,5 +1,7 @@? # SPDX-License-Identifier: GPL-2.0+
arch/arm/dts/Makefile line 4
Quoted 2 lines
arch/arm/dts/Makefile +2
-0+include $(srctree)/arch/arm/mach-k3/config_secure.mk +This is hacky, we should not in the top level dts makefile have a dependency on a specific platform configuration file.
Quoted 5 lines
Quoted 1 line
What about
mach-omap/config_secure.mk, etc..They don't need those special signing the k3 need. If they did, they could be included here as well.
I did everything the same in that file, so I don't see why it wouldn't need the same treatment. But my point is that this will keep growing, the fixes should be local to the mk files or everyone who does something similar will need to add here.
Quoted 8 lines
Quoted 4 lines
The negative of building dtbs twice for HS is very minor compared to the extra complexity this patch adds. It will be much more difficult to clean this up later.
Overwriting a build artifacts that were already completed and may just be in use while doing so is broken. This must be fixed.
Absolutely agree it needs fixed, just not sure this just doesn't add to the makefile complexity in the wrong way.
Quoted 3 lines
As I wrote, I will add support for injecting public keys into the dtbs, and that also revealed this issue.
If I understand right, you are adding the keys into the dtb then signing them? Why not add them to the dts first, then nothing would need to change with multiple builds of the dtbs.
Andrew
Quoted 3 lines
Better suggestions welcome.
Jan
PATCH 4/4 kbuild: arm: Fix duplicate builds of dtbs
Quoted 40 lines · Andrew F. Davis
Quoted 32 lines · Jan Kiszka
Quoted 31 lines · Andrew F. Davis
Quoted 21 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Build the secured board dtbs (.dtb_HS) as part of the regular dtb build on
CONFIG_TI_SECURE_DEVICEtargets. This avoids rebuilding them, possibly overwriting artifacts that are in use, as it is done so far.In the same run, fix needless rebuilding of the secured spl dtb.
Fixes 508369672ca3 ("arm: mach-k3: Add secure device build support")CC Andrew F. Davis <[email protected]>Signed-off-by Jan Kiszka <[email protected]>---
?arch/arm/dts/Makefile???????????? |? 6 ++++--? arch/arm/mach-k3/config_secure.mk | 19 ++++++++++++++-----? 2 files changed, 18 insertions(+), 7 deletions(-)
arch/arm/dts/Makefile +0
-0arch/arm/dts/Makefile line 4
Quoted 4 lines
arch/arm/dts/Makefile +2
-0@@ -1,5 +1,7 @@ ? # SPDX-License-Identifier: GPL-2.0+ +include $(srctree)/arch/arm/mach-k3/config_secure.mk +This is hacky, we should not in the top level dts makefile have a dependency on a specific platform configuration file.
Quoted 5 lines
Quoted 1 line
What about
mach-omap/config_secure.mk, etc..They don't need those special signing the k3 need. If they did, they could be included here as well.
Quoted 5 lines
I did everything the same in that file, so I don't see why it wouldn't need the same treatment. But my point is that this will keep growing, the fixes should be local to the mk files or everyone who does something similar will need to add here.
The problem is that dtbs are built in a separate make session. If you want to address specific dtbs in a rule, you must do that in that session, not outside like you did. That applies to signing for TI K3, just like it would for bringing in public keys as discussed below.
I think you mentioned offlist that eliminating this nesting would help, but I do not yet see if that can be easily done.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
The negative of building dtbs twice for HS is very minor compared to the extra complexity this patch adds. It will be much more difficult to clean this up later.
Quoted 8 lines
Quoted 3 lines
Overwriting a build artifacts that were already completed and may just be in use while doing so is broken. This must be fixed.
Absolutely agree it needs fixed, just not sure this just doesn't add to the makefile complexity in the wrong way.
As I said, I'm open for other approaches that resolve this.
Quoted 9 lines
Quoted 4 lines
As I wrote, I will add support for injecting public keys into the dtbs, and that also revealed this issue.
If I understand right, you are adding the keys into the dtb then signing them? Why not add them to the dts first, then nothing would need to change with multiple builds of the dtbs.
You sign the chain from right to left, while loading is left to right:
the right-side image is signed while injecting the necessary keys/certs into the left-side image that loads it. And then that is signed as well, in the end often with a hardware-specific mechanism (unfortunately).
But dtbs are hardware-specific, keys are deployment-specific. That's why they are injected into existing dtbs, rather than asking the user to patch them into dts files in the source tree. Just today I ran into another piece of code that models this signing and key injection outside of U-Boot, with a lot of knowledge about the particular target. It would be way nicer to solve that generically.
Jan