Add support for building a device tree for sandbox's CONFIG_OF_HOSTFILE
option to make it easier to use device tree with sandbox.

This adjusts the Makefile to build a u-boot.dtb file which can be passed
to sandbox U-Boot with:

   ./u-boot -d u-boot.dtb

Reviewed-by: Che-Liang Chiou <clch...@chromium.org>
Reviewed-by: Gabe Black <gabebl...@chromium.org>
Signed-off-by: Simon Glass <s...@chromium.org>
---

Changes in v2: None

 Makefile                     |  3 ++-
 arch/sandbox/dts/Makefile    | 11 +++++++++++
 arch/sandbox/dts/sandbox.dts | 30 ++++++++++++++++++++++++++++++
 include/configs/sandbox.h    |  1 +
 4 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 arch/sandbox/dts/Makefile
 create mode 100644 arch/sandbox/dts/sandbox.dts

diff --git a/Makefile b/Makefile
index 0c0ff1d..17cd6ac 100644
--- a/Makefile
+++ b/Makefile
@@ -720,6 +720,7 @@ ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
 ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
+ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
 endif
@@ -1371,7 +1372,7 @@ endif
        $(build)=$(build-dir) $(@:.ko=.o)
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
-# FIXME Should go into a make.lib or something 
+# FIXME Should go into a make.lib or something
 # ===========================================================================
 
 quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
diff --git a/arch/sandbox/dts/Makefile b/arch/sandbox/dts/Makefile
new file mode 100644
index 0000000..a4c980b
--- /dev/null
+++ b/arch/sandbox/dts/Makefile
@@ -0,0 +1,11 @@
+dtb-$(CONFIG_SANDBOX) += sandbox.dtb
+
+targets += $(dtb-y)
+
+DTC_FLAGS += -R 4 -p 0x1000
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := *.dtb
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
new file mode 100644
index 0000000..ea4b8ad
--- /dev/null
+++ b/arch/sandbox/dts/sandbox.dts
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       model = "Sandbox test environment";
+
+       memory {
+               reg = <0 0x08000000>;
+       };
+
+       triangle {
+               compatible = "demo-shape";
+               colour = "cyan";
+               sides = <3>;
+               character = <83>;
+       };
+       square {
+               compatible = "demo-shape";
+               colour = "blue";
+               sides = <4>;
+       };
+       hexagon {
+               compatible = "demo-simple";
+               colour = "white";
+               sides = <6>;
+       };
+
+};
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 6fa2d03..e674233 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -32,6 +32,7 @@
 #define CONFIG_FIT_SIGNATURE
 #define CONFIG_RSA
 #define CONFIG_CMD_FDT
+#define CONFIG_DEFAULT_DEVICE_TREE     sandbox
 
 #define CONFIG_FS_FAT
 #define CONFIG_FS_EXT4
-- 
1.9.0.279.gdc9e3eb

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to