Hi Lianghong,

On 2026-07-13T07:45:39, lianghong617 <[email protected]> wrote:
> 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 <dtb>" 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
> [...]
>
> Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> Signed-off-by: lianghong617 <[email protected]>

Please can you use your real name in the Signed-off-by tag? Also we
don't normally use bullet points in a commit message.

>         edit still needs two make invocations to take effect under
>         parallel make (the bdm uboot flow runs make -j33).

The 'bdm uboot' flow and the out/.../build/uboot path are specific to
your downstream build system. Please can you generalise these to plain
'make -j' and a normal out-of-tree build directory?

> diff --git a/Makefile b/Makefile
> @@ -1476,7 +1476,7 @@ fit-dtb.blob.gz: fit-dtb.blob
> -fit-dtb.blob: dts/dt.dtb FORCE
> +fit-dtb.blob: dts/dt.dtb $(patsubst %,arch/$(ARCH)/dts/%.dts,$(subst 
> ",,$(CONFIG_OF_LIST))) FORCE

This hardcodes arch/$(ARCH)/dts, but with CONFIG_OF_UPSTREAM the
sources live under dts/upstream/src/<arch>. For example,
rcar3_salvator-x has OF_LIST="renesas/r8a77951-salvator-x ..." with
sources in dts/upstream/src/arm64/renesas, so this prerequisite points
at arch/arm/dts/renesas/r8a77951-salvator-x.dts, which does not exist
in either objtree or srctree. Make then fails with 'No rule to make
target', breaking every OF_UPSTREAM board that uses MULTI_DTB_FIT.

Please can you use $(dt_dir) instead, as MKIMAGEFLAGS_fit-dtb.blob
already does just below? It handles both cases and VPATH finds the
sources in srctree. A helper variable would also keep the line under
80 columns as well as improving readability, e.g.

    of_list_srcs := $(patsubst %,$(dt_dir)/%.dts,$(subst ",,$(CONFIG_OF_LIST)))

> diff --git a/Makefile b/Makefile
> @@ -1476,7 +1476,7 @@ fit-dtb.blob.gz: fit-dtb.blob
> +fit-dtb.blob: dts/dt.dtb $(patsubst %,arch/$(ARCH)/dts/%.dts,$(subst 
> ",,$(CONFIG_OF_LIST))) FORCE

Just to check, this only catches edits to the top-level .dts files. An
edit to an included .dtsi (including the *-u-boot.dtsi files) rebuilds
the .dtb but still leaves fit-dtb.blob stale, so the two-build problem
remains in that case. That seems an acceptable improvement, but please
can you mention the limitation in the commit message?

Regards,
Simon

Reply via email to