summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLianghong Liu <[email protected]>2026-07-23 09:40:21 +0800
committerTom Rini <[email protected]>2026-08-10 14:48:11 -0600
commit93926f630e486d3cb2f2278c2785b2e2e9a3d705 (patch)
tree72edc3b06f7211d06dad2afbfcdd7ad8b051bc28
parent4cb0bd4702a623d69648496a352744e81bfaa95f (diff)
Makefile: depend on OF_LIST dts sources for fit-dtb.blob
When CONFIG_MULTI_DTB_FIT is enabled, fit-dtb.blob is produced by mkimage with one "-b " argument for every entry in CONFIG_OF_LIST. The make rule, however, only listed dts/dt.dtb (i.e. the CONFIG_DEFAULT_DEVICE_TREE blob) as a prerequisite: fit-dtb.blob: dts/dt.dtb FORCE $(call if_changed,mkimage) Because FORCE is PHONY, if_changed ignores it and rebuilds only when any-prereq or arg-check is non-empty. Editing a non-default dts in OF_LIST rebuilds its .dtb (tracked correctly via fixdep), but that .dtb was not a prerequisite of fit-dtb.blob, so $? stayed empty; the mkimage command line was unchanged too, so arg-check was empty as well. if_changed therefore skipped mkimage and fit-dtb.blob kept the stale dtbs. u-boot.bin, which appends fit-dtb.blob, then shipped the old device tree and the dts change did not take effect. A previous attempt to fix this added every OF_LIST .dtb *output* as a prerequisite. That is wrong on two counts: - Clean build regression: the OF_LIST .dtb files are produced only by the recursive dts/dt.dtb -> arch-dtbs sub-make descent and have no rule at the top make level, so listing them as prerequisites makes them rule-less/intermediate. After a from-scratch rebuild (e.g. wiping an out-of-tree build directory) it fails: make[1]: *** No rule to make target 'arch/arm/dts/.dtb', needed by 'fit-dtb.blob'. Stop. - Incremental two-build race still present: the .dtb outputs are written by a child sub-make descent while the parent make level checks prerequisites, so under `make -j` an edit can still need two make invocations to take effect. List the .dts *sources* instead, which the top make level can see via VPATH in both objtree and srctree. Use $(dt_dir), as MKIMAGEFLAGS_fit-dtb.blob already does just below, so that CONFIG_OF_UPSTREAM boards (whose sources live under dts/upstream/src/) are handled too; a helper variable keeps the rule under 80 columns. Limitation: this only catches edits to the top-level .dts files in OF_LIST. An edit to an included .dtsi (including the *-u-boot.dtsi files) rebuilds the .dtb but leaves fit-dtb.blob stale, so the two-build problem remains in that case. Fixing that fully would need the .dtb outputs (rather than the .dts sources) as prerequisites, which reintroduces the clean-build problem above; covering top-level .dts edits is already a worthwhile improvement. Signed-off-by: Lianghong Liu <[email protected]> Reviewed-by: Simon Glass <[email protected]>
-rw-r--r--Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index c5cc8276fa0..f36c0a644a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1476,7 +1476,8 @@ fit-dtb.blob.gz: fit-dtb.blob
fit-dtb.blob.lzo: fit-dtb.blob
@lzop -f9 $< > $@
-fit-dtb.blob: dts/dt.dtb FORCE
+of_list_srcs := $(patsubst %,$(dt_dir)/%.dts,$(subst ",,$(CONFIG_OF_LIST)))
+fit-dtb.blob: dts/dt.dtb $(of_list_srcs) FORCE
$(call if_changed,mkimage)
ifneq ($(SOURCE_DATE_EPOCH),)
touch -d @$(SOURCE_DATE_EPOCH) fit-dtb.blob