[U-Boot] [PATCH 06/32] sandbox: Build a device tree file for sandbox

Simon Glass sjg at chromium.org
Sun Nov 10 18:26:52 CET 2013


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

Signed-off-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou at chromium.org>
Reviewed-by: Gabe Black <gabeblack at chromium.org>
---
 Makefile                      |  1 +
 arch/sandbox/config.mk        |  2 ++
 board/sandbox/dts/sandbox.dts | 29 +++++++++++++++++++++++++++++
 include/configs/sandbox.h     |  1 +
 4 files changed, 33 insertions(+)
 create mode 100644 board/sandbox/dts/sandbox.dts

diff --git a/Makefile b/Makefile
index 1f499c5..1b1724c 100644
--- a/Makefile
+++ b/Makefile
@@ -365,6 +365,7 @@ ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
 ALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
 ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
+ALL-$(CONFIG_OF_HOSTFILE) += $(obj)u-boot.dtb
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
 endif
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 6142dd4..60b7262 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -7,3 +7,5 @@ PLATFORM_LIBS += -lrt
 
 # Support generic board on sandbox
 __HAVE_ARCH_GENERIC_BOARD := y
+
+CONFIG_ARCH_DEVICE_TREE := sandbox
diff --git a/board/sandbox/dts/sandbox.dts b/board/sandbox/dts/sandbox.dts
new file mode 100644
index 0000000..9d7700c
--- /dev/null
+++ b/board/sandbox/dts/sandbox.dts
@@ -0,0 +1,29 @@
+/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 3444c22..850a216 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.8.4.1



More information about the U-Boot mailing list