[PATCH] kbuild: dtbinst: Create destination directories before installing
From: Konrad Dybcio
Date: Fri Oct 16 2026 - 10:51:47 EST
From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
dtbs_install installs each DTB with 'install -D', which creates the
parent directory of the destination on demand. With a parallel build,
two DTBs that share a not yet existing directory are installed
concurrently and both try to create it. The loser fails, which aborts
the whole build:
install: cannot create directory 'debian/linux-image-7.1.0/usr/lib/linux-image-7.1.0/arm'
make[6]: *** [scripts/Makefile.dtbinst:23: .../arm/foundation-v8-gicv3.dtb] Error 1
The failure depends on job scheduling, so it shows up as a build that
fails for no apparent reason and passes when re-run.
Create all destination directories up front, the same way
scripts/Makefile.modinst does for modules, so the install rules no
longer race.
Fixes: aefd80307a05 ("kbuild: refactor Makefile.dtbinst more")
Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
---
scripts/Makefile.dtbinst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
index 9d920419a62c..a55f2a7acbc2 100644
--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -37,6 +37,10 @@ dtbs := $(notdir $(dtbs))
endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
+# Create destination directories up front: with parallel make, concurrent
+# 'install -D' calls race on creating the same parent directory.
+$(foreach dir, $(sort $(dir $(addprefix $(dst)/, $(dtbs)))), $(shell mkdir -p $(dir)))
+
__dtbs_install: $(addprefix $(dst)/, $(dtbs))
@:
---
base-commit: d419d682257d813f6cb7a28e42b35d0edf4ad038
change-id: 20261016-topic-dtbs_install_fix-7c0d9f206fdb
Best regards,
--
Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>