Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: centralize .dts->.dtb rule

All architectures that use cmd_dtc do so in almost the same way. Create
a central build rule to avoid duplication. The one difference is that
most current uses of dtc build $(obj)/%.dtb from $(src)/dts/%.dts rather
than building the .dtb in the same directory as the .dts file. This
difference will be eliminated arch-by-arch in future patches.

MIPS is the exception here; it already uses the exact same rule as the
new common rule, so the duplicate is removed in this patch to avoid any
conflict. arch/mips changes courtesy of Ralf Baechle.

Update Documentation/kbuild to remove the explicit call to cmd_dtc from
the example, now that the rule exists in a centralized location.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Olof Johansson <olof@lixom.net>
Cc: Russell King <linux@arm.linux.org.uk>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux@lists.openrisc.net
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: linux-c6x-dev@linux-c6x.org
Cc: Mark Salter <msalter@redhat.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa@linux-xtensa.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>

authored by

Stephen Warren and committed by
Rob Herring
90b335fb 4a92a385

+12 -17
+9 -8
Documentation/kbuild/makefiles.txt
··· 1175 1175 in an init section in the image. Platform code *must* copy the 1176 1176 blob to non-init memory prior to calling unflatten_device_tree(). 1177 1177 1178 + To use this command, simply add *.dtb into obj-y or targets, or make 1179 + some other target depend on %.dtb 1180 + 1181 + A central rule exists to create $(obj)/%.dtb from $(src)/%.dts; 1182 + architecture Makefiles do no need to explicitly write out that rule. 1183 + 1178 1184 Example: 1179 - #arch/x86/platform/ce4100/Makefile 1180 - clean-files := *dtb.S 1181 - 1182 - DTC_FLAGS := -p 1024 1183 - obj-y += foo.dtb.o 1184 - 1185 - $(obj)/%.dtb: $(src)/%.dts 1186 - $(call cmd,dtc) 1185 + targets += $(dtb-y) 1186 + clean-files += *.dtb 1187 + DTC_FLAGS ?= -p 1024 1187 1188 1188 1189 --- 6.8 Custom kbuild commands 1189 1190
-3
arch/mips/cavium-octeon/Makefile
··· 24 24 25 25 obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES)) 26 26 27 - $(obj)/%.dtb: $(src)/%.dts FORCE 28 - $(call if_changed_dep,dtc) 29 - 30 27 # Let's keep the .dtb files around in case we want to look at them. 31 28 .SECONDARY: $(addprefix $(obj)/, $(DTB_FILES)) 32 29
-3
arch/mips/lantiq/dts/Makefile
··· 1 1 obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o 2 - 3 - $(obj)/%.dtb: $(obj)/%.dts 4 - $(call if_changed,dtc)
-3
arch/mips/netlogic/dts/Makefile
··· 1 1 obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o 2 - 3 - $(obj)/%.dtb: $(obj)/%.dts 4 - $(call if_changed,dtc)
+3
scripts/Makefile.lib
··· 266 266 quiet_cmd_dtc = DTC $@ 267 267 cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< 268 268 269 + $(obj)/%.dtb: $(src)/%.dts FORCE 270 + $(call if_changed_dep,dtc) 271 + 269 272 # Bzip2 270 273 # --------------------------------------------------------------------------- 271 274