of: Add support for linking device tree blobs into vmlinux
[pandora-kernel.git] / scripts / Makefile.lib
index 4c72c11..396da16 100644 (file)
@@ -200,6 +200,29 @@ quiet_cmd_gzip = GZIP    $@
 cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
        (rm -f $@ ; false)
 
+# DTC
+# ---------------------------------------------------------------------------
+
+# Generate an assembly file to wrap the output of the device tree compiler
+quiet_cmd_dt_S_dtb= DTB    $@
+cmd_dt_S_dtb=                                          \
+(                                                      \
+       echo '\#include <asm-generic/vmlinux.lds.h>';   \
+       echo '.section .dtb.init.rodata,"a"';           \
+       echo '.balign STRUCT_ALIGNMENT';                \
+       echo '.global __dtb_$(*F)_begin';               \
+       echo '__dtb_$(*F)_begin:';                      \
+       echo '.incbin "$<" ';                           \
+       echo '__dtb_$(*F)_end:';                        \
+       echo '.global __dtb_$(*F)_end';                 \
+       echo '.balign STRUCT_ALIGNMENT';                \
+) > $@
+
+$(obj)/%.dtb.S: $(obj)/%.dtb
+       $(call cmd,dt_S_dtb)
+
+quiet_cmd_dtc = DTC     $@
+cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $<
 
 # Bzip2
 # ---------------------------------------------------------------------------