Flaky of-platdata build with sandbox_spl
Sometimes an error happens when building in CI::
Building current source for 1 boards (1 thread, 40 jobs per thread)
sandbox: + sandbox_spl
+spl/dts/dt-uclass.c:57:11: error: implicit declaration of function ‘DM_UCLASS_REF’ [-Werror=implicit-function-declaration]
+ 57 | .prev = &DM_UCLASS_REF(serial)->sibling_node,
+ | ^~~~~~~~~~~~~
e.g.: https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/355191
The problem seems to be in this case that include/generated/dt-decl.h is empty. Perhaps it has not yet been written.
The relevant rules in Makefile.spl look like this::
$(obj)/dts/dt-%.o: $(obj)/dts/dt-%.c $(platdata-hdr)
$(call if_changed,plat)
$(platdata-hdr) $(u-boot-spl-platdata_c) &: $(obj)/$(SPL_BIN).dtb
where:
platdata-hdr := include/generated/dt-structs-gen.h include/generated/dt-decl.h
u-boot-spl-platdata_c is $(obj)/dts/dt-uclass.c $(obj)/dts/dt-device.c
@[ -d $(obj)/dts ] || mkdir -p $(obj)/dts
@# Remove old files since which ones we generate depends on the setting
@# of OF_PLATDATA_INST and this might change between builds. Leaving old
@# ones around is confusing and it is possible that switching the
@# setting again will use the old one instead of regenerating it.
@rm -f $(u-boot-spl-all-platdata_c) $(u-boot-spl-all-platdata)
$(call if_changed,dtoc)
The parallel rule should produce all of the required files at once. But if (only) one of the file is already present it possible that one file will be compiled while this rule is running for other files. If the rule removes the files, or dtoc updates them, it could create a race condition.
Edited by Simon Glass