Patchwork [U-Boot,v4,3/6] fdt: Add support for a separate device tree (CONFIG_OF_SEPARATE)

login
register
mail settings
Submitter Simon Glass
Date Oct. 15, 2011, 3:48 p.m.
Message ID <1318693706-3381-4-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/119981/
State New, archived
Headers show

Comments

Simon Glass - Oct. 15, 2011, 3:48 p.m.
This adds support for an FDT to be build as a separate binary file called
u-boot.dtb. This can be concatenated with the U-Boot binary to provide a
device tree located at run-time by U-Boot. The Makefile is modified to
provide this file in u-boot-dtb.bin.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Modify Makefile to create combined U-boot/fdt (u-boot-dtb.bin)

 .gitignore |    1 +
 Makefile   |    8 ++++++++
 README     |   16 ++++++++++++++--
 3 files changed, 23 insertions(+), 2 deletions(-)

Patch

diff --git a/.gitignore b/.gitignore
index 0a9dc0c..a367082 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ 
 /u-boot.dis
 /u-boot.lds
 /u-boot.ubl
+/u-boot.dtb
 
 #
 # Generated files
diff --git a/Makefile b/Makefile
index 05f64b7..9a640e9 100644
--- a/Makefile
+++ b/Makefile
@@ -354,9 +354,17 @@  ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
 ALL-$(CONFIG_MMC_U_BOOT) += $(obj)mmc_spl/u-boot-mmc-spl.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
+ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 
 all:		$(ALL-y)
 
+$(obj)u-boot.dtb:	$(obj)u-boot
+		$(MAKE) -C dts binary
+		mv $(obj)dts/dt.dtb $@
+
+$(obj)u-boot-dtb.bin:	$(obj)u-boot.bin $(obj)u-boot.dtb
+		cat $^ >$@
+
 $(obj)u-boot.hex:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
 
diff --git a/README b/README
index b5cdcb5..fc1cd00 100644
--- a/README
+++ b/README
@@ -819,8 +819,8 @@  The following options need to be configured:
 		experimental and only available on a few boards. The device
 		tree is available in the global data as gd->fdt_blob.
 
-		U-Boot needs to get its device tree from somewhere. At present
-		the only way is to embed it in the image with CONFIG_OF_EMBED.
+		U-Boot needs to get its device tree from somewhere. This can
+		be done using one of the two options below:
 
 		CONFIG_OF_EMBED
 		If this variable is defined, U-Boot will embed a device tree
@@ -829,6 +829,18 @@  The following options need to be configured:
 		is then picked up in board_init_f() and made available through
 		the global data structure as gd->blob.
 
+		CONFIG_OF_SEPARATE
+		If this variable is defined, U-Boot will build a device tree
+		binary. It will be called u-boot.dtb. Architecture-specific
+		code will locate it at run-time. Generally this works by:
+
+			cat u-boot.bin u-boot.dtb >image.bin
+
+		and in fact, U-Boot does this for you, creating a file called
+		u-boot-dtb.bin which is useful in the common case. You can
+		still use the individual files if you need something more
+		exotic.
+
 - Watchdog:
 		CONFIG_WATCHDOG
 		If this variable is defined, it enables watchdog