dts: combine dtb in u-boot ELF
u-boot and dtb are seperate images. This patch combines them as
single ELF image.
Change-Id: Ib3c72c26844ffd4fd8489d0595c243a15434802e
Signed-off-by: Manoharan Vijaya Raghavan <mraghava@codeaurora.org>
diff --git a/Makefile b/Makefile
index 100de92..12a1bf1 100644
--- a/Makefile
+++ b/Makefile
@@ -630,6 +630,7 @@
libs-y += lib/
libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
libs-$(CONFIG_OF_EMBED) += dts/
+libs-$(CONFIG_OF_COMBINE) += dts/
libs-y += fs/
libs-y += net/
libs-y += disk/
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index d48a905..5a78f3c 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -144,6 +144,13 @@
KEEP(*(.__bss_end));
}
+#ifdef CONFIG_OF_COMBINE
+ . = ALIGN(4);
+ . = CONFIG_DTB_LOAD_ADDR;
+ .dtb : {
+ KEEP(*(.dtb.combine*));
+ }
+#endif
.dynsym _image_binary_end : { *(.dynsym) }
.dynbss : { *(.dynbss) }
.dynstr : { *(.dynstr*) }
diff --git a/dts/Makefile b/dts/Makefile
index d3122aa..dcb686f 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -37,12 +37,16 @@
.SECONDARY: $(obj)/dt.dtb.S
+.SECONDARY: $(obj)/dt_comb.dtb.S
+
obj-$(CONFIG_OF_EMBED) := dt.dtb.o
+obj-$(CONFIG_OF_COMBINE) := dt_comb.dtb.o
+
dtbs: $(obj)/dt.dtb
@:
-clean-files := dt.dtb.S
+clean-files := dt.dtb.S dt_comb.dtb.S
# Let clean descend into dts directories
subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/sandbox/dts ../arch/x86/dts
diff --git a/include/configs/ipq807x.h b/include/configs/ipq807x.h
index c8dc3ee..72b9132 100644
--- a/include/configs/ipq807x.h
+++ b/include/configs/ipq807x.h
@@ -79,11 +79,16 @@
sizeof(CONFIG_SYS_PROMPT) + 16)
#define CONFIG_SYS_SDRAM_BASE 0x40000000
-#define CONFIG_SYS_TEXT_BASE 0x4f600000
+#define CONFIG_SYS_TEXT_BASE 0x4AD00000
#define CONFIG_SYS_SDRAM_SIZE 0x10000000
#define CONFIG_MAX_RAM_BANK_SIZE CONFIG_SYS_SDRAM_SIZE
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + (64 << 20))
+#define CONFIG_OF_COMBINE 1
+
+#define CONFIG_DTB_LOAD_ADDR 0x4AE00000
+#define CONFIG_EXTRA_ENV_SETTINGS "fdtcontroladdr=0x4AE00000\0"
+
/*
* SPI Flash Configs
*/
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index ed30bf5..ac1a0ff 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -283,6 +283,24 @@
$(obj)/%.dtb.S: $(obj)/%.dtb
$(call cmd,dt_S_dtb)
+# DTB_COMB
+# ---------------------------------------------------------------------------
+
+# Generate an assembly file to wrap the output of the device tree compiler
+quiet_cmd_dt_comb_S_dtb= DTB_COMB $@
+# Modified for U-Boot Combined ELF
+cmd_dt_comb_S_dtb= \
+( \
+ echo '.section .dtb.combine,"a"'; \
+ echo '.balign 16'; \
+ echo '.incbin "$<" '; \
+ echo '.balign 16'; \
+) > $@
+
+$(obj)/%_comb.dtb.S: $(obj)/%.dtb
+ $(call cmd,dt_comb_S_dtb)
+
+
quiet_cmd_dtc = DTC $@
# Modified for U-Boot
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \