[PATCH] Kbuild: do not build dtbs concurrently
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 1 03:39:15 PDT 2025
On 8/28/25 11:31 AM, Sascha Hauer wrote:
> commit 3c862a83f019 ("kbuild: restrict dtbs target to enabled DTs by
> default") added the dtbs target as a dependency to the images target.
> In the dtbs target we call into Kbuild for building the device trees.
> The device trees are also built as part of the regular build in
> parallel, so we end up running Kbuild for the same directory twice.
>
> This sometimes results in failed builds with messages like this one
> (done with make V=2):
>
> AS [P] arch/arm/dts/bcm2711-rpi-400.dtb.pbl.o - due to target missing
> AS [P] arch/arm/dts/bcm2711-rpi-400.dtb.pbl.o - due to target missing
> fixdep: error opening file: arch/arm/dts/.bcm2711-rpi-400.dtb.pbl.o.d: No such file or directory
>
> Fix this by removing the dtbs target from the images dependencies. We
> then would no longer build the dtbs-list, so build that unconditionally
> once we descend into a directory containing device trees. The dtbs-list
> is built with always-y which should make sure it is ready once we need
> it in imagages/
>
> Fixes: 3c862a83f019 ("kbuild: restrict dtbs target to enabled DTs by default")
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> Makefile | 7 +------
> scripts/Makefile.build | 2 +-
> scripts/Makefile.dtbs | 2 --
> 3 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index b9c252476f..7620c47cf4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1187,15 +1187,10 @@ ifneq ($(dtstree),)
>
> PHONY += dtbs dtbs_prepare
> dtbs: dtbs_prepare
> - $(Q)$(MAKE) $(build)=$(dtstree) need-dtbslist=1
> + $(Q)$(MAKE) $(build)=$(dtstree)
>
> dtbs_prepare: include/config/kernel.release scripts_dtc
>
> -ifdef CONFIG_OFDEVICE
> -images: dtbs
> -images/%: dtbs
> -endif
> -
> endif
>
> PHONY += scripts_dtc
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 591da3d750..fed8c247f9 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -56,7 +56,7 @@ ifneq ($(userprogs),)
> include scripts/Makefile.userprogs
> endif
>
> -ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
> +ifneq ($(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
> include $(srctree)/scripts/Makefile.dtbs
> endif
>
> diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs
> index 7b5b9e1d16..25ed08e8ee 100644
> --- a/scripts/Makefile.dtbs
> +++ b/scripts/Makefile.dtbs
> @@ -10,11 +10,9 @@ always-y += $(dtb-y)
> # dtbs-list
> # ---------------------------------------------------------------------------
>
> -ifdef need-dtbslist
> subdir-dtbslist := $(addsuffix /dtbs-list, $(subdir-ym))
> dtb-y += $(subdir-dtbslist)
> always-y += $(obj)/dtbs-list
> -endif
>
> $(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ;
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list