mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Kbuild: do not build dtbs concurrently
@ 2025-08-28  9:31 Sascha Hauer
  2025-09-01 10:39 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-08-28  9:31 UTC (permalink / raw)
  To: Barebox List; +Cc: Ahmad Fatoum

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@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)/% ;
 
-- 
2.47.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Kbuild: do not build dtbs concurrently
  2025-08-28  9:31 [PATCH] Kbuild: do not build dtbs concurrently Sascha Hauer
@ 2025-09-01 10:39 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2025-09-01 10:39 UTC (permalink / raw)
  To: Sascha Hauer, Barebox List; +Cc: Ahmad Fatoum

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@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@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 |




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-01 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-28  9:31 [PATCH] Kbuild: do not build dtbs concurrently Sascha Hauer
2025-09-01 10:39 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox