dts: generate multiple device tree blobs
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Wed, 5 Feb 2014 02:28:27 +0000 (11:28 +0900)
committerTom Rini <trini@ti.com>
Wed, 19 Feb 2014 16:10:05 +0000 (11:10 -0500)
It is convenient to have all device trees on the same SoC compiled.
It allows for later easy repackaging without the need to re-run
the make file.

  - Build device trees with the same SoC under arch/$(ARCH)/dts

  - Copy the one specified by CONFIG_DEFAULT_DEVICE_TREE or
    DEVICE_TREE=... to dts/dt.dtb

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
arch/arm/dts/.gitignore [new file with mode: 0644]
arch/arm/dts/Makefile [new file with mode: 0644]
arch/microblaze/dts/.gitignore [new file with mode: 0644]
arch/microblaze/dts/Makefile [new file with mode: 0644]
arch/x86/dts/.gitignore [new file with mode: 0644]
arch/x86/dts/Makefile [new file with mode: 0644]
dts/Makefile

diff --git a/arch/arm/dts/.gitignore b/arch/arm/dts/.gitignore
new file mode 100644 (file)
index 0000000..b60ed20
--- /dev/null
@@ -0,0 +1 @@
+*.dtb
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
new file mode 100644 (file)
index 0000000..2658911
--- /dev/null
@@ -0,0 +1,37 @@
+dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \
+       exynos5250-snow.dtb \
+       exynos5250-smdk5250.dtb \
+       exynos5420-smdk5420.dtb
+
+dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
+       tegra20-medcom-wide.dtb \
+       tegra20-paz00.dtb \
+       tegra20-plutux.dtb \
+       tegra20-seaboard.dtb \
+       tegra20-tec.dtb \
+       tegra20-trimslice.dtb \
+       tegra20-ventana.dtb \
+       tegra20-whistler.dtb \
+       tegra20-colibri_t20_iris.dtb \
+       tegra30-beaver.dtb \
+       tegra30-cardhu.dtb \
+       tegra30-tec-ng.dtb \
+       tegra114-dalmore.dtb
+
+dtb-$(CONFIG_ZYNQ) += zynq-zc702.dtb \
+       zynq-zc706.dtb \
+       zynq-zed.dtb \
+       zynq-microzed.dtb \
+       zynq-zc770-xm010.dtb \
+       zynq-zc770-xm012.dtb \
+       zynq-zc770-xm013.dtb
+
+targets += $(dtb-y)
+
+DTC_FLAGS += -R 4 -p 0x1000
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := *.dtb
diff --git a/arch/microblaze/dts/.gitignore b/arch/microblaze/dts/.gitignore
new file mode 100644 (file)
index 0000000..b60ed20
--- /dev/null
@@ -0,0 +1 @@
+*.dtb
diff --git a/arch/microblaze/dts/Makefile b/arch/microblaze/dts/Makefile
new file mode 100644 (file)
index 0000000..6d4a11f
--- /dev/null
@@ -0,0 +1,11 @@
+dtb-y += microblaze-generic.dtb
+
+targets += $(dtb-y)
+
+DTC_FLAGS += -R 4 -p 0x1000
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := *.dtb
diff --git a/arch/x86/dts/.gitignore b/arch/x86/dts/.gitignore
new file mode 100644 (file)
index 0000000..b60ed20
--- /dev/null
@@ -0,0 +1 @@
+*.dtb
diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile
new file mode 100644 (file)
index 0000000..48265ef
--- /dev/null
@@ -0,0 +1,12 @@
+dtb-y += link.dtb \
+       alex.dtb
+
+targets += $(dtb-y)
+
+DTC_FLAGS += -R 4 -p 0x1000
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := *.dtb
index 5d2abd9f5c359f95a669e9db5e76cebe3fe745ac..9907463fc6344d524d9ea415db5112573c6e1a8b 100644 (file)
@@ -9,24 +9,30 @@
 
 DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
 ifeq ($(DEVICE_TREE),)
-DEVICE_TREE := notfound
+DEVICE_TREE := unset
 endif
 
-DTS := $(srctree)/arch/$(ARCH)/dts/$(DEVICE_TREE).dts
+DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
 
-DTC_FLAGS += -R 4 -p 0x1000
+quiet_cmd_copy = COPY    $@
+      cmd_copy = cp $< $@
 
-$(obj)/dt.dtb: $(DTS) FORCE
-       $(call if_changed_dep,dtc)
+$(obj)/dt.dtb: $(DTB) FORCE
+       $(call if_changed,copy)
 
 targets += dt.dtb
 
-$(DTS):
-       @echo >&2
-       @echo >&2 "Device Tree Source is not specified."
-       @echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"
-       @echo >&2 "or build with 'DEVICE_TREE=<dts-file-name>' argument"
-       @/bin/false
+$(DTB): arch-dtbs
+       $(Q)test -e $@ || (                                             \
+       echo >&2;                                                       \
+       echo >&2 "Device Tree Source is not correctly specified.";      \
+       echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'";          \
+       echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument";  \
+       echo >&2;                                                       \
+       /bin/false)
+
+arch-dtbs:
+       $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
 
 .SECONDARY: $(obj)/dt.dtb.S
 
@@ -36,3 +42,6 @@ dtbs: $(obj)/dt.dtb
        @:
 
 clean-files := dt.dtb.S
+
+# Let clean descend into dts directories
+subdir- += ../arch/*/dts