[Crosstoolchain-logs] [SCM] OpenFirmware Device Tree Compiler for Flat Device Trees branch, master, updated. debian/1.3.0-1-1-g2ff595c

Hector Oron hector.oron at gmail.com
Sat Feb 25 16:11:38 UTC 2012


The following commit has been merged in the master branch:
commit 2ff595c77955b31f3a58fed5cd83dc0339330300
Author: Hector Oron <zumbi at debian.org>
Date:   Sat Jan 28 01:16:09 2012 +0100

    Imported Debian patch 1.3.0-2

diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..23d4c85
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,2 @@
+The patch system used in this package is quilt based.
+Refer to /usr/share/doc/quilt/README.source for further information.
diff --git a/debian/changelog b/debian/changelog
index 94d8e15..2d58e8d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,18 @@
+device-tree-compiler (1.3.0-2) unstable; urgency=low
+
+  * Add libfdt package (Closes: #477565)
+    - Thanks Dmitry Eremin-Solenikov and Aurelien Jarno for patch.
+  * Backport upstream fixes as patches until 2012-1-21.
+  * Reword package description to generalize architecture support.
+    - Removes OpenFirmware and PowerPC references.
+  * Update dtc manpage and include fdtget, fdtput, fdtdump, convert-dtsv0,
+    dtdiff manpages.
+  * d/rules: Add build-arch and build-indep targets.
+  * d/README.source: refer to quilt patching system.
+  * Remove Apps top-level section from doc-base.
+
+ -- Hector Oron <zumbi at debian.org>  Sat, 28 Jan 2012 01:16:09 +0100
+
 device-tree-compiler (1.3.0-1) unstable; urgency=low
 
   * New upstream release. (Closes: #572945)
diff --git a/debian/control b/debian/control
index 8fe0b2e..ed6a5f3 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,27 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=crosstoolchain/device-tree-comp
 
 Package: device-tree-compiler
 Architecture: any
-Depends: ${shlibs:Depends}
-Description: OpenFirmware Device Tree Compiler for Flat Device Trees
- This tool compiles device-tree descriptions for booting PowerPC
- kernels on embedded systems without OpenFirmware.
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Device Tree Compiler for Flat Device Trees
+ Device Tree Compiler, dtc, takes as input a device-tree in
+ a given format and outputs a device-tree in another format
+ for booting kernels on embedded systems.
+ .
+ Typically, the input format is "dts", a human readable source
+ format, and creates a "dtb", or binary format as output.
+
+Package: libfdt1
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Flat Device Trees manipulation library
+ This is a library containing functions for manipulating Flat Device Trees.
+
+Package: libfdt-dev
+Architecture: any
+Section: libdevel
+Depends: libfdt1 (= ${binary:Version}), ${misc:Depends}
+Description: Flat Device Trees manipulation library - development files
+ This is a library containing functions for manipulating Flat Device Trees.
+ .
+ This package contains the files needed for development against libfdt.
diff --git a/debian/device-tree-compiler.install b/debian/device-tree-compiler.install
new file mode 100644
index 0000000..1df36c6
--- /dev/null
+++ b/debian/device-tree-compiler.install
@@ -0,0 +1 @@
+usr/bin/*
diff --git a/debian/doc-base.dtc-manual b/debian/doc-base.dtc-manual
index 2948dc9..348ba9a 100644
--- a/debian/doc-base.dtc-manual
+++ b/debian/doc-base.dtc-manual
@@ -4,7 +4,7 @@ Author: Jon Loeliger
 Abstract: This manual is derived from the kernel documentation
  /usr/share/doc/linux-doc-<version>/Documentation/powerpc/booting-without-of.txt.gz
  which is now out of date.
-Section: Apps/Programming
+Section: Programming
 
 Format: Text
 Files: /usr/share/doc/device-tree-compiler/dtc-manual.txt.gz
diff --git a/debian/doc-base.dtc-paper b/debian/doc-base.dtc-paper
index deae24e..5cec833 100644
--- a/debian/doc-base.dtc-paper
+++ b/debian/doc-base.dtc-paper
@@ -3,7 +3,7 @@ Title: Device trees everywhere
 Author: David Gibson, Benjamin Herrenschmidt 
 Abstract: This paper presents a method for booting a PowerPC Linux
  kernel on an embedded machine.
-Section: Apps/Programming
+Section: Programming
 
 Format: PDF
 Files: /usr/share/doc/device-tree-compiler/dtc-paper.pdf.gz
diff --git a/debian/libfdt-dev.install b/debian/libfdt-dev.install
new file mode 100644
index 0000000..e65e814
--- /dev/null
+++ b/debian/libfdt-dev.install
@@ -0,0 +1,3 @@
+usr/include/*
+usr/lib/libfdt.a
+usr/lib/libfdt.so
diff --git a/debian/libfdt1.install b/debian/libfdt1.install
new file mode 100644
index 0000000..53545f2
--- /dev/null
+++ b/debian/libfdt1.install
@@ -0,0 +1,2 @@
+usr/lib/libfdt-*.so
+usr/lib/libfdt.so.*
diff --git a/debian/manpages/convert-dtsv0.1 b/debian/manpages/convert-dtsv0.1
new file mode 100644
index 0000000..33e0cfe
--- /dev/null
+++ b/debian/manpages/convert-dtsv0.1
@@ -0,0 +1,22 @@
+.TH DTC 1 "30 January 2012" "Linux"
+.SH NAME
+\fBconvert-dtsv0\fP \- Device Tree Compiler -- Conversion to Version 1
+.SH SYNOPSIS
+\fB/usr/bin/convert-dtsv0\fP [<input_filename ... >]
+.SH DESCRIPTION
+convert-dtsv0 is a small utility program which converts (DTS)
+
+Device Tree Source from the obsolete version 0 to version 1.
+Version 1 DTS files are marked by line "/dts-v1/;" at the top of the file.
+
+Each file passed will be converted to the new /dts-v1/ version by creating
+a new file with a "v1" appended the filename.
+
+Comments, empty lines, etc. are preserved.
+.SH AUTHOR
+\fBconvert-dtsv0\fP was written by David Gibson
+<david at gibson.dropbear.id.au>. Since April 1, 2006, Jon Loeliger
+<jdl at jdl.com> assumes maintainership.
+.PP
+This manual page was written by H\['e]ctor Or\['o]n
+<zumbi at debian.org>, for the Debian project (but may be used by others).
diff --git a/debian/manpages/dtc.1 b/debian/manpages/dtc.1
index df37060..1e4c367 100644
--- a/debian/manpages/dtc.1
+++ b/debian/manpages/dtc.1
@@ -1,11 +1,14 @@
-.TH DTC 1 "22 August 2007" "Linux"
+.TH DTC 1 "30 January 2012" "Linux"
 .SH NAME
-\fBdtc\fP \- OpenFirmware Device Tree Compiler
+\fBdtc\fP \- Device Tree Compiler
 .SH SYNOPSIS
 \fB/usr/bin/dtc\fP [options] <input file>
 .SH DESCRIPTION
-This tool compiles device-tree descriptions for booting PowerPC
-kernels on embedded systems without OpenFirmware.
+Device Tree Compiler, dtc, takes as input a device-tree in
+a given format and outputs a device-tree in another format
+for booting kernels on embedded systems.
+Typically, the input format is "dts", a human readable source
+format, and creates a "dtb", or binary format as output.
 .SH OPTIONS
 .TP
 \fB\-h\fR
@@ -49,6 +52,8 @@ Output formats are:
 Blob version to produce. The default is 17 (only relevant for dtb
 and asm output).
 .TP
+\fB\-d\fR <output dependency file>
+.TP
 \fB\-R\fR <number>
 .IP
 Make space for <number> reserve map entries (only relevant for dtb
@@ -57,20 +62,42 @@ and asm output).
 \fB\-S\fR <bytes>
 .IP
 Make the blob at least <bytes> long (extra space).
+.TP
+\fB\-p\fR <bytes>
+.IP
+Add padding to the blob of <bytes> long (extra space)
 .HP
 \fB\-b\fR <number>
 .IP
 Set the physical boot CPU.
 .TP
 \fB\-f\fR
+.IP
 Force \- try to produce output even if the input tree has errors.
 .TP
+\fB\-s\fR
+.IP
+Sort nodes and properties before outputting (only useful for comparing trees)
+.TP
 \fB\-v\fR
 Print DTC version and exit.
+.TP
+\fB\-H\fR <phandle format>
+.IP
+phandle formats are:
+.IP
+\fBlegacy\fR \- "linux,phandle" properties only
+.br
+\fBepapr\fR \- "phandle" properties only
+.br
+\fBboth\fR \- Both "linux,phandle" and "phandle" properties
 .SH AUTHOR
 \fBdtc\fP was written by David Gibson
 <david at gibson.dropbear.id.au>. Since April 1, 2006, Jon Loeliger
 <jdl at jdl.com> assumes maintainership.
 .PP
-This manual page was written by Aur\['e]lien G\['E]R\[^O]ME
+This manual page was originally written by Aur\['e]lien G\['E]R\[^O]ME
 <ag at roxor.cx>, for the Debian project (but may be used by others).
+.PP
+This manual page is currently maintained and update it by H\['e]ctor Or\['o]n
+<zumbi at debian.org>, for the Debian project.
diff --git a/debian/manpages/dtdiff.1 b/debian/manpages/dtdiff.1
new file mode 100644
index 0000000..7649104
--- /dev/null
+++ b/debian/manpages/dtdiff.1
@@ -0,0 +1,14 @@
+.TH DTC 1 "30 January 2012" "Linux"
+.SH NAME
+\fBdtdiff\fP \- compare two different device-tree
+.SH SYNOPSIS
+\fB/usr/bin/dtdiff\fP <device tree> <device tree>
+.SH DESCRIPTION
+Compares two different device-tree.
+.SH AUTHOR
+\fBdtc\fP was written by David Gibson
+<david at gibson.dropbear.id.au>. Since April 1, 2006, Jon Loeliger
+<jdl at jdl.com> assumes maintainership.
+.PP
+This manual page was written by H\['e]ctor Or\['o]n
+<zumbi at debian.org>, for the Debian project (but may be used by others).
diff --git a/debian/manpages/fdtdump.1 b/debian/manpages/fdtdump.1
new file mode 100644
index 0000000..95cf4a4
--- /dev/null
+++ b/debian/manpages/fdtdump.1
@@ -0,0 +1,13 @@
+.TH DTC 1 "30 January 2012" "Linux"
+.SH NAME
+\fBfdtdump\fP \- prints a readable version of a flat device-tree file.
+.SH SYNOPSIS
+\fB/usr/bin/fdtdump\fP <DTB-file-name>
+.SH DESCRIPTION
+The fdtdump program prints a readable version of a flat device-tree file.
+.SH AUTHOR
+\fBfdtdump\fP was written by Pantelis Antoniou
+<pantelis.antoniou AT gmail.com>.
+.PP
+This manual page was written by H\['e]ctor Or\['o]n
+<zumbi at debian.org>, for the Debian project (but may be used by others).
diff --git a/debian/manpages/fdtget.1 b/debian/manpages/fdtget.1
new file mode 100644
index 0000000..0049270
--- /dev/null
+++ b/debian/manpages/fdtget.1
@@ -0,0 +1,25 @@
+.TH DTC 1 "30 January 2012" "Linux"
+.SH NAME
+\fBfdtget\fP \- read values from device-tree
+.SH SYNOPSIS
+\fB/usr/bin/fdtget\fP <options> <dt file> [<node> <property>]...
+.SH DESCRIPTION
+Read values from device-tree. Each value is printed on a new line.
+.SH OPTIONS
+.TP
+\fB\-h\fR
+Print this help.
+.TP
+\fB\-t\fR <type>
+Type of data
+.IP
+<type>  s=string, i=int, u=unsigned, x=hex
+.br
+Optional modifier prefix:
+.br
+hh or b=byte, h=2 byte, l=4 byte (default)
+.SH AUTHOR
+\fBfdtget\fP was written by The Chromium OS Authors.
+.PP
+This manual page was written by H\['e]ctor Or\['o]n
+<zumbi at debian.org>, for the Debian project (but may be used by others).
diff --git a/debian/manpages/fdtput.1 b/debian/manpages/fdtput.1
new file mode 100644
index 0000000..2766b0f
--- /dev/null
+++ b/debian/manpages/fdtput.1
@@ -0,0 +1,29 @@
+.TH DTC 1 "30 January 2012" "Linux"
+.SH NAME
+\fBfdtput\fP \- write a property value to a device-tree
+.SH SYNOPSIS
+\fB/usr/bin/fdtput\fP <options> <dt file> <<node> <property> [<value>...]
+.SH DESCRIPTION
+Write a property value to a device-tree. The command line arguments are
+joined together into a single value.
+.SH OPTIONS
+.TP
+\fB\-h\fR
+Print this help.
+.TP
+\fB\-v\fR
+Verbose: display each value decoded from command line
+.TP
+\fB\-t\fR <type>
+Type of data
+.IP
+<type>  s=string, i=int, u=unsigned, x=hex
+.br
+Optional modifier prefix:
+.br
+hh or b=byte, h=2 byte, l=4 byte (default)
+.SH AUTHOR
+\fBfdtput\fP was written by The Chromium OS Authors.
+.PP
+This manual page was written by H\['e]ctor Or\['o]n
+<zumbi at debian.org>, for the Debian project (but may be used by others).
diff --git a/debian/patches/16_fdtdump-rename-from-ftdump.patch b/debian/patches/16_fdtdump-rename-from-ftdump.patch
index 2c28768..5e771a6 100644
--- a/debian/patches/16_fdtdump-rename-from-ftdump.patch
+++ b/debian/patches/16_fdtdump-rename-from-ftdump.patch
@@ -15,10 +15,10 @@ Signed-off-by: Mike Frysinger <vapier at gentoo.org>
 Acked-by: David Gibson <david at gibson.dropbear.id.au>
 ---
 
-diff --git a/.gitignore b/.gitignore
-index ae7a46a..74714cd 100644
---- a/.gitignore
-+++ b/.gitignore
+Index: device-tree-compiler-1.3.0/.gitignore
+===================================================================
+--- device-tree-compiler-1.3.0.orig/.gitignore	2012-01-30 15:03:30.095993353 +0100
++++ device-tree-compiler-1.3.0/.gitignore	2012-01-30 15:03:34.487993309 +0100
 @@ -7,6 +7,6 @@
  lex.yy.c
  *.lex.c
@@ -27,11 +27,11 @@ index ae7a46a..74714cd 100644
 +/fdtdump
  /convert-dtsv0
  /version_gen.h
-diff --git a/Documentation/manual.txt b/Documentation/manual.txt
-index f8a8a7b..14508f3 100644
---- a/Documentation/manual.txt
-+++ b/Documentation/manual.txt
-@@ -21,7 +21,7 @@ III - libfdt
+Index: device-tree-compiler-1.3.0/Documentation/manual.txt
+===================================================================
+--- device-tree-compiler-1.3.0.orig/Documentation/manual.txt	2012-01-30 15:03:30.075993336 +0100
++++ device-tree-compiler-1.3.0/Documentation/manual.txt	2012-01-30 15:03:34.487993309 +0100
+@@ -21,7 +21,7 @@
  
  IV - Utility Tools
      1) convert-dtsv0 -- Conversion to Version 1
@@ -40,7 +40,7 @@ index f8a8a7b..14508f3 100644
  
  
  I - "dtc", the device tree compiler
-@@ -643,10 +643,10 @@ a new file with a "v1" appended the filename.
+@@ -643,10 +643,10 @@
  Comments, empty lines, etc. are preserved.
  
  
@@ -55,11 +55,11 @@ index f8a8a7b..14508f3 100644
  
 -    ftdump <DTB-file-name>
 +    fdtdump <DTB-file-name>
-diff --git a/Makefile b/Makefile
-index b32409b..4582f5d 100644
---- a/Makefile
-+++ b/Makefile
-@@ -109,7 +109,7 @@ include Makefile.utils
+Index: device-tree-compiler-1.3.0/Makefile
+===================================================================
+--- device-tree-compiler-1.3.0.orig/Makefile	2012-01-30 15:03:30.023993406 +0100
++++ device-tree-compiler-1.3.0/Makefile	2012-01-30 15:03:34.487993309 +0100
+@@ -109,7 +109,7 @@
  
  BIN += convert-dtsv0
  BIN += dtc
@@ -68,7 +68,7 @@ index b32409b..4582f5d 100644
  
  SCRIPTS = dtdiff
  
-@@ -119,7 +119,7 @@ all: $(BIN) libfdt
+@@ -119,7 +119,7 @@
  ifneq ($(DEPTARGETS),)
  -include $(DTC_OBJS:%.o=%.d)
  -include $(CONVERT_OBJS:%.o=%.d)
@@ -77,7 +77,7 @@ index b32409b..4582f5d 100644
  endif
  
  
-@@ -178,7 +178,7 @@ convert-dtsv0: $(CONVERT_OBJS)
+@@ -178,7 +178,7 @@
  	@$(VECHO) LD $@
  	$(LINK.c) -o $@ $^
  
@@ -86,10 +86,10 @@ index b32409b..4582f5d 100644
  
  
  #
-diff --git a/Makefile.utils b/Makefile.utils
-index 0ed9297..fae5b00 100644
---- a/Makefile.utils
-+++ b/Makefile.utils
+Index: device-tree-compiler-1.3.0/Makefile.utils
+===================================================================
+--- device-tree-compiler-1.3.0.orig/Makefile.utils	2012-01-30 15:03:30.043993314 +0100
++++ device-tree-compiler-1.3.0/Makefile.utils	2012-01-30 15:03:34.491993307 +0100
 @@ -3,8 +3,8 @@
  # be easily embeddable into other systems of Makefiles.
  #
@@ -102,17 +102,337 @@ index 0ed9297..fae5b00 100644
  
 -FTDUMP_OBJS = $(FTDUMP_SRCS:%.c=%.o)
 +FDTDUMP_OBJS = $(FDTDUMP_SRCS:%.c=%.o)
-diff --git a/ftdump.c b/fdtdump.c
-similarity index 97%
-rename from ftdump.c
-rename to fdtdump.c
-index cc55fe2..207a46d 100644
---- a/ftdump.c
-+++ b/fdtdump.c
-@@ -1,5 +1,5 @@
- /*
+Index: device-tree-compiler-1.3.0/ftdump.c
+===================================================================
+--- device-tree-compiler-1.3.0.orig/ftdump.c	2012-01-30 15:03:30.059993370 +0100
++++ /dev/null	1970-01-01 00:00:00.000000000 +0000
+@@ -1,162 +0,0 @@
+-/*
 - * ftdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
+- */
+-
+-#include <stdint.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <ctype.h>
+-
+-#include <fdt.h>
+-#include <libfdt_env.h>
+-
+-#include "util.h"
+-
+-#define ALIGN(x, a)	(((x) + ((a) - 1)) & ~((a) - 1))
+-#define PALIGN(p, a)	((void *)(ALIGN((unsigned long)(p), (a))))
+-#define GET_CELL(p)	(p += 4, *((const uint32_t *)(p-4)))
+-
+-static void print_data(const char *data, int len)
+-{
+-	int i;
+-	const char *p = data;
+-
+-	/* no data, don't print */
+-	if (len == 0)
+-		return;
+-
+-	if (util_is_printable_string(data, len)) {
+-		printf(" = \"%s\"", (const char *)data);
+-	} else if ((len % 4) == 0) {
+-		printf(" = <");
+-		for (i = 0; i < len; i += 4)
+-			printf("0x%08x%s", fdt32_to_cpu(GET_CELL(p)),
+-			       i < (len - 4) ? " " : "");
+-		printf(">");
+-	} else {
+-		printf(" = [");
+-		for (i = 0; i < len; i++)
+-			printf("%02x%s", *p++, i < len - 1 ? " " : "");
+-		printf("]");
+-	}
+-}
+-
+-static void dump_blob(void *blob)
+-{
+-	struct fdt_header *bph = blob;
+-	uint32_t off_mem_rsvmap = fdt32_to_cpu(bph->off_mem_rsvmap);
+-	uint32_t off_dt = fdt32_to_cpu(bph->off_dt_struct);
+-	uint32_t off_str = fdt32_to_cpu(bph->off_dt_strings);
+-	struct fdt_reserve_entry *p_rsvmap =
+-		(struct fdt_reserve_entry *)((char *)blob + off_mem_rsvmap);
+-	const char *p_struct = (const char *)blob + off_dt;
+-	const char *p_strings = (const char *)blob + off_str;
+-	uint32_t version = fdt32_to_cpu(bph->version);
+-	uint32_t totalsize = fdt32_to_cpu(bph->totalsize);
+-	uint32_t tag;
+-	const char *p, *s, *t;
+-	int depth, sz, shift;
+-	int i;
+-	uint64_t addr, size;
+-
+-	depth = 0;
+-	shift = 4;
+-
+-	printf("/dts-v1/;\n");
+-	printf("// magic:\t\t0x%x\n", fdt32_to_cpu(bph->magic));
+-	printf("// totalsize:\t\t0x%x (%d)\n", totalsize, totalsize);
+-	printf("// off_dt_struct:\t0x%x\n", off_dt);
+-	printf("// off_dt_strings:\t0x%x\n", off_str);
+-	printf("// off_mem_rsvmap:\t0x%x\n", off_mem_rsvmap);
+-	printf("// version:\t\t%d\n", version);
+-	printf("// last_comp_version:\t%d\n",
+-	       fdt32_to_cpu(bph->last_comp_version));
+-	if (version >= 2)
+-		printf("// boot_cpuid_phys:\t0x%x\n",
+-		       fdt32_to_cpu(bph->boot_cpuid_phys));
+-
+-	if (version >= 3)
+-		printf("// size_dt_strings:\t0x%x\n",
+-		       fdt32_to_cpu(bph->size_dt_strings));
+-	if (version >= 17)
+-		printf("// size_dt_struct:\t0x%x\n",
+-		       fdt32_to_cpu(bph->size_dt_struct));
+-	printf("\n");
+-
+-	for (i = 0; ; i++) {
+-		addr = fdt64_to_cpu(p_rsvmap[i].address);
+-		size = fdt64_to_cpu(p_rsvmap[i].size);
+-		if (addr == 0 && size == 0)
+-			break;
+-
+-		printf("/memreserve/ %llx %llx;\n",
+-		       (unsigned long long)addr, (unsigned long long)size);
+-	}
+-
+-	p = p_struct;
+-	while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
+-
+-		/* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
+-
+-		if (tag == FDT_BEGIN_NODE) {
+-			s = p;
+-			p = PALIGN(p + strlen(s) + 1, 4);
+-
+-			if (*s == '\0')
+-				s = "/";
+-
+-			printf("%*s%s {\n", depth * shift, "", s);
+-
+-			depth++;
+-			continue;
+-		}
+-
+-		if (tag == FDT_END_NODE) {
+-			depth--;
+-
+-			printf("%*s};\n", depth * shift, "");
+-			continue;
+-		}
+-
+-		if (tag == FDT_NOP) {
+-			printf("%*s// [NOP]\n", depth * shift, "");
+-			continue;
+-		}
+-
+-		if (tag != FDT_PROP) {
+-			fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * shift, "", tag);
+-			break;
+-		}
+-		sz = fdt32_to_cpu(GET_CELL(p));
+-		s = p_strings + fdt32_to_cpu(GET_CELL(p));
+-		if (version < 16 && sz >= 8)
+-			p = PALIGN(p, 8);
+-		t = p;
+-
+-		p = PALIGN(p + sz, 4);
+-
+-		printf("%*s%s", depth * shift, "", s);
+-		print_data(t, sz);
+-		printf(";\n");
+-	}
+-}
+-
+-
+-int main(int argc, char *argv[])
+-{
+-	char *buf;
+-
+-	if (argc < 2) {
+-		fprintf(stderr, "supply input filename\n");
+-		return 5;
+-	}
+-
+-	buf = utilfdt_read(argv[1]);
+-	if (buf)
+-		dump_blob(buf);
+-	else
+-		return 10;
+-
+-	return 0;
+-}
+Index: device-tree-compiler-1.3.0/fdtdump.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ device-tree-compiler-1.3.0/fdtdump.c	2012-01-30 15:04:46.255989457 +0100
+@@ -0,0 +1,162 @@
++/*
 + * fdtdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
-  */
- 
- #include <stdint.h>
++ */
++
++#include <stdint.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <ctype.h>
++
++#include <fdt.h>
++#include <libfdt_env.h>
++
++#include "util.h"
++
++#define ALIGN(x, a)	(((x) + ((a) - 1)) & ~((a) - 1))
++#define PALIGN(p, a)	((void *)(ALIGN((unsigned long)(p), (a))))
++#define GET_CELL(p)	(p += 4, *((const uint32_t *)(p-4)))
++
++static void print_data(const char *data, int len)
++{
++	int i;
++	const char *p = data;
++
++	/* no data, don't print */
++	if (len == 0)
++		return;
++
++	if (util_is_printable_string(data, len)) {
++		printf(" = \"%s\"", (const char *)data);
++	} else if ((len % 4) == 0) {
++		printf(" = <");
++		for (i = 0; i < len; i += 4)
++			printf("0x%08x%s", fdt32_to_cpu(GET_CELL(p)),
++			       i < (len - 4) ? " " : "");
++		printf(">");
++	} else {
++		printf(" = [");
++		for (i = 0; i < len; i++)
++			printf("%02x%s", *p++, i < len - 1 ? " " : "");
++		printf("]");
++	}
++}
++
++static void dump_blob(void *blob)
++{
++	struct fdt_header *bph = blob;
++	uint32_t off_mem_rsvmap = fdt32_to_cpu(bph->off_mem_rsvmap);
++	uint32_t off_dt = fdt32_to_cpu(bph->off_dt_struct);
++	uint32_t off_str = fdt32_to_cpu(bph->off_dt_strings);
++	struct fdt_reserve_entry *p_rsvmap =
++		(struct fdt_reserve_entry *)((char *)blob + off_mem_rsvmap);
++	const char *p_struct = (const char *)blob + off_dt;
++	const char *p_strings = (const char *)blob + off_str;
++	uint32_t version = fdt32_to_cpu(bph->version);
++	uint32_t totalsize = fdt32_to_cpu(bph->totalsize);
++	uint32_t tag;
++	const char *p, *s, *t;
++	int depth, sz, shift;
++	int i;
++	uint64_t addr, size;
++
++	depth = 0;
++	shift = 4;
++
++	printf("/dts-v1/;\n");
++	printf("// magic:\t\t0x%x\n", fdt32_to_cpu(bph->magic));
++	printf("// totalsize:\t\t0x%x (%d)\n", totalsize, totalsize);
++	printf("// off_dt_struct:\t0x%x\n", off_dt);
++	printf("// off_dt_strings:\t0x%x\n", off_str);
++	printf("// off_mem_rsvmap:\t0x%x\n", off_mem_rsvmap);
++	printf("// version:\t\t%d\n", version);
++	printf("// last_comp_version:\t%d\n",
++	       fdt32_to_cpu(bph->last_comp_version));
++	if (version >= 2)
++		printf("// boot_cpuid_phys:\t0x%x\n",
++		       fdt32_to_cpu(bph->boot_cpuid_phys));
++
++	if (version >= 3)
++		printf("// size_dt_strings:\t0x%x\n",
++		       fdt32_to_cpu(bph->size_dt_strings));
++	if (version >= 17)
++		printf("// size_dt_struct:\t0x%x\n",
++		       fdt32_to_cpu(bph->size_dt_struct));
++	printf("\n");
++
++	for (i = 0; ; i++) {
++		addr = fdt64_to_cpu(p_rsvmap[i].address);
++		size = fdt64_to_cpu(p_rsvmap[i].size);
++		if (addr == 0 && size == 0)
++			break;
++
++		printf("/memreserve/ %llx %llx;\n",
++		       (unsigned long long)addr, (unsigned long long)size);
++	}
++
++	p = p_struct;
++	while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
++
++		/* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
++
++		if (tag == FDT_BEGIN_NODE) {
++			s = p;
++			p = PALIGN(p + strlen(s) + 1, 4);
++
++			if (*s == '\0')
++				s = "/";
++
++			printf("%*s%s {\n", depth * shift, "", s);
++
++			depth++;
++			continue;
++		}
++
++		if (tag == FDT_END_NODE) {
++			depth--;
++
++			printf("%*s};\n", depth * shift, "");
++			continue;
++		}
++
++		if (tag == FDT_NOP) {
++			printf("%*s// [NOP]\n", depth * shift, "");
++			continue;
++		}
++
++		if (tag != FDT_PROP) {
++			fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * shift, "", tag);
++			break;
++		}
++		sz = fdt32_to_cpu(GET_CELL(p));
++		s = p_strings + fdt32_to_cpu(GET_CELL(p));
++		if (version < 16 && sz >= 8)
++			p = PALIGN(p, 8);
++		t = p;
++
++		p = PALIGN(p + sz, 4);
++
++		printf("%*s%s", depth * shift, "", s);
++		print_data(t, sz);
++		printf(";\n");
++	}
++}
++
++
++int main(int argc, char *argv[])
++{
++	char *buf;
++
++	if (argc < 2) {
++		fprintf(stderr, "supply input filename\n");
++		return 5;
++	}
++
++	buf = utilfdt_read(argv[1]);
++	if (buf)
++		dump_blob(buf);
++	else
++		return 10;
++
++	return 0;
++}
diff --git a/debian/patches/17_libfdt-Add-support-for-appending-the-values-to-a-exi.patch b/debian/patches/17_libfdt-Add-support-for-appending-the-values-to-a-exi.patch
new file mode 100644
index 0000000..a6f3870
--- /dev/null
+++ b/debian/patches/17_libfdt-Add-support-for-appending-the-values-to-a-exi.patch
@@ -0,0 +1,331 @@
+From a31e3ef83bfce62d07695355e5f06cd4d0e44b86 Mon Sep 17 00:00:00 2001
+From: Minghuan Lian <Minghuan.Lian at freescale.com>
+Date: Mon, 5 Dec 2011 12:22:07 +1100
+Subject: [PATCH 2/7] libfdt: Add support for appending the values to a
+ existing property
+
+Some properties may contain multiple values, these values may need
+to be added to the property respectively. this patch provides this
+functionality. The main purpose of fdt_append_prop() is to append
+the values to a existing property, or create a new property if it
+dose not exist.
+
+Signed-off-by: Minghuan Lian <Minghuan.Lian at freescale.com>
+Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
+---
+ libfdt/fdt_rw.c      |   27 ++++++++++++++
+ libfdt/libfdt.h      |   95 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ tests/appendprop.dts |    7 ++++
+ tests/appendprop1.c  |   70 ++++++++++++++++++++++++++++++++++++
+ tests/appendprop2.c  |   64 +++++++++++++++++++++++++++++++++
+ 5 files changed, 263 insertions(+), 0 deletions(-)
+ create mode 100644 tests/appendprop.dts
+ create mode 100644 tests/appendprop1.c
+ create mode 100644 tests/appendprop2.c
+
+diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
+index 994037b..24437df 100644
+--- a/libfdt/fdt_rw.c
++++ b/libfdt/fdt_rw.c
+@@ -289,6 +289,33 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+ 	return 0;
+ }
+ 
++int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
++		   const void *val, int len)
++{
++	struct fdt_property *prop;
++	int err, oldlen, newlen;
++
++	FDT_RW_CHECK_HEADER(fdt);
++
++	prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
++	if (prop) {
++		newlen = len + oldlen;
++		err = _fdt_splice_struct(fdt, prop->data,
++					 FDT_TAGALIGN(oldlen),
++					 FDT_TAGALIGN(newlen));
++		if (err)
++			return err;
++		prop->len = cpu_to_fdt32(newlen);
++		memcpy(prop->data + oldlen, val, len);
++	} else {
++		err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
++		if (err)
++			return err;
++		memcpy(prop->data, val, len);
++	}
++	return 0;
++}
++
+ int fdt_delprop(void *fdt, int nodeoffset, const char *name)
+ {
+ 	struct fdt_property *prop;
+diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
+index 55f3eb3..060479e 100644
+--- a/libfdt/libfdt.h
++++ b/libfdt/libfdt.h
+@@ -1134,6 +1134,101 @@ static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
+ 	fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
+ 
+ /**
++ * fdt_appendprop - append to or create a property
++ * @fdt: pointer to the device tree blob
++ * @nodeoffset: offset of the node whose property to change
++ * @name: name of the property to append to
++ * @val: pointer to data to append to the property value
++ * @len: length of the data to append to the property value
++ *
++ * fdt_appendprop() appends the value to the named property in the
++ * given node, creating the property if it does not already exist.
++ *
++ * This function may insert data into the blob, and will therefore
++ * change the offsets of some existing nodes.
++ *
++ * returns:
++ *	0, on success
++ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
++ *		contain the new property value
++ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
++ *	-FDT_ERR_BADLAYOUT,
++ *	-FDT_ERR_BADMAGIC,
++ *	-FDT_ERR_BADVERSION,
++ *	-FDT_ERR_BADSTATE,
++ *	-FDT_ERR_BADSTRUCTURE,
++ *	-FDT_ERR_BADLAYOUT,
++ *	-FDT_ERR_TRUNCATED, standard meanings
++ */
++int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
++		   const void *val, int len);
++
++/**
++ * fdt_appendprop_cell - append a single cell value to a property
++ * @fdt: pointer to the device tree blob
++ * @nodeoffset: offset of the node whose property to change
++ * @name: name of the property to change
++ * @val: 32-bit integer value to append to the property (native endian)
++ *
++ * fdt_appendprop_cell() appends the given cell value (converting to
++ * big-endian if necessary) to the value of the named property in the
++ * given node, or creates a new property with that value if it does
++ * not already exist.
++ *
++ * This function may insert data into the blob, and will therefore
++ * change the offsets of some existing nodes.
++ *
++ * returns:
++ *	0, on success
++ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
++ *		contain the new property value
++ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
++ *	-FDT_ERR_BADLAYOUT,
++ *	-FDT_ERR_BADMAGIC,
++ *	-FDT_ERR_BADVERSION,
++ *	-FDT_ERR_BADSTATE,
++ *	-FDT_ERR_BADSTRUCTURE,
++ *	-FDT_ERR_BADLAYOUT,
++ *	-FDT_ERR_TRUNCATED, standard meanings
++ */
++static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
++				      const char *name, uint32_t val)
++{
++	val = cpu_to_fdt32(val);
++	return fdt_appendprop(fdt, nodeoffset, name, &val, sizeof(val));
++}
++
++/**
++ * fdt_appendprop_string - append a string to a property
++ * @fdt: pointer to the device tree blob
++ * @nodeoffset: offset of the node whose property to change
++ * @name: name of the property to change
++ * @str: string value to append to the property
++ *
++ * fdt_appendprop_string() appends the given string to the value of
++ * the named property in the given node, or creates a new property
++ * with that value if it does not already exist.
++ *
++ * This function may insert data into the blob, and will therefore
++ * change the offsets of some existing nodes.
++ *
++ * returns:
++ *	0, on success
++ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
++ *		contain the new property value
++ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
++ *	-FDT_ERR_BADLAYOUT,
++ *	-FDT_ERR_BADMAGIC,
++ *	-FDT_ERR_BADVERSION,
++ *	-FDT_ERR_BADSTATE,
++ *	-FDT_ERR_BADSTRUCTURE,
++ *	-FDT_ERR_BADLAYOUT,
++ *	-FDT_ERR_TRUNCATED, standard meanings
++ */
++#define fdt_appendprop_string(fdt, nodeoffset, name, str) \
++	fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
++
++/**
+  * fdt_delprop - delete a property
+  * @fdt: pointer to the device tree blob
+  * @nodeoffset: offset of the node whose property to nop
+diff --git a/tests/appendprop.dts b/tests/appendprop.dts
+new file mode 100644
+index 0000000..6e3a3eb
+--- /dev/null
++++ b/tests/appendprop.dts
+@@ -0,0 +1,7 @@
++/dts-v1/;
++
++/ {
++	prop-str = "hello world", "nastystring: \a\b\t\n\v\f\r\\\"";
++	prop-int = <0xdeadbeef 123456789>;
++	prop-bytes = [00010203040001020304];
++};
+diff --git a/tests/appendprop1.c b/tests/appendprop1.c
+new file mode 100644
+index 0000000..180d296
+--- /dev/null
++++ b/tests/appendprop1.c
+@@ -0,0 +1,70 @@
++/*
++ * libfdt - Flat Device Tree manipulation
++ *	Testcase for fdt_appendprop()
++ * Copyright (C) 2006 David Gibson, IBM Corporation.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public License
++ * as published by the Free Software Foundation; either version 2.1 of
++ * the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ */
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
++#include <ctype.h>
++#include <stdint.h>
++
++#include <fdt.h>
++#include <libfdt.h>
++
++#include "tests.h"
++#include "testdata.h"
++
++#define SPACE		65536
++
++#define CHECK(code) \
++	{ \
++		err = (code); \
++		if (err) \
++			FAIL(#code ": %s", fdt_strerror(err)); \
++	}
++
++int main(int argc, char *argv[])
++{
++	void *fdt;
++	int err;
++	uint8_t bytes[] = {0x00, 0x01, 0x02, 0x03, 0x04};
++
++	test_init(argc, argv);
++
++	/* Create an empty tree first */
++	fdt = xmalloc(SPACE);
++	CHECK(fdt_create(fdt, SPACE));
++	CHECK(fdt_finish_reservemap(fdt));
++	CHECK(fdt_begin_node(fdt, ""));
++	CHECK(fdt_end_node(fdt));
++	CHECK(fdt_finish(fdt));
++
++	/* Now use appendprop to add properties */
++	CHECK(fdt_open_into(fdt, fdt, SPACE));
++
++	CHECK(fdt_appendprop(fdt, 0, "prop-bytes", bytes, sizeof(bytes)));
++	CHECK(fdt_appendprop_cell(fdt, 0, "prop-int", TEST_VALUE_1));
++	CHECK(fdt_appendprop_string(fdt, 0, "prop-str", TEST_STRING_1));
++
++	CHECK(fdt_pack(fdt));
++
++	save_blob("appendprop1.test.dtb", fdt);
++
++	PASS();
++}
+diff --git a/tests/appendprop2.c b/tests/appendprop2.c
+new file mode 100644
+index 0000000..d651a89
+--- /dev/null
++++ b/tests/appendprop2.c
+@@ -0,0 +1,64 @@
++/*
++ * libfdt - Flat Device Tree manipulation
++ *	Testcase for fdt_appendprop()
++ * Copyright (C) 2006 David Gibson, IBM Corporation.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public License
++ * as published by the Free Software Foundation; either version 2.1 of
++ * the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ */
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
++#include <ctype.h>
++#include <stdint.h>
++
++#include <fdt.h>
++#include <libfdt.h>
++
++#include "tests.h"
++#include "testdata.h"
++
++#define SPACE		65536
++
++#define CHECK(code) \
++	{ \
++		err = (code); \
++		if (err) \
++			FAIL(#code ": %s", fdt_strerror(err)); \
++	}
++
++int main(int argc, char *argv[])
++{
++	void *fdt, *buf;
++	int err;
++	uint8_t bytes[] = {0x00, 0x01, 0x02, 0x03, 0x04};
++
++	test_init(argc, argv);
++	fdt = load_blob_arg(argc, argv);
++
++	buf = xmalloc(SPACE);
++	CHECK(fdt_open_into(fdt, buf, SPACE));
++	fdt = buf;
++
++	CHECK(fdt_appendprop(fdt, 0, "prop-bytes", bytes, sizeof(bytes)));
++	CHECK(fdt_appendprop_cell(fdt, 0, "prop-int", TEST_VALUE_2));
++	CHECK(fdt_appendprop_string(fdt, 0, "prop-str", TEST_STRING_2));
++
++	CHECK(fdt_pack(fdt));
++
++	save_blob("appendprop2.test.dtb", fdt);
++
++	PASS();
++}
+-- 
+1.7.8.3
+
diff --git a/debian/patches/18_libfdt-Activate-testcase-for-appending-properties.patch b/debian/patches/18_libfdt-Activate-testcase-for-appending-properties.patch
new file mode 100644
index 0000000..868ffc3
--- /dev/null
+++ b/debian/patches/18_libfdt-Activate-testcase-for-appending-properties.patch
@@ -0,0 +1,48 @@
+From 97b909f852039daaae267a66f5df2c90ed05b586 Mon Sep 17 00:00:00 2001
+From: David Gibson <david at gibson.dropbear.id.au>
+Date: Wed, 11 Jan 2012 23:41:32 +1100
+Subject: [PATCH 3/7] libfdt: Activate testcase for appending properties
+
+Commit a31e3ef83bfce62d07695355e5f06cd4d0e44b86 introduced new libfdt
+functions to append to existing properties.  It also included a test case
+for this, but neglected to update the Makefile and run_tests.sh script
+to actually build and execute this testcase.
+
+This patch corrects the oversight.
+
+Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
+---
+ tests/Makefile.tests |    1 +
+ tests/run_tests.sh   |    4 ++++
+ 2 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/tests/Makefile.tests b/tests/Makefile.tests
+index 215a8c5..3f92074 100644
+--- a/tests/Makefile.tests
++++ b/tests/Makefile.tests
+@@ -12,6 +12,7 @@ LIB_TESTS_L = get_mem_rsv \
+ 	sw_tree1 \
+ 	move_and_save mangle-layout nopulate \
+ 	open_pack rw_tree1 set_name setprop del_property del_node \
++	appendprop1 appendprop2 \
+ 	string_escapes references path-references phandle_format \
+ 	boot-cpuid incbin \
+ 	extra-terminating-null \
+diff --git a/tests/run_tests.sh b/tests/run_tests.sh
+index da6f970..c72b9d2 100755
+--- a/tests/run_tests.sh
++++ b/tests/run_tests.sh
+@@ -178,6 +178,10 @@ libfdt_tests () {
+     run_test rw_tree1
+     tree1_tests rw_tree1.test.dtb
+     tree1_tests_rw rw_tree1.test.dtb
++    run_test appendprop1
++    run_test appendprop2 appendprop1.test.dtb
++    run_dtc_test -I dts -O dtb -o appendprop.test.dtb appendprop.dts
++    run_test dtbs_equal_ordered appendprop2.test.dtb appendprop.test.dtb
+ 
+     for basetree in test_tree1.dtb sw_tree1.test.dtb rw_tree1.test.dtb; do
+ 	run_test nopulate $basetree
+-- 
+1.7.8.3
+
diff --git a/debian/patches/19_dtc-Implement-d-option-to-write-out-a-dependency-fil.patch b/debian/patches/19_dtc-Implement-d-option-to-write-out-a-dependency-fil.patch
new file mode 100644
index 0000000..42aada5
--- /dev/null
+++ b/debian/patches/19_dtc-Implement-d-option-to-write-out-a-dependency-fil.patch
@@ -0,0 +1,191 @@
+From 69df9f0de25db1c37970850115cdf48335d41802 Mon Sep 17 00:00:00 2001
+From: Stephen Warren <swarren at nvidia.com>
+Date: Thu, 12 Jan 2012 11:31:00 -0700
+Subject: [PATCH 4/7] dtc: Implement -d option to write out a dependency file
+
+This will allow callers to rebuild .dtb files when any of the /include/d
+.dtsi files are modified, not just the top-level .dts file.
+
+Signed-off-by: Stephen Warren <swarren at nvidia.com>
+Acked-by: David Gibson <david at gibson.dropbear.id.au>
+---
+ Documentation/manual.txt |    3 +++
+ dtc.c                    |   20 +++++++++++++++++++-
+ srcpos.c                 |    4 ++++
+ srcpos.h                 |    1 +
+ tests/dependencies.cmp   |    1 +
+ tests/dependencies.dts   |    6 ++++++
+ tests/deps_inc1.dtsi     |    1 +
+ tests/deps_inc2.dtsi     |    1 +
+ tests/run_tests.sh       |    4 ++++
+ 9 files changed, 40 insertions(+), 1 deletions(-)
+ create mode 100644 tests/dependencies.cmp
+ create mode 100644 tests/dependencies.dts
+ create mode 100644 tests/deps_inc1.dtsi
+ create mode 100644 tests/deps_inc2.dtsi
+
+diff --git a/Documentation/manual.txt b/Documentation/manual.txt
+index 14508f3..989c589 100644
+--- a/Documentation/manual.txt
++++ b/Documentation/manual.txt
+@@ -106,6 +106,9 @@ Options:
+     -O <output_format>
+ 	The generated output format, as listed above.
+ 
++    -d <dependency_filename>
++	Generate a dependency file during compilation.
++
+     -q
+ 	Quiet: -q suppress warnings, -qq errors, -qqq all
+ 
+diff --git a/dtc.c b/dtc.c
+index 15d2fc2..7a0c605 100644
+--- a/dtc.c
++++ b/dtc.c
+@@ -71,6 +71,7 @@ static void  __attribute__ ((noreturn)) usage(void)
+ 	fprintf(stderr, "\t\t\tasm - assembler source\n");
+ 	fprintf(stderr, "\t-V <output version>\n");
+ 	fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION);
++	fprintf(stderr, "\t-d <output dependency file>\n");
+ 	fprintf(stderr, "\t-R <number>\n");
+ 	fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n");
+ 	fprintf(stderr, "\t-S <bytes>\n");
+@@ -99,6 +100,7 @@ int main(int argc, char *argv[])
+ 	const char *inform = "dts";
+ 	const char *outform = "dts";
+ 	const char *outname = "-";
++	const char *depname = NULL;
+ 	int force = 0, sort = 0;
+ 	const char *arg;
+ 	int opt;
+@@ -111,7 +113,7 @@ int main(int argc, char *argv[])
+ 	minsize    = 0;
+ 	padsize    = 0;
+ 
+-	while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fqb:vH:s")) != EOF) {
++	while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fqb:vH:s")) != EOF) {
+ 		switch (opt) {
+ 		case 'I':
+ 			inform = optarg;
+@@ -125,6 +127,9 @@ int main(int argc, char *argv[])
+ 		case 'V':
+ 			outversion = strtol(optarg, NULL, 0);
+ 			break;
++		case 'd':
++			depname = optarg;
++			break;
+ 		case 'R':
+ 			reservenum = strtol(optarg, NULL, 0);
+ 			break;
+@@ -185,6 +190,14 @@ int main(int argc, char *argv[])
+ 	fprintf(stderr, "DTC: %s->%s  on file \"%s\"\n",
+ 		inform, outform, arg);
+ 
++	if (depname) {
++		depfile = fopen(depname, "w");
++		if (!depfile)
++			die("Couldn't open dependency file %s: %s\n", depname,
++			    strerror(errno));
++		fprintf(depfile, "%s:", outname);
++	}
++
+ 	if (streq(inform, "dts"))
+ 		bi = dt_from_source(arg);
+ 	else if (streq(inform, "fs"))
+@@ -194,6 +207,11 @@ int main(int argc, char *argv[])
+ 	else
+ 		die("Unknown input format \"%s\"\n", inform);
+ 
++	if (depfile) {
++		fputc('\n', depfile);
++		fclose(depfile);
++	}
++
+ 	if (cmdline_boot_cpuid != -1)
+ 		bi->boot_cpuid_phys = cmdline_boot_cpuid;
+ 
+diff --git a/srcpos.c b/srcpos.c
+index 2dbc874..36a38e9 100644
+--- a/srcpos.c
++++ b/srcpos.c
+@@ -40,6 +40,7 @@ static char *dirname(const char *path)
+ 	return NULL;
+ }
+ 
++FILE *depfile; /* = NULL */
+ struct srcfile_state *current_srcfile; /* = NULL */
+ 
+ /* Detect infinite include recursion. */
+@@ -67,6 +68,9 @@ FILE *srcfile_relative_open(const char *fname, char **fullnamep)
+ 			    strerror(errno));
+ 	}
+ 
++	if (depfile)
++		fprintf(depfile, " %s", fullname);
++
+ 	if (fullnamep)
+ 		*fullnamep = fullname;
+ 	else
+diff --git a/srcpos.h b/srcpos.h
+index bd7966e..ce980ca 100644
+--- a/srcpos.h
++++ b/srcpos.h
+@@ -30,6 +30,7 @@ struct srcfile_state {
+ 	struct srcfile_state *prev;
+ };
+ 
++extern FILE *depfile; /* = NULL */
+ extern struct srcfile_state *current_srcfile; /* = NULL */
+ 
+ FILE *srcfile_relative_open(const char *fname, char **fullnamep);
+diff --git a/tests/dependencies.cmp b/tests/dependencies.cmp
+new file mode 100644
+index 0000000..bcd9432
+--- /dev/null
++++ b/tests/dependencies.cmp
+@@ -0,0 +1 @@
++dependencies.test.dtb: dependencies.dts deps_inc1.dtsi deps_inc2.dtsi
+diff --git a/tests/dependencies.dts b/tests/dependencies.dts
+new file mode 100644
+index 0000000..2cfe31b
+--- /dev/null
++++ b/tests/dependencies.dts
+@@ -0,0 +1,6 @@
++/dts-v1/;
++
++/include/ "deps_inc1.dtsi"
++
++/ {
++};
+diff --git a/tests/deps_inc1.dtsi b/tests/deps_inc1.dtsi
+new file mode 100644
+index 0000000..5c607dc
+--- /dev/null
++++ b/tests/deps_inc1.dtsi
+@@ -0,0 +1 @@
++/include/ "deps_inc2.dtsi"
+diff --git a/tests/deps_inc2.dtsi b/tests/deps_inc2.dtsi
+new file mode 100644
+index 0000000..710cecc
+--- /dev/null
++++ b/tests/deps_inc2.dtsi
+@@ -0,0 +1 @@
++/* Empty */
+diff --git a/tests/run_tests.sh b/tests/run_tests.sh
+index c72b9d2..e42154b 100755
+--- a/tests/run_tests.sh
++++ b/tests/run_tests.sh
+@@ -357,6 +357,10 @@ dtc_tests () {
+     run_sh_test dtc-fatal.sh -I dts -O dtb nosuchfile.dts
+     run_sh_test dtc-fatal.sh -I dtb -O dtb nosuchfile.dtb
+     run_sh_test dtc-fatal.sh -I fs -O dtb nosuchfile
++
++    # Dependencies
++    run_dtc_test -I dts -O dtb -o dependencies.test.dtb -d dependencies.test.d dependencies.dts
++    run_wrap_test cmp dependencies.test.d dependencies.cmp
+ }
+ 
+ cmp_tests () {
+-- 
+1.7.8.3
+
diff --git a/debian/patches/20_Add-fdtget-utility-to-read-property-values-from-a-de.patch b/debian/patches/20_Add-fdtget-utility-to-read-property-values-from-a-de.patch
new file mode 100644
index 0000000..b4532cd
--- /dev/null
+++ b/debian/patches/20_Add-fdtget-utility-to-read-property-values-from-a-de.patch
@@ -0,0 +1,486 @@
+From 68d057f20d7c3a93b441d2892c4749392bc83b45 Mon Sep 17 00:00:00 2001
+From: Simon Glass <sjg at chromium.org>
+Date: Sat, 21 Jan 2012 10:14:47 -0800
+Subject: [PATCH 5/7] Add fdtget utility to read property values from a device
+ tree
+
+This simply utility makes it easy for scripts to read values from the device
+tree. It is written in C and uses the same libfdt as the rest of the dtc
+package.
+
+What is it for:
+- Reading fdt values from scripts
+- Extracting fdt information within build systems
+- Looking at particular values without having to dump the entire tree
+
+To use it, specify the fdt binary file on command line followed by a list of
+node, property pairs. The utility then looks up each node, finds the property
+and displays the value.
+
+Each value is printed on a new line.
+
+fdtget tries to guess the type of each property based on its contents. This
+is not always reliable, so you can use the -t option to force fdtget to decode
+the value as a string, or byte, etc.
+
+To read from stdin, use - as the file.
+
+Usage:
+	fdtget <options> <dt file> [<node> <property>]...
+Options:
+	-t <type>	Type of data
+	-h		Print this help
+
+<type>	s=string, i=int, u=unsigned, x=hex
+	Optional modifier prefix:
+		hh or b=byte, h=2 byte, l=4 byte (default)
+
+Signed-off-by: Simon Glass <sjg at chromium.org>
+---
+ .gitignore              |    1 +
+ Makefile                |    4 +
+ Makefile.utils          |    7 ++
+ fdtget.c                |  226 +++++++++++++++++++++++++++++++++++++++++++++++
+ tests/fdtget-runtest.sh |   35 +++++++
+ tests/run_tests.sh      |   43 +++++++++-
+ tests/tests.sh          |    1 +
+ util.h                  |   10 ++
+ 8 files changed, 326 insertions(+), 1 deletions(-)
+ create mode 100644 fdtget.c
+ create mode 100755 tests/fdtget-runtest.sh
+
+diff --git a/.gitignore b/.gitignore
+index 74714cd..2d82b71 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -10,3 +10,4 @@ lex.yy.c
+ /fdtdump
+ /convert-dtsv0
+ /version_gen.h
++/fdtget
+diff --git a/Makefile b/Makefile
+index 4582f5d..a54a209 100644
+--- a/Makefile
++++ b/Makefile
+@@ -110,6 +110,7 @@ include Makefile.utils
+ BIN += convert-dtsv0
+ BIN += dtc
+ BIN += fdtdump
++BIN += fdtget
+ 
+ SCRIPTS = dtdiff
+ 
+@@ -120,6 +121,7 @@ ifneq ($(DEPTARGETS),)
+ -include $(DTC_OBJS:%.o=%.d)
+ -include $(CONVERT_OBJS:%.o=%.d)
+ -include $(FDTDUMP_OBJS:%.o=%.d)
++-include $(FDTGET_OBJS:%.o=%.d)
+ endif
+ 
+ 
+@@ -180,6 +182,8 @@ convert-dtsv0: $(CONVERT_OBJS)
+ 
+ fdtdump:	$(FDTDUMP_OBJS)
+ 
++fdtget:	$(FDTGET_OBJS) $(LIBFDT_archive)
++
+ 
+ #
+ # Testsuite rules
+diff --git a/Makefile.utils b/Makefile.utils
+index fae5b00..38efa3c 100644
+--- a/Makefile.utils
++++ b/Makefile.utils
+@@ -8,3 +8,10 @@ FDTDUMP_SRCS = \
+ 	util.c
+ 
+ FDTDUMP_OBJS = $(FDTDUMP_SRCS:%.c=%.o)
++
++
++FDTGET_SRCS = \
++	fdtget.c \
++	util.c
++
++FDTGET_OBJS = $(FDTGET_SRCS:%.c=%.o)
+diff --git a/fdtget.c b/fdtget.c
+new file mode 100644
+index 0000000..48ab615
+--- /dev/null
++++ b/fdtget.c
+@@ -0,0 +1,226 @@
++/*
++ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of
++ * the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ * MA 02111-1307 USA
++ */
++
++#include <ctype.h>
++#include <getopt.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include <libfdt.h>
++
++#include "util.h"
++
++/* Holds information which controls our output and options */
++struct display_info {
++	int type;		/* data type (s/i/u/x or 0 for default) */
++	int size;		/* data size (1/2/4) */
++};
++
++static void report_error(const char *where, int err)
++{
++	fprintf(stderr, "Error at '%s': %s\n", where, fdt_strerror(err));
++}
++
++/**
++ * Displays data of a given length according to selected options
++ *
++ * If a specific data type is provided in disp, then this is used. Otherwise
++ * we try to guess the data type / size from the contents.
++ *
++ * @param disp		Display information / options
++ * @param data		Data to display
++ * @param len		Maximum length of buffer
++ * @return 0 if ok, -1 if data does not match format
++ */
++static int show_data(struct display_info *disp, const char *data, int len)
++{
++	int i, size;
++	const uint8_t *p = (const uint8_t *)data;
++	const char *s;
++	int value;
++	int is_string;
++	char fmt[3];
++
++	/* no data, don't print */
++	if (len == 0)
++		return 0;
++
++	is_string = (disp->type) == 's' ||
++		(!disp->type && util_is_printable_string(data, len));
++	if (is_string) {
++		if (data[len - 1] != '\0') {
++			fprintf(stderr, "Unterminated string\n");
++			return -1;
++		}
++		for (s = data; s - data < len; s += strlen(s) + 1) {
++			if (s != data)
++				printf(" ");
++			printf("%s", (const char *)s);
++		}
++		return 0;
++	}
++	size = disp->size;
++	if (size == -1)
++		size = (len % 4) == 0 ? 4 : 1;
++	else if (len % size) {
++		fprintf(stderr, "Property length must be a multiple of "
++				"selected data size\n");
++		return -1;
++	}
++	fmt[0] = '%';
++	fmt[1] = disp->type ? disp->type : 'd';
++	fmt[2] = '\0';
++	for (i = 0; i < len; i += size, p += size) {
++		if (i)
++			printf(" ");
++		value = size == 4 ? fdt32_to_cpu(*(const uint32_t *)p) :
++			size == 2 ? (*p << 8) | p[1] : *p;
++		printf(fmt, value);
++	}
++	return 0;
++}
++
++/**
++ * Show the data for a given node (and perhaps property) according to the
++ * display option provided.
++ *
++ * @param blob		FDT blob
++ * @param disp		Display information / options
++ * @param node		Node to display
++ * @param property	Name of property to display, or NULL if none
++ * @return 0 if ok, -ve on error
++ */
++static int show_data_for_item(const void *blob, struct display_info *disp,
++		int node, const char *property)
++{
++	const void *value = NULL;
++	int len, err = 0;
++
++	value = fdt_getprop(blob, node, property, &len);
++	if (value) {
++		if (show_data(disp, value, len))
++			err = -1;
++		else
++			printf("\n");
++	} else {
++		report_error(property, len);
++		err = -1;
++	}
++	return err;
++}
++
++/**
++ * Run the main fdtget operation, given a filename and valid arguments
++ *
++ * @param disp		Display information / options
++ * @param filename	Filename of blob file
++ * @param arg		List of arguments to process
++ * @param arg_count	Number of arguments
++ * @param return 0 if ok, -ve on error
++ */
++static int do_fdtget(struct display_info *disp, const char *filename,
++		     char **arg, int arg_count)
++{
++	char *blob;
++	int i, node;
++
++	blob = utilfdt_read(filename);
++	if (!blob)
++		return -1;
++
++	for (i = 0; i + 2 <= arg_count; i += 2) {
++		node = fdt_path_offset(blob, arg[0]);
++		if (node < 0) {
++			report_error(arg[0], node);
++			return -1;
++		}
++
++		if (show_data_for_item(blob, disp, node, arg[1]))
++			return -1;
++	}
++	return 0;
++}
++
++static const char *usage_msg =
++	"fdtget - read values from device tree\n"
++	"\n"
++	"Each value is printed on a new line.\n\n"
++	"Usage:\n"
++	"	fdtget <options> <dt file> [<node> <property>]...\n"
++	"Options:\n"
++	"\t-t <type>\tType of data\n"
++	"\t-h\t\tPrint this help\n\n"
++	USAGE_TYPE_MSG;
++
++static void usage(const char *msg)
++{
++	if (msg)
++		fprintf(stderr, "Error: %s\n\n", msg);
++
++	fprintf(stderr, "%s", usage_msg);
++	exit(2);
++}
++
++int main(int argc, char *argv[])
++{
++	char *filename = NULL;
++	struct display_info disp;
++
++	/* set defaults */
++	memset(&disp, '\0', sizeof(disp));
++	disp.size = -1;
++	for (;;) {
++		int c = getopt(argc, argv, "ht:");
++		if (c == -1)
++			break;
++
++		switch (c) {
++		case 'h':
++		case '?':
++			usage(NULL);
++
++		case 't':
++			if (utilfdt_decode_type(optarg, &disp.type,
++					&disp.size))
++				usage("Invalid type string");
++			break;
++		}
++	}
++
++	if (optind < argc)
++		filename = argv[optind++];
++	if (!filename)
++		usage("Missing filename");
++
++	argv += optind;
++	argc -= optind;
++
++	/* Allow no arguments, and silently succeed */
++	if (!argc)
++		return 0;
++
++	/* Check for node, property arguments */
++	if (argc % 2)
++		usage("Must have an even number of arguments");
++
++	if (do_fdtget(&disp, filename, argv, argc))
++		return 1;
++	return 0;
++}
+diff --git a/tests/fdtget-runtest.sh b/tests/fdtget-runtest.sh
+new file mode 100755
+index 0000000..f38184f
+--- /dev/null
++++ b/tests/fdtget-runtest.sh
+@@ -0,0 +1,35 @@
++#! /bin/sh
++
++. ./tests.sh
++
++LOG="tmp.log.$$"
++EXPECT="tmp.expect.$$"
++
++rm -f $TMPFILE $LOG
++
++expect="$1"
++echo "$expect" >$EXPECT
++shift
++
++verbose_run_log "$LOG" $VALGRIND "$DTGET" "$@"
++ret="$?"
++
++if [ "$ret" -ne 0 -a "$expect" = "ERR" ]; then
++	PASS
++fi
++
++if [ "$ret" -gt 127 ]; then
++    signame=$(kill -l $[ret - 128])
++    FAIL "Killed by SIG$signame"
++fi
++
++diff $EXPECT $LOG
++ret="$?"
++
++rm -f $LOG $EXPECT
++
++if [ "$ret" -eq 0 ]; then
++	PASS
++else
++	FAIL
++fi
+diff --git a/tests/run_tests.sh b/tests/run_tests.sh
+index e42154b..e6184df 100755
+--- a/tests/run_tests.sh
++++ b/tests/run_tests.sh
+@@ -83,6 +83,13 @@ asm_to_so_test () {
+     run_wrap_test asm_to_so "$@"
+ }
+ 
++run_fdtget_test () {
++    # run_fdtget_test name expected_output dtb_file args...
++    echo -n "$1:	"
++    shift
++    base_run_test sh fdtget-runtest.sh "$@"
++}
++
+ tree1_tests () {
+     TREE=$1
+ 
+@@ -402,6 +409,37 @@ dtbs_equal_tests () {
+     cmp_tests test_tree1.dtb $WRONG_TREE1
+ }
+ 
++fdtget_tests () {
++    file=label01.dtb
++    $DTC -O dtb -o $file ${file%.dtb}.dts 2>/dev/null
++
++    # run_fdtget_test <test-name> <expected-result> <args>...
++    run_fdtget_test "Simple string" "MyBoardName" $file / model
++    run_fdtget_test "Multiple string i" "77 121 66 111 \
++97 114 100 78 97 109 101 0 77 121 66 111 97 114 100 70 97 109 105 \
++108 121 78 97 109 101 0" $file / compatible
++    run_fdtget_test "Multiple string s" "MyBoardName MyBoardFamilyName" \
++	-t s $file / compatible
++    run_fdtget_test "Integer" "32768" $file /cpus/PowerPC,970 at 1 d-cache-size
++    run_fdtget_test "Integer hex" "8000" -tx $file \
++	/cpus/PowerPC,970 at 1 d-cache-size
++    run_fdtget_test "Integer list" "61 62 63 0" -tbx $file \
++	/randomnode tricky1
++    run_fdtget_test "Byte list short" "a b c d de ea ad be ef" -tbx \
++	$file /randomnode blob
++
++    # Here the property size is not a multiple of 4 bytes, so it should fail
++    run_fdtget_test "Integer list invalid" ERR -tlx \
++	$file /randomnode mixed
++    run_fdtget_test "Integer list halfword" "6162 6300 1234 0 a 0 b 0 c" -thx \
++	$file /randomnode mixed
++    run_fdtget_test "Integer list byte" \
++	"61 62 63 0 12 34 0 0 0 a 0 0 0 b 0 0 0 c" -thhx \
++	$file /randomnode mixed
++    run_fdtget_test "Missing property" ERR -ts \
++	$file /randomnode doctor-who
++}
++
+ utilfdt_tests () {
+     run_test utilfdt_test
+ }
+@@ -421,7 +459,7 @@ while getopts "vt:m" ARG ; do
+ done
+ 
+ if [ -z "$TESTSETS" ]; then
+-    TESTSETS="libfdt utilfdt dtc dtbs_equal"
++    TESTSETS="libfdt utilfdt dtc dtbs_equal fdtget"
+ fi
+ 
+ # Make sure we don't have stale blobs lying around
+@@ -441,6 +479,9 @@ for set in $TESTSETS; do
+ 	"dtbs_equal")
+ 	    dtbs_equal_tests
+ 	    ;;
++	"fdtget")
++	    fdtget_tests
++	    ;;
+     esac
+ done
+ 
+diff --git a/tests/tests.sh b/tests/tests.sh
+index 30ffead..d9a0524 100644
+--- a/tests/tests.sh
++++ b/tests/tests.sh
+@@ -11,6 +11,7 @@ FAIL () {
+ }
+ 
+ DTC=../dtc
++DTGET=../fdtget
+ 
+ verbose_run () {
+     if [ -z "$QUIET_TEST" ]; then
+diff --git a/util.h b/util.h
+index 730918e..c8eb45d 100644
+--- a/util.h
++++ b/util.h
+@@ -140,4 +140,14 @@ int utilfdt_write_err(const char *filename, const void *blob);
+  */
+ int utilfdt_decode_type(const char *fmt, int *type, int *size);
+ 
++/*
++ * This is a usage message fragment for the -t option. It is the format
++ * supported by utilfdt_decode_type.
++ */
++
++#define USAGE_TYPE_MSG \
++	"<type>\ts=string, i=int, u=unsigned, x=hex\n" \
++	"\tOptional modifier prefix:\n" \
++	"\t\thh or b=byte, h=2 byte, l=4 byte (default)\n";
++
+ #endif /* _UTIL_H */
+-- 
+1.7.8.3
+
diff --git a/debian/patches/21_Add-fdtput-utility-to-write-property-values-to-a-dev.patch b/debian/patches/21_Add-fdtput-utility-to-write-property-values-to-a-dev.patch
new file mode 100644
index 0000000..0e91866
--- /dev/null
+++ b/debian/patches/21_Add-fdtput-utility-to-write-property-values-to-a-dev.patch
@@ -0,0 +1,534 @@
+From 1ede50c3559bbfca79fadcbfd8acb9388f4aac87 Mon Sep 17 00:00:00 2001
+From: Simon Glass <sjg at chromium.org>
+Date: Sat, 21 Jan 2012 10:14:48 -0800
+Subject: [PATCH 6/7] Add fdtput utility to write property values to a device
+ tree
+
+This simple utility allows writing of values into a device tree from the
+command line. It aimes to be the opposite of fdtget.
+
+What is it for:
+- Updating fdt values when a binary blob already exists
+   (even though source may be available it might be easier to use this
+    utility rather than sed, etc.)
+- Writing machine-specific fdt values within a build system
+
+To use it, specify the fdt binary file on command line followed by the node
+and property to set. Then, provide a list of values to put into that
+property. Often there will be just one, but fdtput also supports arrays and
+string lists.
+
+fdtput does not try to guess the type of the property based on looking at
+the arguments. Instead it always assumes that an integer is provided. To
+indicate that you want to write a string, use -ts. You can also provide
+hex values with -tx.
+
+The command line arguments are joined together into a single value. For
+strings, a nul terminator is placed between each string when it is packed
+into the property. To avoid this, pass the string as a single argument.
+
+Usage:
+	fdtput <options> <dt file> <<node> <property> [<value>...]
+Options:
+	-t <type>	Type of data
+	-v		Verbose: display each value decoded from command line
+	-h		Print this help
+
+<type>	s=string, i=int, u=unsigned, x=hex
+	Optional modifier prefix:
+		hh or b=byte, h=2 byte, l=4 byte (default)
+
+To read from stdin and write to stdout, use - as the file. So you can do:
+
+cat somefile.dtb | fdtput -ts - /node prop "My string value" > newfile.dtb
+
+This commit also adds basic tests to verify the major features.
+
+Signed-off-by: Simon Glass <sjg at chromium.org>
+---
+ .gitignore              |    1 +
+ Makefile                |    4 +
+ Makefile.utils          |    7 ++
+ fdtput.c                |  235 +++++++++++++++++++++++++++++++++++++++++++++++
+ tests/fdtput-runtest.sh |   55 +++++++++++
+ tests/run_tests.sh      |   73 ++++++++++++++-
+ tests/tests.sh          |    1 +
+ 7 files changed, 375 insertions(+), 1 deletions(-)
+ create mode 100644 fdtput.c
+ create mode 100644 tests/fdtput-runtest.sh
+
+diff --git a/.gitignore b/.gitignore
+index 2d82b71..5074980 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -11,3 +11,4 @@ lex.yy.c
+ /convert-dtsv0
+ /version_gen.h
+ /fdtget
++/fdtput
+diff --git a/Makefile b/Makefile
+index a54a209..510caa6 100644
+--- a/Makefile
++++ b/Makefile
+@@ -111,6 +111,7 @@ BIN += convert-dtsv0
+ BIN += dtc
+ BIN += fdtdump
+ BIN += fdtget
++BIN += fdtput
+ 
+ SCRIPTS = dtdiff
+ 
+@@ -122,6 +123,7 @@ ifneq ($(DEPTARGETS),)
+ -include $(CONVERT_OBJS:%.o=%.d)
+ -include $(FDTDUMP_OBJS:%.o=%.d)
+ -include $(FDTGET_OBJS:%.o=%.d)
++-include $(FDTPUT_OBJS:%.o=%.d)
+ endif
+ 
+ 
+@@ -184,6 +186,8 @@ fdtdump:	$(FDTDUMP_OBJS)
+ 
+ fdtget:	$(FDTGET_OBJS) $(LIBFDT_archive)
+ 
++fdtput:	$(FDTPUT_OBJS) $(LIBFDT_archive)
++
+ 
+ #
+ # Testsuite rules
+diff --git a/Makefile.utils b/Makefile.utils
+index 38efa3c..48ece49 100644
+--- a/Makefile.utils
++++ b/Makefile.utils
+@@ -15,3 +15,10 @@ FDTGET_SRCS = \
+ 	util.c
+ 
+ FDTGET_OBJS = $(FDTGET_SRCS:%.c=%.o)
++
++
++FDTPUT_SRCS = \
++	fdtput.c \
++	util.c
++
++FDTPUT_OBJS = $(FDTPUT_SRCS:%.c=%.o)
+diff --git a/fdtput.c b/fdtput.c
+new file mode 100644
+index 0000000..f6ebd24
+--- /dev/null
++++ b/fdtput.c
+@@ -0,0 +1,235 @@
++/*
++ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of
++ * the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ * MA 02111-1307 USA
++ */
++
++#include <assert.h>
++#include <ctype.h>
++#include <getopt.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include <libfdt.h>
++
++#include "util.h"
++
++struct display_info {
++	int type;		/* data type (s/i/u/x or 0 for default) */
++	int size;		/* data size (1/2/4) */
++	int verbose;		/* verbose output */
++};
++
++static void report_error(const char *where, int err)
++{
++	fprintf(stderr, "Error at '%s': %s\n", where, fdt_strerror(err));
++}
++
++/**
++ * Encode a series of arguments in a property value.
++ *
++ * @param disp		Display information / options
++ * @param arg		List of arguments from command line
++ * @param arg_count	Number of arguments (may be 0)
++ * @param valuep	Returns buffer containing value
++ * @param *value_len	Returns length of value encoded
++ */
++static int encode_value(struct display_info *disp, char **arg, int arg_count,
++			char **valuep, int *value_len)
++{
++	char *value = NULL;	/* holding area for value */
++	int value_size = 0;	/* size of holding area */
++	char *ptr;		/* pointer to current value position */
++	int len;		/* length of this cell/string/byte */
++	int ival;
++	int upto;	/* the number of bytes we have written to buf */
++	char fmt[3];
++
++	upto = 0;
++
++	if (disp->verbose)
++		fprintf(stderr, "Decoding value:\n");
++
++	fmt[0] = '%';
++	fmt[1] = disp->type ? disp->type : 'd';
++	fmt[2] = '\0';
++	for (; arg_count > 0; arg++, arg_count--, upto += len) {
++		/* assume integer unless told otherwise */
++		if (disp->type == 's')
++			len = strlen(*arg) + 1;
++		else
++			len = disp->size == -1 ? 4 : disp->size;
++
++		/* enlarge our value buffer by a suitable margin if needed */
++		if (upto + len > value_size) {
++			value_size = (upto + len) + 500;
++			value = realloc(value, value_size);
++			if (!value) {
++				fprintf(stderr, "Out of mmory: cannot alloc "
++					"%d bytes\n", value_size);
++				return -1;
++			}
++		}
++
++		ptr = value + upto;
++		if (disp->type == 's') {
++			memcpy(ptr, *arg, len);
++			if (disp->verbose)
++				fprintf(stderr, "\tstring: '%s'\n", ptr);
++		} else {
++			int *iptr = (int *)ptr;
++			sscanf(*arg, fmt, &ival);
++			if (len == 4)
++				*iptr = cpu_to_fdt32(ival);
++			else
++				*ptr = (uint8_t)ival;
++			if (disp->verbose) {
++				fprintf(stderr, "\t%s: %d\n",
++					disp->size == 1 ? "byte" :
++					disp->size == 2 ? "short" : "int",
++					ival);
++			}
++		}
++	}
++	*value_len = upto;
++	*valuep = value;
++	if (disp->verbose)
++		fprintf(stderr, "Value size %d\n", upto);
++	return 0;
++}
++
++static int store_key_value(void *blob, const char *node_name,
++		const char *property, const char *buf, int len)
++{
++	int node;
++	int err;
++
++	node = fdt_path_offset(blob, node_name);
++	if (node < 0) {
++		report_error(node_name, node);
++		return -1;
++	}
++
++	err = fdt_setprop(blob, node, property, buf, len);
++	if (err) {
++		report_error(property, err);
++		return -1;
++	}
++	return 0;
++}
++
++static int do_fdtput(struct display_info *disp, const char *filename,
++		    char **arg, int arg_count)
++{
++	char *value;
++	char *blob;
++	int len, ret = 0;
++
++	blob = utilfdt_read(filename);
++	if (!blob)
++		return -1;
++
++	/* convert the arguments into a single binary value, then store */
++	assert(arg_count >= 2);
++	if (encode_value(disp, arg + 2, arg_count - 2, &value, &len) ||
++		store_key_value(blob, *arg, arg[1], value, len))
++		ret = -1;
++
++	if (!ret)
++		ret = utilfdt_write(filename, blob);
++
++	free(blob);
++	return ret;
++}
++
++static const char *usage_msg =
++	"fdtput - write a property value to a device tree\n"
++	"\n"
++	"The command line arguments are joined together into a single value.\n"
++	"\n"
++	"Usage:\n"
++	"	fdtput <options> <dt file> <<node> <property> [<value>...]\n"
++	"Options:\n"
++	"\t-t <type>\tType of data\n"
++	"\t-v\t\tVerbose: display each value decoded from command line\n"
++	"\t-h\t\tPrint this help\n\n"
++	USAGE_TYPE_MSG;
++
++static void usage(const char *msg)
++{
++	if (msg)
++		fprintf(stderr, "Error: %s\n\n", msg);
++
++	fprintf(stderr, "%s", usage_msg);
++	exit(2);
++}
++
++int main(int argc, char *argv[])
++{
++	struct display_info disp;
++	char *filename = NULL;
++
++	memset(&disp, '\0', sizeof(disp));
++	disp.size = -1;
++	for (;;) {
++		int c = getopt(argc, argv, "ht:v");
++		if (c == -1)
++			break;
++
++		/*
++		 * TODO: add options to:
++		 * - delete property
++		 * - delete node (optionally recursively)
++		 * - rename node
++		 * - pack fdt before writing
++		 * - set amount of free space when writing
++		 * - expand fdt if value doesn't fit
++		 */
++		switch (c) {
++		case 'h':
++		case '?':
++			usage(NULL);
++
++		case 't':
++			if (utilfdt_decode_type(optarg, &disp.type,
++					&disp.size))
++				usage("Invalid type string");
++			break;
++
++		case 'v':
++			disp.verbose = 1;
++			break;
++		}
++	}
++
++	if (optind < argc)
++		filename = argv[optind++];
++	if (!filename)
++		usage("Missing filename");
++
++	argv += optind;
++	argc -= optind;
++
++	if (argc < 1)
++		usage("Missing node");
++	if (argc < 2)
++		usage("Missing property");
++
++	if (do_fdtput(&disp, filename, argv, argc))
++		return 1;
++	return 0;
++}
+diff --git a/tests/fdtput-runtest.sh b/tests/fdtput-runtest.sh
+new file mode 100644
+index 0000000..ea51569
+--- /dev/null
++++ b/tests/fdtput-runtest.sh
+@@ -0,0 +1,55 @@
++#! /bin/sh
++
++# Run script for fdtput tests
++# We run fdtput to update the device tree, thn fdtget to check it
++
++# Usage
++#    fdtput-runtest.sh name expected_output dtb_file node property flags value
++
++. ./tests.sh
++
++LOG="tmp.log.$$"
++EXPECT="tmp.expect.$$"
++
++rm -f $TMPFILE $LOG
++
++expect="$1"
++echo "$expect" >$EXPECT
++dtb="$2"
++node="$3"
++property="$4"
++flags="$5"
++shift 5
++value="$@"
++
++# First run fdtput
++verbose_run $VALGRIND "$DTPUT" "$dtb" "$node" "$property" $value $flags
++ret="$?"
++
++if [ "$ret" -ne 0 -a "$expect" = "ERR" ]; then
++	PASS
++fi
++if [ "$ret" -gt 127 ]; then
++    signame=$(kill -l $[ret - 128])
++    FAIL "Killed by SIG$signame"
++fi
++
++# Now fdtget to read the value
++verbose_run_log "$LOG" $VALGRIND "$DTGET" "$dtb" "$node" "$property" $flags
++ret="$?"
++
++if [ "$ret" -gt 127 ]; then
++    signame=$(kill -l $[ret - 128])
++    FAIL "Killed by SIG$signame"
++fi
++
++diff $EXPECT $LOG
++ret="$?"
++
++rm -f $LOG $EXPECT
++
++if [ "$ret" -eq 0 ]; then
++	PASS
++else
++	FAIL
++fi
+diff --git a/tests/run_tests.sh b/tests/run_tests.sh
+index e6184df..2650559 100755
+--- a/tests/run_tests.sh
++++ b/tests/run_tests.sh
+@@ -90,6 +90,21 @@ run_fdtget_test () {
+     base_run_test sh fdtget-runtest.sh "$@"
+ }
+ 
++run_fdtput_test () {
++    # run_fdtput_test name expected_output dtb_file node property flags value...
++    echo -n "$1:	"
++    shift
++    output="$1"
++    dtb="$2"
++    node="$3"
++    property="$4"
++    flags="$5"
++    shift 5
++    base_run_test sh fdtput-runtest.sh "$output" "$dtb" "$node" "$property" \
++		"$flags" $@
++#     base_run_test sh fdtput-runtest.sh "$@"
++}
++
+ tree1_tests () {
+     TREE=$1
+ 
+@@ -440,6 +455,59 @@ fdtget_tests () {
+ 	$file /randomnode doctor-who
+ }
+ 
++fdtput_tests () {
++    file=label01.dtb
++    src=label01.dts
++
++    # Create some test files containing useful strings
++    base=tmp.test0
++    file1=tmp.test1
++    file2=tmp.test2
++    bigfile1=tmp.test3
++    bigfile2=tmp.test4
++
++    # Filter out anything the shell might not like
++    cat $src | tr -d "'\"\n\;/\.\*{}\-" | tr -s "[:blank:]" " " >$base
++
++    # Make two small files
++    head -5 $base >$file1
++    cat $file1 | tr a-z A-Z | cut -c10-30 | sort -r >$file2
++
++    # and two larger ones
++    cat $base > $bigfile1
++    tac $base | tr a-z A-Z | sort -r >$bigfile2
++
++    # Allow just enough space for both file1 and file2
++    (( space = $(stat -c %s $file1) + $(stat -c %s $file2) ))
++    $DTC -O dtb -p $space -o $file ${file%.dtb}.dts 2>/dev/null
++
++    # run_fdtput_test <test-name> <expected-result> <file> <key> <flags>
++    #		<args>...
++    run_fdtput_test "Simple string" "a_model" $file / model -ts "a_model"
++    run_fdtput_test "Multiple string s" "board1 board2" \
++	$file / compatible -ts board1 board2
++    run_fdtput_test "Single string with spaces" "board1 board2" \
++	$file / compatible -ts "board1 board2"
++    run_fdtput_test "Integer" "32768" \
++	$file /cpus/PowerPC,970 at 1 d-cache-size "" "32768"
++    run_fdtput_test "Integer hex" "8001" \
++	$file /cpus/PowerPC,970 at 1 d-cache-size -tx 0x8001
++    run_fdtput_test "Integer list" "2 3 12" \
++	$file /randomnode tricky1 -tbi "02 003 12"
++    run_fdtput_test "Byte list short" "a b c ea ad be ef" \
++	$file /randomnode blob -tbx "a b c ea ad be ef"
++    run_fdtput_test "Integer list short" "a0b0c0d deeaae ef000000" \
++	$file /randomnode blob -tx "a0b0c0d deeaae ef000000"
++    run_fdtput_test "Large string list" "`cat $file1 $file2`" \
++	$file /randomnode blob -ts "`cat $file1`" "`cat $file2`"
++
++    # This should be larger than available space in the fdt ($space)
++    run_fdtput_test "Enormous string list" ERR \
++	$file /randomnode blob -ts "`cat $bigfile1`" "`cat $bigfile2`"
++
++    # TODO: Add tests for verbose mode?
++}
++
+ utilfdt_tests () {
+     run_test utilfdt_test
+ }
+@@ -459,7 +527,7 @@ while getopts "vt:m" ARG ; do
+ done
+ 
+ if [ -z "$TESTSETS" ]; then
+-    TESTSETS="libfdt utilfdt dtc dtbs_equal fdtget"
++    TESTSETS="libfdt utilfdt dtc dtbs_equal fdtget fdtput"
+ fi
+ 
+ # Make sure we don't have stale blobs lying around
+@@ -482,6 +550,9 @@ for set in $TESTSETS; do
+ 	"fdtget")
+ 	    fdtget_tests
+ 	    ;;
++	"fdtput")
++	    fdtput_tests
++	    ;;
+     esac
+ done
+ 
+diff --git a/tests/tests.sh b/tests/tests.sh
+index d9a0524..6e5e76a 100644
+--- a/tests/tests.sh
++++ b/tests/tests.sh
+@@ -12,6 +12,7 @@ FAIL () {
+ 
+ DTC=../dtc
+ DTGET=../fdtget
++DTPUT=../fdtput
+ 
+ verbose_run () {
+     if [ -z "$QUIET_TEST" ]; then
+-- 
+1.7.8.3
+
diff --git a/debian/patches/22_Introduce-TESTS_BIN-in-Makefiles-to-identify-tested-.patch b/debian/patches/22_Introduce-TESTS_BIN-in-Makefiles-to-identify-tested-.patch
new file mode 100644
index 0000000..ad8ecde
--- /dev/null
+++ b/debian/patches/22_Introduce-TESTS_BIN-in-Makefiles-to-identify-tested-.patch
@@ -0,0 +1,52 @@
+From 1456da7e2d3054882b20c120d817096bea21571e Mon Sep 17 00:00:00 2001
+From: Jon Loeliger <jdl at jdl.com>
+Date: Sat, 21 Jan 2012 15:24:51 -0600
+Subject: [PATCH 7/7] Introduce ${TESTS_BIN} in Makefiles to identify tested
+ executables.
+
+---
+ Makefile             |    6 ++++++
+ tests/Makefile.tests |    6 +++---
+ 2 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 510caa6..1169e6c 100644
+--- a/Makefile
++++ b/Makefile
+@@ -193,6 +193,12 @@ fdtput:	$(FDTPUT_OBJS) $(LIBFDT_archive)
+ # Testsuite rules
+ #
+ TESTS_PREFIX=tests/
++
++TESTS_BIN += dtc
++TESTS_BIN += convert-dtsv0
++TESTS_BIN += fdtput
++TESTS_BIN += fdtget
++
+ include tests/Makefile.tests
+ 
+ #
+diff --git a/tests/Makefile.tests b/tests/Makefile.tests
+index 3f92074..2eee708 100644
+--- a/tests/Makefile.tests
++++ b/tests/Makefile.tests
+@@ -65,13 +65,13 @@ tests_clean:
+ 	rm -f $(STD_CLEANFILES:%=$(TESTS_PREFIX)%)
+ 	rm -f $(TESTS_CLEANFILES)
+ 
+-check:	tests dtc convert-dtsv0
++check:	tests ${TESTS_BIN}
+ 	cd $(TESTS_PREFIX); ./run_tests.sh
+ 
+-checkm: tests dtc convert-dtsv0
++checkm: tests ${TESTS_BIN}
+ 	cd $(TESTS_PREFIX); ./run_tests.sh -m 2>&1 | tee vglog.$$$$
+ 
+-checkv:	tests dtc convert-dtsv0
++checkv:	tests ${TESTS_BIN}
+ 	cd $(TESTS_PREFIX); ./run_tests.sh -v
+ 
+ ifneq ($(DEPTARGETS),)
+-- 
+1.7.8.3
+
diff --git a/debian/patches/series b/debian/patches/series
index d692a6e..696af76 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -13,4 +13,10 @@
 13_Add-fdt16_to_cpu-utility-function.patch
 14_Add-data_append_integer-function.patch
 15_Add-support-for-variable-sized-elements.patch
-#16_fdtdump-rename-from-ftdump.patch
+16_fdtdump-rename-from-ftdump.patch
+17_libfdt-Add-support-for-appending-the-values-to-a-exi.patch
+18_libfdt-Activate-testcase-for-appending-properties.patch
+19_dtc-Implement-d-option-to-write-out-a-dependency-fil.patch
+20_Add-fdtget-utility-to-read-property-values-from-a-de.patch
+21_Add-fdtput-utility-to-write-property-values-to-a-dev.patch
+22_Introduce-TESTS_BIN-in-Makefiles-to-identify-tested-.patch
diff --git a/debian/rules b/debian/rules
index 2eba1c4..3e23276 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,9 @@ else
 	CFLAGS += -O2
 endif
 
-build: build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 build-stamp:
 	dh_testdir
 	QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
@@ -40,7 +42,8 @@ install: build
 	dh_testroot
 	dh_prep
 	dh_installdirs
-	install -m755 dtc $(CURDIR)/debian/device-tree-compiler/usr/bin
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr
+	dh_install --list-missing --sourcedir=debian/tmp
 	touch install-stamp
 
 # Build architecture-independent files here.
@@ -59,6 +62,7 @@ binary-arch: build install
 	dh_strip
 	dh_compress
 	dh_fixperms
+	dh_makeshlibs
 	dh_installdeb
 	dh_shlibdeps
 	dh_gencontrol

-- 
OpenFirmware Device Tree Compiler for Flat Device Trees



More information about the Crosstoolchain-logs mailing list