Skip to contentSkip to conversation

Makefile: Correct SPL/TPL/DTB build race condition

PATCH In review M. Vefa Bicakci 3 participants 3 messages Nov 12, 2017 – Nov 21, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Correct SPL/TPL/DTB build race condition

When building on a multi-core machine for an SPL-enabled board that also uses CONFIG_OF_EMBED, the following error can be encountered due to a race condition:

make[3]: *** No rule to make target 'spl/dts/dt.dtb.o', needed by

    'spl/dts/built-in.o'.  Stop.

../scripts/Makefile.spl:364: recipe for target 'spl/dts' failed make[2]: *** [spl/dts] Error 2
make[2]: *** Waiting for unfinished jobs....

A reliable way to trigger this race condition is to add "sleep 60" to the end of the "arch-dtbs" rule's recipe in "dts/Makefile" and to build U-Boot against a board which uses the CONFIG_OF_EMBED and CONFIG_SPL options using "make -j8" or a similar command.

This commit corrects this race condition via the use of CONFIG_OF_EMBED in the same way that commit 3c00a2c8b5e2 ("Makefile: Correct dependency race condition with TPL") and commit 054b3a1e80fc ("dm: Makefile: Build of-platdata before SPL") use CONFIG_OF_SEPARATE.

---

 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index 91f41fea8482..a6b489bd86e9 100644
@@ -1402,8 +1402,8 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE
 spl/u-boot-spl.bin: spl/u-boot-spl
 	@:
 spl/u-boot-spl: tools prepare \
-		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
-		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
+		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
+		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
 	$(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all
 
 spl/sunxi-spl.bin: spl/u-boot-spl
@@ -1419,7 +1419,7 @@ spl/boot.bin: spl/u-boot-spl
 	@:
 
 tpl/u-boot-tpl.bin: tools prepare \
-		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb)
+		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb)
 	$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
 
 TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include)
Signature · 1 line
2.9.5
#1 lore raw

PATCH 1/1 Makefile: Correct SPL/TPL/DTB build race condition

Quoted 20 lines · M. Vefa Bicakci

When building on a multi-core machine for an SPL-enabled board that also uses CONFIG_OF_EMBED, the following error can be encountered due to a race condition:

make[3]: *** No rule to make target 'spl/dts/dt.dtb.o', needed by

    'spl/dts/built-in.o'.  Stop.

../scripts/Makefile.spl:364: recipe for target 'spl/dts' failed make[2]: *** [spl/dts] Error 2
make[2]: *** Waiting for unfinished jobs....

A reliable way to trigger this race condition is to add "sleep 60" to the end of the "arch-dtbs" rule's recipe in "dts/Makefile" and to build U-Boot against a board which uses the CONFIG_OF_EMBED and CONFIG_SPL options using "make -j8" or a similar command.

This commit corrects this race condition via the use of CONFIG_OF_EMBED in the same way that commit 3c00a2c8b5e2 ("Makefile: Correct dependency race condition with TPL") and commit 054b3a1e80fc ("dm: Makefile: Build of-platdata before SPL") use CONFIG_OF_SEPARATE.

Quoted 5 lines

---

 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
#2 lore raw
In reply to M. Vefa Bicakci
Quoted 15 lines · M. Vefa Bicakci

When building on a multi-core machine for an SPL-enabled board that also uses CONFIG_OF_EMBED, the following error can be encountered due to a race condition:

make[3]: *** No rule to make target 'spl/dts/dt.dtb.o', needed by

    'spl/dts/built-in.o'.  Stop.

../scripts/Makefile.spl:364: recipe for target 'spl/dts' failed make[2]: *** [spl/dts] Error 2
make[2]: *** Waiting for unfinished jobs....

A reliable way to trigger this race condition is to add "sleep 60" to the end of the "arch-dtbs" rule's recipe in "dts/Makefile" and to build U-Boot against a board which uses the CONFIG_OF_EMBED and CONFIG_SPL options using "make -j8" or a similar command.

Quoted 7 lines

This commit corrects this race condition via the use of CONFIG_OF_EMBED in the same way that commit 3c00a2c8b5e2 ("Makefile: Correct dependency race condition with TPL") and commit 054b3a1e80fc ("dm: Makefile: Build of-platdata before SPL") use CONFIG_OF_SEPARATE.

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: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171121/151ea737/attachment.sig>