Skip to content

Commit 7c43185

Browse files
Stephen Warrenmichal42
authored andcommitted
Kbuild: Use dtc's -d (dependency) option
This hooks dtc into Kbuild's dependency system. Thus, for example, "make dtbs" will rebuild tegra-harmony.dtb if only tegra20.dtsi has changed yet tegra-harmony.dts has not. The previous lack of this feature recently caused me to have very confusing "git bisect" results. For ARM, it's obvious what to add to $(targets). I'm not familiar enough with other architectures to know what to add there. Powerpc appears to already add various .dtb files into $(targets), but the other archs may need something added to $(targets) to work. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> [mmarek: Dropped arch/c6x part to avoid merging commits from the middle of the merge window] Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent 136ec20 commit 7c43185

5 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎arch/arm/boot/Makefile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
5959

6060
endif
6161

62+
targets += $(dtb-y)
63+
6264
# Rule to build device tree blobs
63-
$(obj)/%.dtb: $(src)/dts/%.dts
64-
$(call cmd,dtc)
65+
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
66+
$(call if_changed_dep,dtc)
6567

6668
$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
6769

‎arch/microblaze/boot/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ $(obj)/simpleImage.%: vmlinux FORCE
5353
DTC_FLAGS := -p 1024
5454

5555
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
56-
$(call cmd,dtc)
56+
$(call if_changed_dep,dtc)
5757

5858
clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub

‎arch/openrisc/boot/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ clean-files := *.dtb.S
1111

1212
#DTC_FLAGS ?= -p 1024
1313

14-
$(obj)/%.dtb: $(src)/dts/%.dts
15-
$(call cmd,dtc)
14+
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
15+
$(call if_changed_dep,dtc)

‎arch/powerpc/boot/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
334334
$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
335335

336336
# Rule to build device tree blobs
337-
$(obj)/%.dtb: $(src)/dts/%.dts
338-
$(call cmd,dtc)
337+
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
338+
$(call if_changed_dep,dtc)
339339

340340
# If there isn't a platform selected then just strip the vmlinux.
341341
ifeq (,$(image-y))

‎scripts/Makefile.lib‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
264264
$(call cmd,dt_S_dtb)
265265

266266
quiet_cmd_dtc = DTC $@
267-
cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $<
267+
cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
268268

269269
# Bzip2
270270
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)