[Crosstoolchain-logs] [SCM] OpenFirmware Device Tree Compiler for Flat Device Trees branch, master, updated. debian/1.1.0.dfsg-1-2-g953c44e
Hector Oron
hector.oron at gmail.com
Tue Nov 22 13:37:25 UTC 2011
The following commit has been merged in the master branch:
commit 953c44e76900525b58f4ae477200f4db6ffb9634
Merge: e9b6e1f9d0ff53562bfb66f7b1622e135b6233e6 dadf4b1a0561296ea526813134bd9f4a5a5ff1e6
Author: Hector Oron <zumbi at debian.org>
Date: Tue Nov 22 12:23:38 2011 +0000
Imported Debian patch 1.3.0-1
diff --combined debian/changelog
index e9a70b5,0000000..94d8e15
mode 100644,000000..100644
--- a/debian/changelog
+++ b/debian/changelog
@@@ -1,48 -1,0 +1,61 @@@
++device-tree-compiler (1.3.0-1) unstable; urgency=low
++
++ * New upstream release. (Closes: #572945)
++ * New maintainer. (Closes: #649290)
++ * New VCS repository.
++ * Update homepage stanza (Closes: #497605)
++ * Update standards version.
++ * Compile with -fPIC. Fixes ftbfs on amd64.
++ * Use dpkg 1.0 format.
++ * Backport upstream fixes as patches until 2011-10-26.
++
++ -- Hector Oron <zumbi at debian.org> Tue, 22 Nov 2011 12:23:38 +0000
++
+device-tree-compiler (1.1.0.dfsg-1) unstable; urgency=low
+
+ * New upstream release.
+ * Fix lintian warning "copyright-without-copyright-notice".
+ + Update debian/copyright.
+
+ -- Aurélien GÉRÔME <ag at roxor.cx> Sat, 16 Feb 2008 17:08:36 +0100
+
+device-tree-compiler (1.0.0.dfsg-1) unstable; urgency=low
+
+ * New upstream release. (Closes: #438479)
+ + Fix missing /chosen node, as it has been removed from DTS.
+ (Closes: #436234)
+ * Remove ftdump from the upstream tarball.
+ + This file has no license notice.
+ + Fix conflict with the freetype2-demos package. (Closes: #434890)
+ + David Gibson told me that he would not bother even installing
+ ftdump. It was meant to be a debugging tool, dumping a blob
+ back into text format, but it never got very far and he has
+ been meaning to get rid of it.
+ * Update tests/dumptrees.c in the upstream tarball with GIT commit
+ 08c0be206d5d6b035db11048d19be33216332f2b.
+ + Fix missing copyright and license notices.
+ * Update debian/copyright.
+ + Mention dual GPLv2+/BSD licensing of libfdt.
+ + Add Jon Loeliger as an upstream author.
+ * Bump Standards-Version to 3.7.3.
+ * Add the Homepage field and remove it from the long description.
+ * Add the Vcs-Git/Vcs-Browser fields.
+ * Add the XS-DM-Upload-Allowed field.
+ * Rewrite short and long descriptions in debian/control.
+ * Rewrite debian/rules to handle the noopt build option.
+ * Write and add a manpage for dtc.
+ * Add documentation under /usr/share/doc/device-tree-compiler/.
+ + Add Build-Depends on texlive and texlive-latex-extra.
+ + Add debian/doc-base.dtc-manual and debian/doc-base.dtc-paper.
+ + Create a Makefile to build dtc-paper.tex.
+ - Add quilt support to build system.
+ - Add 01_build_doc.diff.
+ + Update debian/rules to prepare documentation.
+
+ -- Aurélien GÉRÔME <ag at roxor.cx> Sat, 22 Dec 2007 04:02:24 +0100
+
+device-tree-compiler (0.1~git20070226-1) experimental; urgency=low
+
+ * Initial release. (Closes: #413290)
+
+ -- Aurélien GÉRÔME <ag at roxor.cx> Sat, 3 Mar 2007 23:13:14 +0100
diff --combined debian/control
index 0488032,0000000..8fe0b2e
mode 100644,000000..100644
--- a/debian/control
+++ b/debian/control
@@@ -1,18 -1,0 +1,16 @@@
+Source: device-tree-compiler
+Section: devel
+Priority: extra
- Maintainer: Aurélien GÉRÔME <ag at roxor.cx>
- Uploaders: Sven Luther <luther at debian.org>
- Standards-Version: 3.7.3
++Maintainer: Hector Oron <zumbi at debian.org>
++Standards-Version: 3.9.2
+Build-Depends: debhelper (>= 5), quilt, flex, bison, texlive, texlive-latex-extra
- Homepage: http://www.jdl.com/git_repos/?p=dtc.git
- Vcs-Git: git://git.roxor.cx/git/device-tree-compiler/
- Vcs-Browser: http://git.roxor.cx/?p=device-tree-compiler
- XS-DM-Upload-Allowed: yes
++Homepage: http://git.jdl.com/gitweb/?p=dtc.git
++Vcs-Git: git://anonscm.debian.org/crosstoolchain/device-tree-compiler.git
++Vcs-Browser: http://anonscm.debian.org/gitweb/?p=crosstoolchain/device-tree-compiler.git
+
+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.
diff --combined debian/patches/01_build_doc.patch
index 06c3e40,0000000..06c3e40
mode 100644,000000..100644
--- a/debian/patches/01_build_doc.patch
+++ b/debian/patches/01_build_doc.patch
@@@ -1,21 -1,0 +1,21 @@@
+Index: device-tree-compiler-1.0.0/Documentation/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ device-tree-compiler-1.0.0/Documentation/Makefile 2007-08-23 18:26:22.000000000 +0200
+@@ -0,0 +1,16 @@
++all: dtc-paper.ps dtc-paper.pdf dtc-manual.txt
++
++dtc-manual.txt: manual.txt
++ cp -f $< $@
++
++dtc-paper.dvi: dtc-paper.tex
++ latex $<
++
++dtc-paper.ps: dtc-paper.dvi
++ dvips $<
++
++dtc-paper.pdf: dtc-paper.tex
++ pdflatex $<
++
++clean:
++ rm -f *.aux *.log *.dvi *.ps *.pdf dtc-manual.txt
diff --combined debian/patches/02_remove-unused-check-variable.patch
index 0000000,0000000..2d5fd2b
new file mode 100644
--- /dev/null
+++ b/debian/patches/02_remove-unused-check-variable.patch
@@@ -1,0 -1,0 +1,55 @@@
++From: Josh Boyer <jwboyer at linux.vnet.ibm.com>
++Date: Tue, 28 Jun 2011 12:47:09 +0000 (-0400)
++Subject: dtc: Remove unused check variable
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=0a5aca98ba104ec4101322ccaf36da45064ad3ce
++
++dtc: Remove unused check variable
++
++Commit 376ab6f2 removed the old style check functionality from DTC,
++however the check option and variable were not removed. This leads to
++build failures when -Werror=unused-but-set-variable is specified:
++
++ dtc.c: In function 'main':
++ dtc.c:102:17: error: variable 'check' set but not used [-Werror=unused-but-set-variable]
++ cc1: all warnings being treated as errors
++ make: *** [dtc.o] Error 1
++ make: *** Waiting for unfinished jobs....
++
++Remove the check variable.
++
++Signed-off-by: Josh Boyer <jwboyer at linux.vnet.ibm.com>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/dtc.c b/dtc.c
++index cbc0193..15d2fc2 100644
++--- a/dtc.c
+++++ b/dtc.c
++@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
++ const char *inform = "dts";
++ const char *outform = "dts";
++ const char *outname = "-";
++- int force = 0, check = 0, sort = 0;
+++ int force = 0, sort = 0;
++ const char *arg;
++ int opt;
++ FILE *outf = NULL;
++@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
++ minsize = 0;
++ padsize = 0;
++
++- while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fcqb:vH:s")) != EOF) {
+++ while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fqb:vH:s")) != EOF) {
++ switch (opt) {
++ case 'I':
++ inform = optarg;
++@@ -137,9 +137,6 @@ int main(int argc, char *argv[])
++ case 'f':
++ force = 1;
++ break;
++- case 'c':
++- check = 1;
++- break;
++ case 'q':
++ quiet++;
++ break;
diff --combined debian/patches/03_Remove-unused-variable-in-flat_read_mem_reserve.patch
index 0000000,0000000..843db58
new file mode 100644
--- /dev/null
+++ b/debian/patches/03_Remove-unused-variable-in-flat_read_mem_reserve.patch
@@@ -1,0 -1,0 +1,42 @@@
++From: Josh Boyer <jwboyer at linux.vnet.ibm.com>
++Date: Tue, 28 Jun 2011 13:47:11 +0000 (-0400)
++Subject: dtc: Remove unused variable in flat_read_mem_reserve
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=d5b3165023b1cc3914e9943b91964ec9ad4be8b2
++
++dtc: Remove unused variable in flat_read_mem_reserve
++
++The *p variable is declared and used to save inb->ptr, however p is
++later never used. This has been the case since commit 6c0f3676 and can
++lead to build failures with -Werror=unused-but-set-variable:
++
++ flattree.c: In function 'flat_read_mem_reserve':
++ flattree.c:700:14: error: variable 'p' set but not used [-Werror=unused-but-set-variable]
++ cc1: all warnings being treated as errors
++ make: *** [flattree.o] Error 1
++
++Remove the variable.
++
++Signed-off-by: Josh Boyer <jwboyer at linux.vnet.ibm.com>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/flattree.c b/flattree.c
++index ead0332..28d0b23 100644
++--- a/flattree.c
+++++ b/flattree.c
++@@ -697,7 +697,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
++ {
++ struct reserve_info *reservelist = NULL;
++ struct reserve_info *new;
++- const char *p;
++ struct fdt_reserve_entry re;
++
++ /*
++@@ -706,7 +705,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
++ *
++ * First pass, count entries.
++ */
++- p = inb->ptr;
++ while (1) {
++ flat_read_chunk(inb, &re, sizeof(re));
++ re.address = fdt64_to_cpu(re.address);
diff --combined debian/patches/04_Split-out-is_printable_string-into-util.patch
index 0000000,0000000..5896a94
new file mode 100644
--- /dev/null
+++ b/debian/patches/04_Split-out-is_printable_string-into-util.patch
@@@ -1,0 -1,0 +1,157 @@@
++From: Simon Glass <sjg at chromium.org>
++Date: Tue, 5 Jul 2011 19:02:49 +0000 (-0700)
++Subject: Split out is_printable_string() into util.c
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=492f9d5de7db74aeb3a905246c4efd7cb29227a8
++
++Split out is_printable_string() into util.c
++
++This useful function is split out so it will be available to programs
++other than ftdump.
++
++Signed-off-by: Simon Glass <sjg at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/Makefile.ftdump b/Makefile.ftdump
++index b70905a..2744a18 100644
++--- a/Makefile.ftdump
+++++ b/Makefile.ftdump
++@@ -5,7 +5,8 @@
++ #
++
++ FTDUMP_SRCS = \
++- ftdump.c
+++ ftdump.c \
+++ util.c
++
++ FTDUMP_GEN_SRCS =
++
++diff --git a/ftdump.c b/ftdump.c
++index bce6535..db932e3 100644
++--- a/ftdump.c
+++++ b/ftdump.c
++@@ -11,36 +11,14 @@
++ #include <fdt.h>
++ #include <libfdt_env.h>
++
+++#include "util.h"
+++
++ #define FTDUMP_BUF_SIZE 65536
++
++ #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 int is_printable_string(const void *data, int len)
++-{
++- const char *s = data;
++- const char *ss;
++-
++- /* zero length is not */
++- if (len == 0)
++- return 0;
++-
++- /* must terminate with zero */
++- if (s[len - 1] != '\0')
++- return 0;
++-
++- ss = s;
++- while (*s && isprint(*s))
++- s++;
++-
++- /* not zero, or not done yet */
++- if (*s != '\0' || (s + 1 - ss) < len)
++- return 0;
++-
++- return 1;
++-}
++-
++ static void print_data(const char *data, int len)
++ {
++ int i;
++@@ -50,7 +28,7 @@ static void print_data(const char *data, int len)
++ if (len == 0)
++ return;
++
++- if (is_printable_string(data, len)) {
+++ if (util_is_printable_string(data, len)) {
++ printf(" = \"%s\"", (const char *)data);
++ } else if ((len % 4) == 0) {
++ printf(" = <");
++diff --git a/util.c b/util.c
++index d7ac27d..994436f 100644
++--- a/util.c
+++++ b/util.c
++@@ -1,6 +1,9 @@
++ /*
++ * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
++ *
+++ * util_is_printable_string contributed by
+++ * Pantelis Antoniou <pantelis.antoniou AT gmail.com>
+++ *
++ * 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
++@@ -17,6 +20,7 @@
++ * USA
++ */
++
+++#include <ctype.h>
++ #include <stdio.h>
++ #include <stdlib.h>
++ #include <stdarg.h>
++@@ -57,3 +61,27 @@ char *join_path(const char *path, const char *name)
++ memcpy(str+lenp, name, lenn+1);
++ return str;
++ }
+++
+++int util_is_printable_string(const void *data, int len)
+++{
+++ const char *s = data;
+++ const char *ss;
+++
+++ /* zero length is not */
+++ if (len == 0)
+++ return 0;
+++
+++ /* must terminate with zero */
+++ if (s[len - 1] != '\0')
+++ return 0;
+++
+++ ss = s;
+++ while (*s && isprint(*s))
+++ s++;
+++
+++ /* not zero, or not done yet */
+++ if (*s != '\0' || (s + 1 - ss) < len)
+++ return 0;
+++
+++ return 1;
+++}
++diff --git a/util.h b/util.h
++index 9cead84..cc68933 100644
++--- a/util.h
+++++ b/util.h
++@@ -1,6 +1,8 @@
++ #ifndef _UTIL_H
++ #define _UTIL_H
++
+++#include <stdarg.h>
+++
++ /*
++ * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
++ *
++@@ -53,4 +55,13 @@ static inline void *xrealloc(void *p, size_t len)
++ extern char *xstrdup(const char *s);
++ extern char *join_path(const char *path, const char *name);
++
+++/**
+++ * Check a string of a given length to see if it is all printable and
+++ * has a valid terminator.
+++ *
+++ * @param data The string to check
+++ * @param len The string length including terminator
+++ * @return 1 if a valid printable string, 0 if not */
+++int util_is_printable_string(const void *data, int len);
+++
++ #endif /* _UTIL_H */
diff --combined debian/patches/05_Add-missing-tests-to-gitignore.patch
index 0000000,0000000..e0d2496
new file mode 100644
--- /dev/null
+++ b/debian/patches/05_Add-missing-tests-to-gitignore.patch
@@@ -1,0 -1,0 +1,21 @@@
++From: Simon Glass <sjg at chromium.org>
++Date: Tue, 5 Jul 2011 19:02:52 +0000 (-0700)
++Subject: Add missing tests to .gitignore
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=ed8fee1a649b5430afc9b551e3bb6746ebe32449
++
++Add missing tests to .gitignore
++
++Signed-off-by: Simon Glass <sjg at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/tests/.gitignore b/tests/.gitignore
++index c4e1205..f4e58b2 100644
++--- a/tests/.gitignore
+++++ b/tests/.gitignore
++@@ -45,3 +45,5 @@
++ /sw_tree1
++ /truncated_property
++ /value-labels
+++/dtb_reverse
+++/dtbs_equal_unordered
diff --combined debian/patches/06_Refactor-character-literal-parsing-code.patch
index 0000000,0000000..0740cd8
new file mode 100644
--- /dev/null
+++ b/debian/patches/06_Refactor-character-literal-parsing-code.patch
@@@ -1,0 -1,0 +1,249 @@@
++From: Anton Staaf <robotboy at chromium.org>
++Date: Fri, 9 Sep 2011 19:16:29 +0000 (-0700)
++Subject: dtc: Refactor character literal parsing code
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=b43335a23854b2620140eda6cca2ffae59e8de23
++
++dtc: Refactor character literal parsing code
++
++Move the parsing of hex, octal and escaped characters from data.c
++to util.c where it can be used for character literal parsing within
++strings as well as for stand alone C style character literals.
++
++Signed-off-by: Anton Staaf <robotboy at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/data.c b/data.c
++index fe555e8..b5f3066 100644
++--- a/data.c
+++++ b/data.c
++@@ -68,40 +68,6 @@ struct data data_copy_mem(const char *mem, int len)
++ return d;
++ }
++
++-static char get_oct_char(const char *s, int *i)
++-{
++- char x[4];
++- char *endx;
++- long val;
++-
++- x[3] = '\0';
++- strncpy(x, s + *i, 3);
++-
++- val = strtol(x, &endx, 8);
++-
++- assert(endx > x);
++-
++- (*i) += endx - x;
++- return val;
++-}
++-
++-static char get_hex_char(const char *s, int *i)
++-{
++- char x[3];
++- char *endx;
++- long val;
++-
++- x[2] = '\0';
++- strncpy(x, s + *i, 2);
++-
++- val = strtol(x, &endx, 16);
++- if (!(endx > x))
++- die("\\x used with no following hex digits\n");
++-
++- (*i) += endx - x;
++- return val;
++-}
++-
++ struct data data_copy_escape_string(const char *s, int len)
++ {
++ int i = 0;
++@@ -114,53 +80,10 @@ struct data data_copy_escape_string(const char *s, int len)
++ while (i < len) {
++ char c = s[i++];
++
++- if (c != '\\') {
++- q[d.len++] = c;
++- continue;
++- }
++-
++- c = s[i++];
++- assert(c);
++- switch (c) {
++- case 'a':
++- q[d.len++] = '\a';
++- break;
++- case 'b':
++- q[d.len++] = '\b';
++- break;
++- case 't':
++- q[d.len++] = '\t';
++- break;
++- case 'n':
++- q[d.len++] = '\n';
++- break;
++- case 'v':
++- q[d.len++] = '\v';
++- break;
++- case 'f':
++- q[d.len++] = '\f';
++- break;
++- case 'r':
++- q[d.len++] = '\r';
++- break;
++- case '0':
++- case '1':
++- case '2':
++- case '3':
++- case '4':
++- case '5':
++- case '6':
++- case '7':
++- i--; /* need to re-read the first digit as
++- * part of the octal value */
++- q[d.len++] = get_oct_char(s, &i);
++- break;
++- case 'x':
++- q[d.len++] = get_hex_char(s, &i);
++- break;
++- default:
++- q[d.len++] = c;
++- }
+++ if (c == '\\')
+++ c = get_escape_char(s, &i);
+++
+++ q[d.len++] = c;
++ }
++
++ q[d.len++] = '\0';
++diff --git a/util.c b/util.c
++index 994436f..6d07292 100644
++--- a/util.c
+++++ b/util.c
++@@ -25,6 +25,7 @@
++ #include <stdlib.h>
++ #include <stdarg.h>
++ #include <string.h>
+++#include <assert.h>
++
++ #include "util.h"
++
++@@ -85,3 +86,101 @@ int util_is_printable_string(const void *data, int len)
++
++ return 1;
++ }
+++
+++/*
+++ * Parse a octal encoded character starting at index i in string s. The
+++ * resulting character will be returned and the index i will be updated to
+++ * point at the character directly after the end of the encoding, this may be
+++ * the '\0' terminator of the string.
+++ */
+++static char get_oct_char(const char *s, int *i)
+++{
+++ char x[4];
+++ char *endx;
+++ long val;
+++
+++ x[3] = '\0';
+++ strncpy(x, s + *i, 3);
+++
+++ val = strtol(x, &endx, 8);
+++
+++ assert(endx > x);
+++
+++ (*i) += endx - x;
+++ return val;
+++}
+++
+++/*
+++ * Parse a hexadecimal encoded character starting at index i in string s. The
+++ * resulting character will be returned and the index i will be updated to
+++ * point at the character directly after the end of the encoding, this may be
+++ * the '\0' terminator of the string.
+++ */
+++static char get_hex_char(const char *s, int *i)
+++{
+++ char x[3];
+++ char *endx;
+++ long val;
+++
+++ x[2] = '\0';
+++ strncpy(x, s + *i, 2);
+++
+++ val = strtol(x, &endx, 16);
+++ if (!(endx > x))
+++ die("\\x used with no following hex digits\n");
+++
+++ (*i) += endx - x;
+++ return val;
+++}
+++
+++char get_escape_char(const char *s, int *i)
+++{
+++ char c = s[*i];
+++ int j = *i + 1;
+++ char val;
+++
+++ assert(c);
+++ switch (c) {
+++ case 'a':
+++ val = '\a';
+++ break;
+++ case 'b':
+++ val = '\b';
+++ break;
+++ case 't':
+++ val = '\t';
+++ break;
+++ case 'n':
+++ val = '\n';
+++ break;
+++ case 'v':
+++ val = '\v';
+++ break;
+++ case 'f':
+++ val = '\f';
+++ break;
+++ case 'r':
+++ val = '\r';
+++ break;
+++ case '0':
+++ case '1':
+++ case '2':
+++ case '3':
+++ case '4':
+++ case '5':
+++ case '6':
+++ case '7':
+++ j--; /* need to re-read the first digit as
+++ * part of the octal value */
+++ val = get_oct_char(s, &j);
+++ break;
+++ case 'x':
+++ val = get_hex_char(s, &j);
+++ break;
+++ default:
+++ val = c;
+++ }
+++
+++ (*i) = j;
+++ return val;
+++}
++diff --git a/util.h b/util.h
++index cc68933..f251480 100644
++--- a/util.h
+++++ b/util.h
++@@ -64,4 +64,12 @@ extern char *join_path(const char *path, const char *name);
++ * @return 1 if a valid printable string, 0 if not */
++ int util_is_printable_string(const void *data, int len);
++
+++/*
+++ * Parse an escaped character starting at index i in string s. The resulting
+++ * character will be returned and the index i will be updated to point at the
+++ * character directly after the end of the encoding, this may be the '\0'
+++ * terminator of the string.
+++ */
+++char get_escape_char(const char *s, int *i);
+++
++ #endif /* _UTIL_H */
diff --combined debian/patches/07_Remove-gcc-4.6-set-but-not-used-warnings.patch
index 0000000,0000000..e6c7463
new file mode 100644
--- /dev/null
+++ b/debian/patches/07_Remove-gcc-4.6-set-but-not-used-warnings.patch
@@@ -1,0 -1,0 +1,101 @@@
++From: David Gibson <david at gibson.dropbear.id.au>
++Date: Mon, 12 Sep 2011 01:18:43 +0000 (+1000)
++Subject: dtc: Remove gcc 4.6 "set but not used" warnings
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=83df28bd39979b32a75656cac291c36dbd4e5497
++
++dtc: Remove gcc 4.6 "set but not used" warnings
++
++A number of the dtc testcases trigger the new "variable set but not
++used" warning from gcc 4.6. That is they have variables which are
++assigned, but then never read after that point.
++
++In a couple of cases this is just because the variables aren't needed,
++so this patch removes them. In subnode_offset.c, it's because one
++pair of variables we clearly intended to test we don't actually test.
++This patch also adds this missing check.
++
++This patch makes the testsuite compile clean with gcc 4.6.
++
++Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/tests/notfound.c b/tests/notfound.c
++index 38918ad..4d55b88 100644
++--- a/tests/notfound.c
+++++ b/tests/notfound.c
++@@ -37,27 +37,25 @@ static void check_error(const char *s, int err)
++
++ int main(int argc, char *argv[])
++ {
++- const struct fdt_property *prop;
++ void *fdt;
++ int offset;
++ int subnode1_offset;
++- const void *val;
++ int lenerr;
++
++ test_init(argc, argv);
++ fdt = load_blob_arg(argc, argv);
++
++- prop = fdt_get_property(fdt, 0, "nonexistant-property", &lenerr);
+++ fdt_get_property(fdt, 0, "nonexistant-property", &lenerr);
++ check_error("fdt_get_property(\"nonexistant-property\")", lenerr);
++
++- val = fdt_getprop(fdt, 0, "nonexistant-property", &lenerr);
+++ fdt_getprop(fdt, 0, "nonexistant-property", &lenerr);
++ check_error("fdt_getprop(\"nonexistant-property\"", lenerr);
++
++ subnode1_offset = fdt_subnode_offset(fdt, 0, "subnode at 1");
++ if (subnode1_offset < 0)
++ FAIL("Couldn't find subnode1: %s", fdt_strerror(subnode1_offset));
++
++- val = fdt_getprop(fdt, subnode1_offset, "prop-str", &lenerr);
+++ fdt_getprop(fdt, subnode1_offset, "prop-str", &lenerr);
++ check_error("fdt_getprop(\"prop-str\")", lenerr);
++
++ offset = fdt_subnode_offset(fdt, 0, "nonexistant-subnode");
++diff --git a/tests/path_offset.c b/tests/path_offset.c
++index bb092f1..d3e1f8e 100644
++--- a/tests/path_offset.c
+++++ b/tests/path_offset.c
++@@ -104,5 +104,9 @@ int main(int argc, char *argv[])
++ FAIL("Mismatch between subnode_offset (%d) and path_offset (%d)",
++ subsubnode2_offset, subsubnode2_offset_p);
++
+++ if (subsubnode2_offset2 != subsubnode2_offset2_p)
+++ FAIL("Mismatch between subnode_offset (%d) and path_offset (%d)",
+++ subsubnode2_offset2, subsubnode2_offset2_p);
+++
++ PASS();
++ }
++diff --git a/tests/subnode_offset.c b/tests/subnode_offset.c
++index b961070..e58c192 100644
++--- a/tests/subnode_offset.c
+++++ b/tests/subnode_offset.c
++@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
++ void *fdt;
++ int subnode1_offset, subnode2_offset;
++ int subsubnode1_offset, subsubnode2_offset, subsubnode2_offset2;
++- int ss11_off, ss12_off, ss21_off, ss22_off;
+++ int ss12_off, ss21_off;
++
++ test_init(argc, argv);
++ fdt = load_blob_arg(argc, argv);
++@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
++ if (subsubnode2_offset != subsubnode2_offset2)
++ FAIL("Different offsets with and without unit address");
++
++- ss11_off = check_subnode(fdt, subnode1_offset, "ss1");
+++ check_subnode(fdt, subnode1_offset, "ss1");
++ ss21_off = fdt_subnode_offset(fdt, subnode2_offset, "ss1");
++ if (ss21_off != -FDT_ERR_NOTFOUND)
++ FAIL("Incorrectly found ss1 in subnode2");
++@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
++ ss12_off = fdt_subnode_offset(fdt, subnode1_offset, "ss2");
++ if (ss12_off != -FDT_ERR_NOTFOUND)
++ FAIL("Incorrectly found ss2 in subnode1");
++- ss22_off = check_subnode(fdt, subnode2_offset, "ss2");
+++ check_subnode(fdt, subnode2_offset, "ss2");
++
++ PASS();
++ }
diff --combined debian/patches/08_Support-character-literals-in-cell-lists.patch
index 0000000,0000000..a7bdbd5
new file mode 100644
--- /dev/null
+++ b/debian/patches/08_Support-character-literals-in-cell-lists.patch
@@@ -1,0 -1,0 +1,241 @@@
++From: Anton Staaf <robotboy at chromium.org>
++Date: Fri, 9 Sep 2011 19:16:30 +0000 (-0700)
++Subject: dtc: Support character literals in cell lists
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=a4ea2fa9518ff0f4d7f4a08647599a727faac2e0
++
++dtc: Support character literals in cell lists
++
++With this patch the following property assignment:
++
++ property = <0x12345678 'a' '\r' 100>;
++
++is equivalent to:
++
++ property = <0x12345678 0x00000061 0x0000000D 0x00000064>
++
++Signed-off-by: Anton Staaf <robotboy at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/Documentation/dts-format.txt b/Documentation/dts-format.txt
++index a655b87..eae8b76 100644
++--- a/Documentation/dts-format.txt
+++++ b/Documentation/dts-format.txt
++@@ -33,7 +33,7 @@ Property values may be defined as an array of 32-bit integer cells, as
++ NUL-terminated strings, as bytestrings or a combination of these.
++
++ * Arrays of cells are represented by angle brackets surrounding a
++- space separated list of C-style integers
+++ space separated list of C-style integers or character literals.
++
++ e.g. interrupts = <17 0xc>;
++
++diff --git a/dtc-lexer.l b/dtc-lexer.l
++index e866ea5..494e342 100644
++--- a/dtc-lexer.l
+++++ b/dtc-lexer.l
++@@ -29,6 +29,7 @@ PROPNODECHAR [a-zA-Z0-9,._+*#?@-]
++ PATHCHAR ({PROPNODECHAR}|[/])
++ LABEL [a-zA-Z_][a-zA-Z0-9_]*
++ STRING \"([^\\"]|\\.)*\"
+++CHAR_LITERAL '([^']|\\')*'
++ WS [[:space:]]
++ COMMENT "/*"([^*]|\*+[^*/])*\*+"/"
++ LINECOMMENT "//".*\n
++@@ -109,6 +110,13 @@ static int pop_input_file(void);
++ return DT_LITERAL;
++ }
++
+++<*>{CHAR_LITERAL} {
+++ yytext[yyleng-1] = '\0';
+++ yylval.literal = xstrdup(yytext+1);
+++ DPRINT("Character literal: %s\n", yylval.literal);
+++ return DT_CHAR_LITERAL;
+++ }
+++
++ <*>\&{LABEL} { /* label reference */
++ DPRINT("Ref: %s\n", yytext+1);
++ yylval.labelref = xstrdup(yytext+1);
++diff --git a/dtc-parser.y b/dtc-parser.y
++index 5e84a67..554f11a 100644
++--- a/dtc-parser.y
+++++ b/dtc-parser.y
++@@ -34,6 +34,7 @@ extern struct boot_info *the_boot_info;
++ extern int treesource_error;
++
++ static unsigned long long eval_literal(const char *s, int base, int bits);
+++static unsigned char eval_char_literal(const char *s);
++ %}
++
++ %union {
++@@ -57,6 +58,7 @@ static unsigned long long eval_literal(const char *s, int base, int bits);
++ %token DT_MEMRESERVE
++ %token <propnodename> DT_PROPNODENAME
++ %token <literal> DT_LITERAL
+++%token <literal> DT_CHAR_LITERAL
++ %token <cbase> DT_BASE
++ %token <byte> DT_BYTE
++ %token <data> DT_STRING
++@@ -265,6 +267,10 @@ cellval:
++ {
++ $$ = eval_literal($1, 0, 32);
++ }
+++ | DT_CHAR_LITERAL
+++ {
+++ $$ = eval_char_literal($1);
+++ }
++ ;
++
++ bytestring:
++@@ -343,3 +349,29 @@ static unsigned long long eval_literal(const char *s, int base, int bits)
++ print_error("bad literal");
++ return val;
++ }
+++
+++static unsigned char eval_char_literal(const char *s)
+++{
+++ int i = 1;
+++ char c = s[0];
+++
+++ if (c == '\0')
+++ {
+++ print_error("empty character literal");
+++ return 0;
+++ }
+++
+++ /*
+++ * If the first character in the character literal is a \ then process
+++ * the remaining characters as an escape encoding. If the first
+++ * character is neither an escape or a terminator it should be the only
+++ * character in the literal and will be returned.
+++ */
+++ if (c == '\\')
+++ c = get_escape_char(s, &i);
+++
+++ if (s[i] != '\0')
+++ print_error("malformed character literal");
+++
+++ return c;
+++}
++diff --git a/tests/.gitignore b/tests/.gitignore
++index f4e58b2..a3e9bd1 100644
++--- a/tests/.gitignore
+++++ b/tests/.gitignore
++@@ -4,6 +4,7 @@
++ /add_subnode_with_nops
++ /asm_tree_dump
++ /boot-cpuid
+++/char_literal
++ /del_node
++ /del_property
++ /dtbs_equal_ordered
++diff --git a/tests/Makefile.tests b/tests/Makefile.tests
++index c564e72..e718b63 100644
++--- a/tests/Makefile.tests
+++++ b/tests/Makefile.tests
++@@ -5,6 +5,7 @@ LIB_TESTS_L = get_mem_rsv \
++ node_offset_by_prop_value node_offset_by_phandle \
++ node_check_compatible node_offset_by_compatible \
++ get_alias \
+++ char_literal \
++ notfound \
++ setprop_inplace nop_property nop_node \
++ sw_tree1 \
++diff --git a/tests/char_literal.c b/tests/char_literal.c
++new file mode 100644
++index 0000000..150f2a0
++--- /dev/null
+++++ b/tests/char_literal.c
++@@ -0,0 +1,50 @@
+++/*
+++ * libfdt - Flat Device Tree manipulation
+++ * Testcase for character literals in dtc
+++ * Copyright (C) 2006 David Gibson, IBM Corporation.
+++ * Copyright (C) 2011 The Chromium Authors. All rights reserved.
+++ *
+++ * 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 <stdint.h>
+++
+++#include <fdt.h>
+++#include <libfdt.h>
+++
+++#include "tests.h"
+++#include "testdata.h"
+++
+++int main(int argc, char *argv[])
+++{
+++ void *fdt;
+++ uint32_t expected_cells[5];
+++
+++ expected_cells[0] = cpu_to_fdt32((unsigned char)TEST_CHAR1);
+++ expected_cells[1] = cpu_to_fdt32((unsigned char)TEST_CHAR2);
+++ expected_cells[2] = cpu_to_fdt32((unsigned char)TEST_CHAR3);
+++ expected_cells[3] = cpu_to_fdt32((unsigned char)TEST_CHAR4);
+++ expected_cells[4] = cpu_to_fdt32((unsigned char)TEST_CHAR5);
+++
+++ test_init(argc, argv);
+++ fdt = load_blob_arg(argc, argv);
+++
+++ check_getprop(fdt, 0, "char-literal-cells",
+++ sizeof(expected_cells), expected_cells);
+++
+++ PASS();
+++}
++diff --git a/tests/char_literal.dts b/tests/char_literal.dts
++new file mode 100644
++index 0000000..22e17ed
++--- /dev/null
+++++ b/tests/char_literal.dts
++@@ -0,0 +1,5 @@
+++/dts-v1/;
+++
+++/ {
+++ char-literal-cells = <'\r' 'b' '\0' '\'' '\xff'>;
+++};
++diff --git a/tests/run_tests.sh b/tests/run_tests.sh
++index 72dda32..1246df1 100755
++--- a/tests/run_tests.sh
+++++ b/tests/run_tests.sh
++@@ -206,6 +206,9 @@ dtc_tests () {
++ run_dtc_test -I dts -O dtb -o dtc_escapes.test.dtb escapes.dts
++ run_test string_escapes dtc_escapes.test.dtb
++
+++ run_dtc_test -I dts -O dtb -o dtc_char_literal.test.dtb char_literal.dts
+++ run_test char_literal dtc_char_literal.test.dtb
+++
++ run_dtc_test -I dts -O dtb -o dtc_extra-terminating-null.test.dtb extra-terminating-null.dts
++ run_test extra-terminating-null dtc_extra-terminating-null.test.dtb
++
++diff --git a/tests/testdata.h b/tests/testdata.h
++index 5b5a9a3..d4c6759 100644
++--- a/tests/testdata.h
+++++ b/tests/testdata.h
++@@ -19,6 +19,12 @@
++ #define TEST_STRING_2 "nastystring: \a\b\t\n\v\f\r\\\""
++ #define TEST_STRING_3 "\xde\xad\xbe\xef"
++
+++#define TEST_CHAR1 '\r'
+++#define TEST_CHAR2 'b'
+++#define TEST_CHAR3 '\0'
+++#define TEST_CHAR4 '\''
+++#define TEST_CHAR5 '\xff'
+++
++ #ifndef __ASSEMBLY__
++ extern struct fdt_header _test_tree1;
++ extern struct fdt_header _truncated_property;
diff --combined debian/patches/09_Create-Makefile_utils-and-move-ftdump-into-it.patch
index 0000000,0000000..4d47f94
new file mode 100644
--- /dev/null
+++ b/debian/patches/09_Create-Makefile_utils-and-move-ftdump-into-it.patch
@@@ -1,0 -1,0 +1,62 @@@
++From: Simon Glass <sjg at chromium.org>
++Date: Wed, 21 Sep 2011 20:32:44 +0000 (-0700)
++Subject: Create Makefile.utils and move ftdump into it
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=9ebd9b4a56e54656431111e5ea7cd74e651910bf
++
++Create Makefile.utils and move ftdump into it
++
++We want to avoid a separate Makefile include for each utility, so this sets
++up a general one for utilities.
++
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++Signed-off-by: Simon Glass <sjg at chromium.org>
++---
++
++diff --git a/Makefile b/Makefile
++index 2172d9a..380a705 100644
++--- a/Makefile
+++++ b/Makefile
++@@ -105,7 +105,7 @@ endef
++
++ include Makefile.convert-dtsv0
++ include Makefile.dtc
++-include Makefile.ftdump
+++include Makefile.utils
++
++ BIN += convert-dtsv0
++ BIN += dtc
++diff --git a/Makefile.ftdump b/Makefile.ftdump
++deleted file mode 100644
++index 2744a18..0000000
++--- a/Makefile.ftdump
+++++ /dev/null
++@@ -1,13 +0,0 @@
++-#
++-# This is not a complete Makefile of itself.
++-# Instead, it is designed to be easily embeddable
++-# into other systems of Makefiles.
++-#
++-
++-FTDUMP_SRCS = \
++- ftdump.c \
++- util.c
++-
++-FTDUMP_GEN_SRCS =
++-
++-FTDUMP_OBJS = $(FTDUMP_SRCS:%.c=%.o) $(FTDUMP_GEN_SRCS:%.c=%.o)
++diff --git a/Makefile.utils b/Makefile.utils
++new file mode 100644
++index 0000000..0ed9297
++--- /dev/null
+++++ b/Makefile.utils
++@@ -0,0 +1,10 @@
+++#
+++# This is not a complete Makefile of itself. Instead, it is designed to
+++# be easily embeddable into other systems of Makefiles.
+++#
+++
+++FTDUMP_SRCS = \
+++ ftdump.c \
+++ util.c
+++
+++FTDUMP_OBJS = $(FTDUMP_SRCS:%.c=%.o)
diff --combined debian/patches/10_Add-fdt-read_write-utility-functions.patch
index 0000000,0000000..bdfcb24
new file mode 100644
--- /dev/null
+++ b/debian/patches/10_Add-fdt-read_write-utility-functions.patch
@@@ -1,0 -1,0 +1,502 @@@
++From: Simon Glass <sjg at chromium.org>
++Date: Thu, 22 Sep 2011 17:11:02 +0000 (-0700)
++Subject: Add fdt read/write utility functions
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=36204fdf742cabc074617648a5b2cf62409dc40b
++
++Add fdt read/write utility functions
++
++This adds higher-level libfdt operations for reading/writing an fdt
++blob from/to a file, as well as a function to decode a data type string
++as will be used by fdtget, fdtput.
++
++This also adds a few tests for the simple type argument supported by
++utilfdt_decode_type.
++
++Signed-off-by: Simon Glass <sjg at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/Makefile b/Makefile
++index 380a705..b32409b 100644
++--- a/Makefile
+++++ b/Makefile
++@@ -15,7 +15,7 @@ EXTRAVERSION =
++ LOCAL_VERSION =
++ CONFIG_LOCALVERSION =
++
++-CPPFLAGS = -I libfdt
+++CPPFLAGS = -I libfdt -I .
++ WARNINGS = -Werror -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
++ -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls
++ CFLAGS = -g -Os -fPIC -Werror $(WARNINGS)
++diff --git a/tests/Makefile.tests b/tests/Makefile.tests
++index e718b63..41695df 100644
++--- a/tests/Makefile.tests
+++++ b/tests/Makefile.tests
++@@ -16,7 +16,8 @@ LIB_TESTS_L = get_mem_rsv \
++ extra-terminating-null \
++ dtbs_equal_ordered \
++ dtb_reverse dtbs_equal_unordered \
++- add_subnode_with_nops path_offset_aliases
+++ add_subnode_with_nops path_offset_aliases \
+++ utilfdt_test
++ LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
++
++ LIBTREE_TESTS_L = truncated_property
++@@ -42,7 +43,7 @@ TESTS_CLEANFILES = $(TESTS) $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
++ .PHONY: tests
++ tests: $(TESTS) $(TESTS_TREES)
++
++-$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o $(LIBFDT_archive)
+++$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive)
++
++ $(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o $(LIBFDT_archive)
++ @$(VECHO) LD [libdl] $@
++diff --git a/tests/run_tests.sh b/tests/run_tests.sh
++index 1246df1..e2c3046 100755
++--- a/tests/run_tests.sh
+++++ b/tests/run_tests.sh
++@@ -391,6 +391,10 @@ dtbs_equal_tests () {
++ cmp_tests test_tree1.dtb $WRONG_TREE1
++ }
++
+++utilfdt_tests () {
+++ run_test utilfdt_test
+++}
+++
++ while getopts "vt:m" ARG ; do
++ case $ARG in
++ "v")
++@@ -406,7 +410,7 @@ while getopts "vt:m" ARG ; do
++ done
++
++ if [ -z "$TESTSETS" ]; then
++- TESTSETS="libfdt dtc dtbs_equal"
+++ TESTSETS="libfdt utilfdt dtc dtbs_equal"
++ fi
++
++ # Make sure we don't have stale blobs lying around
++@@ -417,6 +421,9 @@ for set in $TESTSETS; do
++ "libfdt")
++ libfdt_tests
++ ;;
+++ "utilfdt")
+++ utilfdt_tests
+++ ;;
++ "dtc")
++ dtc_tests
++ ;;
++diff --git a/tests/tests.h b/tests/tests.h
++index fcb2b2a..a51556d 100644
++--- a/tests/tests.h
+++++ b/tests/tests.h
++@@ -93,22 +93,6 @@ void cleanup(void);
++ exit(RC_BUG); \
++ } while (0)
++
++-static inline void *xmalloc(size_t size)
++-{
++- void *p = malloc(size);
++- if (! p)
++- FAIL("malloc() failure");
++- return p;
++-}
++-
++-static inline void *xrealloc(void *p, size_t size)
++-{
++- p = realloc(p, size);
++- if (! p)
++- FAIL("realloc() failure");
++- return p;
++-}
++-
++ void check_mem_rsv(void *fdt, int n, uint64_t addr, uint64_t size);
++
++ void check_property(void *fdt, int nodeoffset, const char *name,
++@@ -135,4 +119,6 @@ void *load_blob_arg(int argc, char *argv[]);
++ void save_blob(const char *filename, void *blob);
++ void *open_blob_rw(void *blob);
++
+++#include "util.h"
+++
++ #endif /* _TESTS_H */
++diff --git a/tests/utilfdt_test.c b/tests/utilfdt_test.c
++new file mode 100644
++index 0000000..36b4aa5
++--- /dev/null
+++++ b/tests/utilfdt_test.c
++@@ -0,0 +1,128 @@
+++/*
+++ * Copyright 2011 The Chromium Authors, All Rights Reserved.
+++ *
+++ * utilfdt_test - Tests for utilfdt library
+++ *
+++ * 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 <assert.h>
+++#include <stdlib.h>
+++#include <stdio.h>
+++#include <string.h>
+++#include <stdint.h>
+++#include <stdarg.h>
+++
+++#include <fdt.h>
+++#include <libfdt.h>
+++#include <util.h>
+++
+++#include "tests.h"
+++#include "testdata.h"
+++
+++static void check(const char *fmt, int expect_type, int expect_size)
+++{
+++ int type;
+++ int size;
+++
+++ if (utilfdt_decode_type(fmt, &type, &size))
+++ FAIL("format '%s': valid format string returned failure", fmt);
+++ if (expect_type != type)
+++ FAIL("format '%s': expected type='%c', got type='%c'", fmt,
+++ expect_type, type);
+++ if (expect_size != size)
+++ FAIL("format '%s': expected size=%d, got size=%d", fmt,
+++ expect_size, size);
+++}
+++
+++static void checkfail(const char *fmt)
+++{
+++ int type;
+++ int size;
+++
+++ if (!utilfdt_decode_type(fmt, &type, &size))
+++ FAIL("format '%s': invalid format string returned success",
+++ fmt);
+++}
+++
+++/**
+++ * Add the given modifier to each of the valid sizes, and check that we get
+++ * correct values.
+++ *
+++ * \param modifier Modifer string to use as a prefix
+++ * \param expected_size The size (in bytes) that we expect (ignored for
+++ * strings)
+++ */
+++static void check_sizes(char *modifier, int expected_size)
+++{
+++ char fmt[10], *ptr;
+++
+++ /* set up a string with a hole in it for the format character */
+++ if (strlen(modifier) + 2 >= sizeof(fmt))
+++ FAIL("modifier string '%s' too long", modifier);
+++ strcpy(fmt, modifier);
+++ ptr = fmt + strlen(fmt);
+++ ptr[1] = '\0';
+++
+++ /* now try each format character in turn */
+++ *ptr = 'i';
+++ check(fmt, 'i', expected_size);
+++
+++ *ptr = 'u';
+++ check(fmt, 'u', expected_size);
+++
+++ *ptr = 'x';
+++ check(fmt, 'x', expected_size);
+++
+++ *ptr = 's';
+++ check(fmt, 's', -1);
+++}
+++
+++static void test_utilfdt_decode_type(void)
+++{
+++ char fmt[10];
+++ int ch;
+++
+++ /* check all the valid modifiers and sizes */
+++ check_sizes("", -1);
+++ check_sizes("b", 1);
+++ check_sizes("hh", 1);
+++ check_sizes("h", 2);
+++ check_sizes("l", 4);
+++
+++ /* try every other character */
+++ checkfail("");
+++ for (ch = ' '; ch < 127; ch++) {
+++ if (!strchr("iuxs", ch)) {
+++ *fmt = ch;
+++ fmt[1] = '\0';
+++ checkfail(fmt);
+++ }
+++ }
+++
+++ /* try a few modifiers at the end */
+++ checkfail("sx");
+++ checkfail("ihh");
+++ checkfail("xb");
+++
+++ /* and one for the doomsday archives */
+++ checkfail("He has all the virtues I dislike and none of the vices "
+++ "I admire.");
+++}
+++
+++int main(int argc, char *argv[])
+++{
+++ test_utilfdt_decode_type();
+++ PASS();
+++}
++diff --git a/util.c b/util.c
++index 6d07292..d82d41f 100644
++--- a/util.c
+++++ b/util.c
++@@ -1,4 +1,5 @@
++ /*
+++ * Copyright 2011 The Chromium Authors, All Rights Reserved.
++ * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
++ *
++ * util_is_printable_string contributed by
++@@ -27,6 +28,11 @@
++ #include <string.h>
++ #include <assert.h>
++
+++#include <errno.h>
+++#include <fcntl.h>
+++#include <unistd.h>
+++
+++#include "libfdt.h"
++ #include "util.h"
++
++ char *xstrdup(const char *s)
++@@ -184,3 +190,139 @@ char get_escape_char(const char *s, int *i)
++ (*i) = j;
++ return val;
++ }
+++
+++int utilfdt_read_err(const char *filename, char **buffp)
+++{
+++ int fd = 0; /* assume stdin */
+++ char *buf = NULL;
+++ off_t bufsize = 1024, offset = 0;
+++ int ret = 0;
+++
+++ *buffp = NULL;
+++ if (strcmp(filename, "-") != 0) {
+++ fd = open(filename, O_RDONLY);
+++ if (fd < 0)
+++ return errno;
+++ }
+++
+++ /* Loop until we have read everything */
+++ buf = malloc(bufsize);
+++ do {
+++ /* Expand the buffer to hold the next chunk */
+++ if (offset == bufsize) {
+++ bufsize *= 2;
+++ buf = realloc(buf, bufsize);
+++ if (!buf) {
+++ ret = ENOMEM;
+++ break;
+++ }
+++ }
+++
+++ ret = read(fd, &buf[offset], bufsize - offset);
+++ if (ret < 0) {
+++ ret = errno;
+++ break;
+++ }
+++ offset += ret;
+++ } while (ret != 0);
+++
+++ /* Clean up, including closing stdin; return errno on error */
+++ close(fd);
+++ if (ret)
+++ free(buf);
+++ else
+++ *buffp = buf;
+++ return ret;
+++}
+++
+++char *utilfdt_read(const char *filename)
+++{
+++ char *buff;
+++ int ret = utilfdt_read_err(filename, &buff);
+++
+++ if (ret) {
+++ fprintf(stderr, "Couldn't open blob from '%s': %s\n", filename,
+++ strerror(ret));
+++ return NULL;
+++ }
+++ /* Successful read */
+++ return buff;
+++}
+++
+++int utilfdt_write_err(const char *filename, const void *blob)
+++{
+++ int fd = 1; /* assume stdout */
+++ int totalsize;
+++ int offset;
+++ int ret = 0;
+++ const char *ptr = blob;
+++
+++ if (strcmp(filename, "-") != 0) {
+++ fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+++ if (fd < 0)
+++ return errno;
+++ }
+++
+++ totalsize = fdt_totalsize(blob);
+++ offset = 0;
+++
+++ while (offset < totalsize) {
+++ ret = write(fd, ptr + offset, totalsize - offset);
+++ if (ret < 0) {
+++ ret = -errno;
+++ break;
+++ }
+++ offset += ret;
+++ }
+++ /* Close the file/stdin; return errno on error */
+++ if (fd != 1)
+++ close(fd);
+++ return ret < 0 ? -ret : 0;
+++}
+++
+++
+++int utilfdt_write(const char *filename, const void *blob)
+++{
+++ int ret = utilfdt_write_err(filename, blob);
+++
+++ if (ret) {
+++ fprintf(stderr, "Couldn't write blob to '%s': %s\n", filename,
+++ strerror(ret));
+++ }
+++ return ret ? -1 : 0;
+++}
+++
+++int utilfdt_decode_type(const char *fmt, int *type, int *size)
+++{
+++ int qualifier = 0;
+++
+++ /* get the conversion qualifier */
+++ *size = -1;
+++ if (strchr("hlLb", *fmt)) {
+++ qualifier = *fmt++;
+++ if (qualifier == *fmt) {
+++ switch (*fmt++) {
+++/* TODO: case 'l': qualifier = 'L'; break;*/
+++ case 'h':
+++ qualifier = 'b';
+++ break;
+++ }
+++ }
+++ }
+++
+++ /* we should now have a type */
+++ if (!strchr("iuxs", *fmt))
+++ return -1;
+++
+++ /* convert qualifier (bhL) to byte size */
+++ if (*fmt != 's')
+++ *size = qualifier == 'b' ? 1 :
+++ qualifier == 'h' ? 2 :
+++ qualifier == 'l' ? 4 : -1;
+++ *type = *fmt++;
+++
+++ /* that should be it! */
+++ if (*fmt)
+++ return -1;
+++ return 0;
+++}
++diff --git a/util.h b/util.h
++index f251480..730918e 100644
++--- a/util.h
+++++ b/util.h
++@@ -4,6 +4,7 @@
++ #include <stdarg.h>
++
++ /*
+++ * Copyright 2011 The Chromium Authors, All Rights Reserved.
++ * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
++ *
++ * This program is free software; you can redistribute it and/or
++@@ -72,4 +73,71 @@ int util_is_printable_string(const void *data, int len);
++ */
++ char get_escape_char(const char *s, int *i);
++
+++/**
+++ * Read a device tree file into a buffer. This will report any errors on
+++ * stderr.
+++ *
+++ * @param filename The filename to read, or - for stdin
+++ * @return Pointer to allocated buffer containing fdt, or NULL on error
+++ */
+++char *utilfdt_read(const char *filename);
+++
+++/**
+++ * Read a device tree file into a buffer. Does not report errors, but only
+++ * returns them. The value returned can be passed to strerror() to obtain
+++ * an error message for the user.
+++ *
+++ * @param filename The filename to read, or - for stdin
+++ * @param buffp Returns pointer to buffer containing fdt
+++ * @return 0 if ok, else an errno value representing the error
+++ */
+++int utilfdt_read_err(const char *filename, char **buffp);
+++
+++
+++/**
+++ * Write a device tree buffer to a file. This will report any errors on
+++ * stderr.
+++ *
+++ * @param filename The filename to write, or - for stdout
+++ * @param blob Poiner to buffer containing fdt
+++ * @return 0 if ok, -1 on error
+++ */
+++int utilfdt_write(const char *filename, const void *blob);
+++
+++/**
+++ * Write a device tree buffer to a file. Does not report errors, but only
+++ * returns them. The value returned can be passed to strerror() to obtain
+++ * an error message for the user.
+++ *
+++ * @param filename The filename to write, or - for stdout
+++ * @param blob Poiner to buffer containing fdt
+++ * @return 0 if ok, else an errno value representing the error
+++ */
+++int utilfdt_write_err(const char *filename, const void *blob);
+++
+++/**
+++ * Decode a data type string. The purpose of this string
+++ *
+++ * The string consists of an optional character followed by the type:
+++ * Modifier characters:
+++ * hh or b 1 byte
+++ * h 2 byte
+++ * l 4 byte, default
+++ *
+++ * Type character:
+++ * s string
+++ * i signed integer
+++ * u unsigned integer
+++ * x hex
+++ *
+++ * TODO: Implement ll modifier (8 bytes)
+++ * TODO: Implement o type (octal)
+++ *
+++ * @param fmt Format string to process
+++ * @param type Returns type found(s/d/u/x), or 0 if none
+++ * @param size Returns size found(1,2,4,8) or 4 if none
+++ * @return 0 if ok, -1 on error (no type given, or other invalid format)
+++ */
+++int utilfdt_decode_type(const char *fmt, int *type, int *size);
+++
++ #endif /* _UTIL_H */
diff --combined debian/patches/11_Make-testutils-use-utilfdt.patch
index 0000000,0000000..f738479
new file mode 100644
--- /dev/null
+++ b/debian/patches/11_Make-testutils-use-utilfdt.patch
@@@ -1,0 -1,0 +1,111 @@@
++From: Simon Glass <sjg at chromium.org>
++Date: Thu, 22 Sep 2011 17:11:03 +0000 (-0700)
++Subject: Make testutils use utilfdt
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=1c25c0d520dee58bfd86626a07036fe9febfebe6
++
++Make testutils use utilfdt
++
++The load_blob() and save_blob() functions are very similar to the utilfdt
++versions. This removes the duplicated code.
++
++Signed-off-by: Simon Glass <sjg at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/tests/Makefile.tests b/tests/Makefile.tests
++index 41695df..cae8390 100644
++--- a/tests/Makefile.tests
+++++ b/tests/Makefile.tests
++@@ -45,11 +45,12 @@ tests: $(TESTS) $(TESTS_TREES)
++
++ $(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive)
++
++-$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o $(LIBFDT_archive)
+++$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive)
++ @$(VECHO) LD [libdl] $@
++ $(LINK.c) -o $@ $^ -ldl
++
++-$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o $(LIBFDT_archive)
+++$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \
+++ util.o $(LIBFDT_archive)
++
++ $(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o
++
++diff --git a/tests/testutils.c b/tests/testutils.c
++index b0a2230..f185133 100644
++--- a/tests/testutils.c
+++++ b/tests/testutils.c
++@@ -159,33 +159,13 @@ int nodename_eq(const char *s1, const char *s2)
++
++ void *load_blob(const char *filename)
++ {
++- int fd;
++- int offset = 0;
++- int bufsize = 1024;
++- char *p = NULL;
++- int ret;
++-
++- fd = open(filename, O_RDONLY);
++- if (fd < 0)
++- CONFIG("Couldn't open blob from \"%s\": %s", filename,
++- strerror(errno));
++-
++- p = xmalloc(bufsize);
++- do {
++- if (offset == bufsize) {
++- bufsize *= 2;
++- p = xrealloc(p, bufsize);
++- }
++-
++- ret = read(fd, &p[offset], bufsize - offset);
++- if (ret < 0)
++- CONFIG("Couldn't read from \"%s\": %s", filename,
++- strerror(errno));
++-
++- offset += ret;
++- } while (ret != 0);
+++ char *blob;
+++ int ret = utilfdt_read_err(filename, &blob);
++
++- return p;
+++ if (ret)
+++ CONFIG("Couldn't open blob from \"%s\": %s", filename,
+++ strerror(ret));
+++ return blob;
++ }
++
++ void *load_blob_arg(int argc, char *argv[])
++@@ -197,28 +177,11 @@ void *load_blob_arg(int argc, char *argv[])
++
++ void save_blob(const char *filename, void *fdt)
++ {
++- int fd;
++- int totalsize;
++- int offset;
++- char *p;
++- int ret;
++-
++- fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
++- if (fd < 0)
++- CONFIG("Couldn't open \"%s\" to write blob: %s", filename,
++- strerror(errno));
++-
++- totalsize = fdt_totalsize(fdt);
++- offset = 0;
++- p = fdt;
++-
++- while (offset < totalsize) {
++- ret = write(fd, p + offset, totalsize - offset);
++- if (ret < 0)
++- CONFIG("Couldn't write to \"%s\": %s", filename,
++- strerror(errno));
++- offset += ret;
++- }
+++ int ret = utilfdt_write_err(filename, fdt);
+++
+++ if (ret)
+++ CONFIG("Couldn't write blob to \"%s\": %s", filename,
+++ strerror(ret));
++ }
++
++ void *open_blob_rw(void *blob)
diff --combined debian/patches/12_use-utilfdt-to-read-blob.patch
index 0000000,0000000..dc425d4
new file mode 100644
--- /dev/null
+++ b/debian/patches/12_use-utilfdt-to-read-blob.patch
@@@ -1,0 -1,0 +1,71 @@@
++From: Simon Glass <sjg at chromium.org>
++Date: Thu, 22 Sep 2011 17:11:04 +0000 (-0700)
++Subject: ftdump: use utilfdt to read blob
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=07a8691fbbeb2a7e0cff85fb24435e2dc71facaf
++
++ftdump: use utilfdt to read blob
++
++Now that we have utilfdt_read(), ftdump should use it too.
++
++Signed-off-by: Simon Glass <sjg at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/ftdump.c b/ftdump.c
++index db932e3..cc55fe2 100644
++--- a/ftdump.c
+++++ b/ftdump.c
++@@ -13,8 +13,6 @@
++
++ #include "util.h"
++
++-#define FTDUMP_BUF_SIZE 65536
++-
++ #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)))
++@@ -147,40 +145,18 @@ static void dump_blob(void *blob)
++
++ int main(int argc, char *argv[])
++ {
++- FILE *fp;
++ char *buf;
++- int size;
++
++ if (argc < 2) {
++ fprintf(stderr, "supply input filename\n");
++ return 5;
++ }
++
++- if (strcmp(argv[1], "-") == 0) {
++- fp = stdin;
++- } else {
++- fp = fopen(argv[1], "rb");
++- if (fp == NULL) {
++- fprintf(stderr, "unable to open %s\n", argv[1]);
++- return 10;
++- }
++- }
++-
++- buf = malloc(FTDUMP_BUF_SIZE);
++- if (!buf) {
++- fprintf(stderr, "Couldn't allocate %d byte buffer\n", FTDUMP_BUF_SIZE);
+++ buf = utilfdt_read(argv[1]);
+++ if (buf)
+++ dump_blob(buf);
+++ else
++ return 10;
++- }
++-
++- size = fread(buf, 1, FTDUMP_BUF_SIZE, fp);
++- if (size == FTDUMP_BUF_SIZE) {
++- fprintf(stderr, "file too large (maximum is %d bytes)\n", FTDUMP_BUF_SIZE);
++- return 10;
++- }
++-
++- dump_blob(buf);
++-
++- fclose(fp);
++
++ return 0;
++ }
diff --combined debian/patches/13_Add-fdt16_to_cpu-utility-function.patch
index 0000000,0000000..c1deefc
new file mode 100644
--- /dev/null
+++ b/debian/patches/13_Add-fdt16_to_cpu-utility-function.patch
@@@ -1,0 -1,0 +1,32 @@@
++From: Anton Staaf <robotboy at chromium.org>
++Date: Tue, 11 Oct 2011 17:22:27 +0000 (-0700)
++Subject: libfdt: Add fdt16_to_cpu utility function
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=2cd4c8d27d6b5ea83723754da4eba5d51aa71b95
++
++libfdt: Add fdt16_to_cpu utility function
++
++This utility routine will be used in the variable size cell literal
++append code. It is a straightforward adaptation of the fdt32_to_cpu
++function.
++
++Signed-off-by: Anton Staaf <robotboy at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/libfdt/libfdt_env.h b/libfdt/libfdt_env.h
++index 449bf60..da952e7 100644
++--- a/libfdt/libfdt_env.h
+++++ b/libfdt/libfdt_env.h
++@@ -6,6 +6,12 @@
++ #include <string.h>
++
++ #define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
+++static inline uint16_t fdt16_to_cpu(uint16_t x)
+++{
+++ return (_B(0) << 8) | _B(1);
+++}
+++#define cpu_to_fdt16(x) fdt16_to_cpu(x)
+++
++ static inline uint32_t fdt32_to_cpu(uint32_t x)
++ {
++ return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
diff --combined debian/patches/14_Add-data_append_integer-function.patch
index 0000000,0000000..b5a34b6
new file mode 100644
--- /dev/null
+++ b/debian/patches/14_Add-data_append_integer-function.patch
@@@ -1,0 -1,0 +1,91 @@@
++From: Anton Staaf <robotboy at chromium.org>
++Date: Tue, 11 Oct 2011 17:22:28 +0000 (-0700)
++Subject: dtc: Add data_append_integer function
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=a4b515c03804dbc0eff5bbf281bd22438717e773
++
++dtc: Add data_append_integer function
++
++This function deals with appending integers of various sizes (8, 16
++32, and 64 bit currently). It handles endianess conversions. If the
++integer will not fit in the requested number of bits of storage it
++will have it's high bits ignored.
++
++This patch also rewrites data_append_cell and data_append_addr to use
++data_append_integer.
++
++Signed-off-by: Anton Staaf <robotboy at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/data.c b/data.c
++index b5f3066..4a40c5b 100644
++--- a/data.c
+++++ b/data.c
++@@ -168,11 +168,33 @@ struct data data_merge(struct data d1, struct data d2)
++ return d;
++ }
++
++-struct data data_append_cell(struct data d, cell_t word)
+++struct data data_append_integer(struct data d, uint64_t value, int bits)
++ {
++- cell_t beword = cpu_to_fdt32(word);
++-
++- return data_append_data(d, &beword, sizeof(beword));
+++ uint8_t value_8;
+++ uint16_t value_16;
+++ uint32_t value_32;
+++ uint64_t value_64;
+++
+++ switch (bits) {
+++ case 8:
+++ value_8 = value;
+++ return data_append_data(d, &value_8, 1);
+++
+++ case 16:
+++ value_16 = cpu_to_fdt16(value);
+++ return data_append_data(d, &value_16, 2);
+++
+++ case 32:
+++ value_32 = cpu_to_fdt32(value);
+++ return data_append_data(d, &value_32, 4);
+++
+++ case 64:
+++ value_64 = cpu_to_fdt64(value);
+++ return data_append_data(d, &value_64, 8);
+++
+++ default:
+++ die("Invalid literal size (%d)\n", bits);
+++ }
++ }
++
++ struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
++@@ -185,11 +207,14 @@ struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
++ return data_append_data(d, &bere, sizeof(bere));
++ }
++
++-struct data data_append_addr(struct data d, uint64_t addr)
+++struct data data_append_cell(struct data d, cell_t word)
++ {
++- uint64_t beaddr = cpu_to_fdt64(addr);
+++ return data_append_integer(d, word, sizeof(word) * 8);
+++}
++
++- return data_append_data(d, &beaddr, sizeof(beaddr));
+++struct data data_append_addr(struct data d, uint64_t addr)
+++{
+++ return data_append_integer(d, addr, sizeof(addr) * 8);
++ }
++
++ struct data data_append_byte(struct data d, uint8_t byte)
++diff --git a/dtc.h b/dtc.h
++index f37c97e..7b4c65b 100644
++--- a/dtc.h
+++++ b/dtc.h
++@@ -109,6 +109,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m,
++ const void *p, int len);
++ struct data data_merge(struct data d1, struct data d2);
++ struct data data_append_cell(struct data d, cell_t word);
+++struct data data_append_integer(struct data d, uint64_t word, int bits);
++ struct data data_append_re(struct data d, const struct fdt_reserve_entry *re);
++ struct data data_append_addr(struct data d, uint64_t addr);
++ struct data data_append_byte(struct data d, uint8_t byte);
diff --combined debian/patches/15_Add-support-for-variable-sized-elements.patch
index 0000000,0000000..e0af000
new file mode 100644
--- /dev/null
+++ b/debian/patches/15_Add-support-for-variable-sized-elements.patch
@@@ -1,0 -1,0 +1,400 @@@
++From: Anton Staaf <robotboy at chromium.org>
++Date: Tue, 11 Oct 2011 17:22:29 +0000 (-0700)
++Subject: dtc: Add support for variable sized elements
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=033089f29099bdfd5c2d6986cdb9fd07b16cfde0
++
++dtc: Add support for variable sized elements
++
++Elements of size 8, 16, 32, and 64 bits are supported. The new
++/bits/ syntax was selected so as to not pollute the reserved
++keyword space with uint8/uint16/... type names.
++
++With this patch the following property assignment:
++
++ property = /bits/ 16 <0x1234 0x5678 0x0 0xffff>;
++
++is equivalent to:
++
++ property = <0x12345678 0x0000ffff>;
++
++It is now also possible to directly specify a 64 bit literal in a
++cell list, also known as an array using:
++
++ property = /bits/ 64 <0xdeadbeef00000000>;
++
++It is an error to attempt to store a literal into an element that is
++too small to hold the literal, and the compiler will generate an
++error when it detects this. For instance:
++
++ property = /bits/ 8 <256>;
++
++Will fail to compile. It is also an error to attempt to place a
++reference in a non 32-bit element.
++
++The documentation has been changed to reflect that the cell list
++is now an array of elements that can be of sizes other than the
++default 32-bit cell size.
++
++The sized_cells test tests the creation and access of 8, 16, 32,
++and 64-bit sized elements. It also tests that the creation of two
++properties, one with 16 bit elements and one with 32 bit elements
++result in the same property contents.
++
++Signed-off-by: Anton Staaf <robotboy at chromium.org>
++Acked-by: David Gibson <david at gibson.dropbear.id.au>
++---
++
++diff --git a/Documentation/dts-format.txt b/Documentation/dts-format.txt
++index eae8b76..41741df 100644
++--- a/Documentation/dts-format.txt
+++++ b/Documentation/dts-format.txt
++@@ -29,18 +29,28 @@ except for properties with empty (zero length) value which have the
++ form:
++ [label:] property-name;
++
++-Property values may be defined as an array of 32-bit integer cells, as
++-NUL-terminated strings, as bytestrings or a combination of these.
+++Property values may be defined as an array of 8, 16, 32, or 64-bit integer
+++elements, as NUL-terminated strings, as bytestrings or a combination of these.
++
++-* Arrays of cells are represented by angle brackets surrounding a
++- space separated list of C-style integers or character literals.
+++* Arrays are represented by angle brackets surrounding a space separated list
+++ of C-style integers or character literals. Array elements default to 32-bits
+++ in size. An array of 32-bit elements is also known as a cell list or a list
+++ of cells. A cell being an unsigned 32-bit integer.
++
++ e.g. interrupts = <17 0xc>;
++
++-* A 64-bit value is represented with two 32-bit cells.
+++* A 64-bit value can be represented with two 32-bit elements.
++
++ e.g. clock-frequency = <0x00000001 0x00000000>;
++
+++* The storage size of an element can be changed using the /bits/ prefix. The
+++ /bits/ prefix allows for the creation of 8, 16, 32, and 64-bit elements.
+++ The resulting array will not be padded to a multiple of the default 32-bit
+++ element size.
+++
+++ e.g. interrupts = /bits/ 8 <17 0xc>;
+++ e.g. clock-frequency = /bits/ 64 <0x0000000100000000>;
+++
++ * A NUL-terminated string value is represented using double quotes
++ (the property value is considered to include the terminating NUL
++ character).
++@@ -59,19 +69,20 @@ NUL-terminated strings, as bytestrings or a combination of these.
++ e.g. compatible = "ns16550", "ns8250";
++ example = <0xf00f0000 19>, "a strange property format";
++
++-* In a cell array a reference to another node will be expanded to that
++- node's phandle. References may by '&' followed by a node's label:
+++* In an array a reference to another node will be expanded to that node's
+++ phandle. References may by '&' followed by a node's label:
++ e.g. interrupt-parent = < &mpic >;
++ or they may be '&' followed by a node's full path in braces:
++ e.g. interrupt-parent = < &{/soc/interrupt-controller at 40000} >;
+++ References are only permitted in arrays that have an element size of
+++ 32-bits.
++
++-* Outside a cell array, a reference to another node will be expanded
++- to that node's full path.
+++* Outside an array, a reference to another node will be expanded to that
+++ node's full path.
++ e.g. ethernet0 = &EMAC0;
++
++ * Labels may also appear before or after any component of a property
++- value, or between cells of a cell array, or between bytes of a
++- bytestring.
+++ value, or between elements of an array, or between bytes of a bytestring.
++ e.g. reg = reglabel: <0 sizelabel: 0x1000000>;
++ e.g. prop = [ab cd ef byte4: 00 ff fe];
++ e.g. str = start: "string value" end: ;
++@@ -108,3 +119,4 @@ Version 1 DTS files have the overall layout:
++
++ -- David Gibson <david at gibson.dropbear.id.au>
++ -- Yoder Stuart <stuart.yoder at freescale.com>
+++ -- Anton Staaf <robotboy at chromium.org>
++diff --git a/dtc-lexer.l b/dtc-lexer.l
++index 494e342..73d190c 100644
++--- a/dtc-lexer.l
+++++ b/dtc-lexer.l
++@@ -97,6 +97,12 @@ static int pop_input_file(void);
++ return DT_MEMRESERVE;
++ }
++
+++<*>"/bits/" {
+++ DPRINT("Keyword: /bits/\n");
+++ BEGIN_DEFAULT();
+++ return DT_BITS;
+++ }
+++
++ <*>{LABEL}: {
++ DPRINT("Label: %s\n", yytext);
++ yylval.labelref = xstrdup(yytext);
++diff --git a/dtc-parser.y b/dtc-parser.y
++index 554f11a..348616b 100644
++--- a/dtc-parser.y
+++++ b/dtc-parser.y
++@@ -45,8 +45,12 @@ static unsigned char eval_char_literal(const char *s);
++ uint8_t byte;
++ struct data data;
++
+++ struct {
+++ struct data data;
+++ int bits;
+++ } array;
+++
++ uint64_t addr;
++- cell_t cell;
++ struct property *prop;
++ struct property *proplist;
++ struct node *node;
++@@ -56,6 +60,7 @@ static unsigned char eval_char_literal(const char *s);
++
++ %token DT_V1
++ %token DT_MEMRESERVE
+++%token DT_BITS
++ %token <propnodename> DT_PROPNODENAME
++ %token <literal> DT_LITERAL
++ %token <literal> DT_CHAR_LITERAL
++@@ -71,8 +76,7 @@ static unsigned char eval_char_literal(const char *s);
++ %type <re> memreserve
++ %type <re> memreserves
++ %type <addr> addr
++-%type <data> celllist
++-%type <cell> cellval
+++%type <array> arrayprefix
++ %type <data> bytestring
++ %type <prop> propdef
++ %type <proplist> proplist
++@@ -182,9 +186,9 @@ propdata:
++ {
++ $$ = data_merge($1, $2);
++ }
++- | propdataprefix '<' celllist '>'
+++ | propdataprefix arrayprefix '>'
++ {
++- $$ = data_merge($1, $3);
+++ $$ = data_merge($1, $2.data);
++ }
++ | propdataprefix '[' bytestring ']'
++ {
++@@ -242,34 +246,56 @@ propdataprefix:
++ }
++ ;
++
++-celllist:
++- /* empty */
+++arrayprefix:
+++ DT_BITS DT_LITERAL '<'
++ {
++- $$ = empty_data;
+++ $$.data = empty_data;
+++ $$.bits = eval_literal($2, 0, 7);
+++
+++ if (($$.bits != 8) &&
+++ ($$.bits != 16) &&
+++ ($$.bits != 32) &&
+++ ($$.bits != 64))
+++ {
+++ print_error("Only 8, 16, 32 and 64-bit elements"
+++ " are currently supported");
+++ $$.bits = 32;
+++ }
++ }
++- | celllist cellval
+++ | '<'
++ {
++- $$ = data_append_cell($1, $2);
+++ $$.data = empty_data;
+++ $$.bits = 32;
++ }
++- | celllist DT_REF
+++ | arrayprefix DT_LITERAL
++ {
++- $$ = data_append_cell(data_add_marker($1, REF_PHANDLE,
++- $2), -1);
+++ uint64_t val = eval_literal($2, 0, $1.bits);
+++
+++ $$.data = data_append_integer($1.data, val, $1.bits);
++ }
++- | celllist DT_LABEL
+++ | arrayprefix DT_CHAR_LITERAL
++ {
++- $$ = data_add_marker($1, LABEL, $2);
++- }
++- ;
+++ uint64_t val = eval_char_literal($2);
++
++-cellval:
++- DT_LITERAL
+++ $$.data = data_append_integer($1.data, val, $1.bits);
+++ }
+++ | arrayprefix DT_REF
++ {
++- $$ = eval_literal($1, 0, 32);
+++ uint64_t val = ~0ULL >> (64 - $1.bits);
+++
+++ if ($1.bits == 32)
+++ $1.data = data_add_marker($1.data,
+++ REF_PHANDLE,
+++ $2);
+++ else
+++ print_error("References are only allowed in "
+++ "arrays with 32-bit elements.");
+++
+++ $$.data = data_append_integer($1.data, val, $1.bits);
++ }
++- | DT_CHAR_LITERAL
+++ | arrayprefix DT_LABEL
++ {
++- $$ = eval_char_literal($1);
+++ $$.data = data_add_marker($1.data, LABEL, $2);
++ }
++ ;
++
++diff --git a/tests/.gitignore b/tests/.gitignore
++index a3e9bd1..9e062c3 100644
++--- a/tests/.gitignore
+++++ b/tests/.gitignore
++@@ -40,6 +40,7 @@
++ /set_name
++ /setprop
++ /setprop_inplace
+++/sized_cells
++ /string_escapes
++ /subnode_offset
++ /supernode_atdepth_offset
++diff --git a/tests/Makefile.tests b/tests/Makefile.tests
++index cae8390..215a8c5 100644
++--- a/tests/Makefile.tests
+++++ b/tests/Makefile.tests
++@@ -6,6 +6,7 @@ LIB_TESTS_L = get_mem_rsv \
++ node_check_compatible node_offset_by_compatible \
++ get_alias \
++ char_literal \
+++ sized_cells \
++ notfound \
++ setprop_inplace nop_property nop_node \
++ sw_tree1 \
++diff --git a/tests/run_tests.sh b/tests/run_tests.sh
++index e2c3046..da6f970 100755
++--- a/tests/run_tests.sh
+++++ b/tests/run_tests.sh
++@@ -209,6 +209,9 @@ dtc_tests () {
++ run_dtc_test -I dts -O dtb -o dtc_char_literal.test.dtb char_literal.dts
++ run_test char_literal dtc_char_literal.test.dtb
++
+++ run_dtc_test -I dts -O dtb -o dtc_sized_cells.test.dtb sized_cells.dts
+++ run_test sized_cells dtc_sized_cells.test.dtb
+++
++ run_dtc_test -I dts -O dtb -o dtc_extra-terminating-null.test.dtb extra-terminating-null.dts
++ run_test extra-terminating-null dtc_extra-terminating-null.test.dtb
++
++diff --git a/tests/sized_cells.c b/tests/sized_cells.c
++new file mode 100644
++index 0000000..847ec96
++--- /dev/null
+++++ b/tests/sized_cells.c
++@@ -0,0 +1,84 @@
+++/*
+++ * libfdt - Flat Device Tree manipulation
+++ * Testcase for variable sized cells in dtc
+++ * Copyright (C) 2006 David Gibson, IBM Corporation.
+++ * Copyright (C) 2011 The Chromium Authors. All rights reserved.
+++ *
+++ * 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 <stdint.h>
+++
+++#include <fdt.h>
+++#include <libfdt.h>
+++
+++#include "tests.h"
+++#include "testdata.h"
+++
+++static void check_compare_properties(void *fdt,
+++ char const *name_one,
+++ char const *name_two)
+++{
+++ const void *propval;
+++ int proplen;
+++
+++ propval = fdt_getprop(fdt, 0, name_one, &proplen);
+++
+++ if (!propval)
+++ FAIL("fdt_getprop(\"%s\"): %s",
+++ name_one,
+++ fdt_strerror(proplen));
+++
+++ check_getprop(fdt, 0, name_two, proplen, propval);
+++}
+++
+++int main(int argc, char *argv[])
+++{
+++ void *fdt;
+++ uint8_t expected_8[6] = {TEST_CHAR1,
+++ TEST_CHAR2,
+++ TEST_CHAR3,
+++ TEST_CHAR4,
+++ TEST_CHAR5,
+++ TEST_VALUE_1 >> 24};
+++ uint16_t expected_16[6];
+++ uint32_t expected_32[6];
+++ uint64_t expected_64[6];
+++ int i;
+++
+++ for (i = 0; i < 5; ++i) {
+++ expected_16[i] = cpu_to_fdt16(expected_8[i]);
+++ expected_32[i] = cpu_to_fdt32(expected_8[i]);
+++ expected_64[i] = cpu_to_fdt64(expected_8[i]);
+++ }
+++
+++ expected_16[5] = cpu_to_fdt16(TEST_VALUE_1 >> 16);
+++ expected_32[5] = cpu_to_fdt32(TEST_VALUE_1);
+++ expected_64[5] = cpu_to_fdt64(TEST_ADDR_1);
+++
+++ test_init(argc, argv);
+++ fdt = load_blob_arg(argc, argv);
+++
+++ check_getprop(fdt, 0, "cells-8b", sizeof(expected_8), expected_8);
+++ check_getprop(fdt, 0, "cells-16b", sizeof(expected_16), expected_16);
+++ check_getprop(fdt, 0, "cells-32b", sizeof(expected_32), expected_32);
+++ check_getprop(fdt, 0, "cells-64b", sizeof(expected_64), expected_64);
+++
+++ check_compare_properties(fdt, "cells-one-16b", "cells-one-32b");
+++
+++ PASS();
+++}
++diff --git a/tests/sized_cells.dts b/tests/sized_cells.dts
++new file mode 100644
++index 0000000..efea9f5
++--- /dev/null
+++++ b/tests/sized_cells.dts
++@@ -0,0 +1,11 @@
+++/dts-v1/;
+++
+++/ {
+++ cells-8b = /bits/ 8 <'\r' 'b' '\0' '\'' '\xff' 0xde>;
+++ cells-16b = /bits/ 16 <'\r' 'b' '\0' '\'' '\xff' 0xdead>;
+++ cells-32b = /bits/ 32 <'\r' 'b' '\0' '\'' '\xff' 0xdeadbeef>;
+++ cells-64b = /bits/ 64 <'\r' 'b' '\0' '\'' '\xff' 0xdeadbeef00000000>;
+++
+++ cells-one-16b = /bits/ 16 <0x1234 0x5678 0x0 0xffff>;
+++ cells-one-32b = <0x12345678 0x0000ffff>;
+++};
diff --combined debian/patches/16_fdtdump-rename-from-ftdump.patch
index 0000000,0000000..2c28768
new file mode 100644
--- /dev/null
+++ b/debian/patches/16_fdtdump-rename-from-ftdump.patch
@@@ -1,0 -1,0 +1,118 @@@
++From: Mike Frysinger <vapier at gentoo.org>
++Date: Tue, 25 Oct 2011 21:29:24 +0000 (-0400)
++Subject: fdtdump: rename from ftdump
++X-Git-Url: http://git.jdl.com/gitweb/?p=dtc.git;a=commitdiff_plain;h=8f459c5d72673e1a3a119ac58a7eee56236fca73
++
++fdtdump: rename from ftdump
++
++The freetype package already installs a binary named "ftdump", so the dtc
++package conflicts with that. So rename the newer dtc tool to "fdtdump".
++This even makes a bit more sense:
++ ftdump: [F]lat device [T]ree [dump]
++ fdtdump: [F]lat [D]evice [T]ree [dump]
++
++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
++@@ -7,6 +7,6 @@
++ lex.yy.c
++ *.lex.c
++ /dtc
++-/ftdump
+++/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
++
++ IV - Utility Tools
++ 1) convert-dtsv0 -- Conversion to Version 1
++- 1) ftdump
+++ 1) fdtdump
++
++
++ I - "dtc", the device tree compiler
++@@ -643,10 +643,10 @@ a new file with a "v1" appended the filename.
++ Comments, empty lines, etc. are preserved.
++
++
++-2) ftdump -- Flat Tree dumping utility
+++2) fdtdump -- Flat Device Tree dumping utility
++
++-The ftdump program prints a readable version of a flat device tree file.
+++The fdtdump program prints a readable version of a flat device tree file.
++
++-The syntax of the ftdump command line is:
+++The syntax of the fdtdump command line is:
++
++- 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
++
++ BIN += convert-dtsv0
++ BIN += dtc
++-BIN += ftdump
+++BIN += fdtdump
++
++ SCRIPTS = dtdiff
++
++@@ -119,7 +119,7 @@ all: $(BIN) libfdt
++ ifneq ($(DEPTARGETS),)
++ -include $(DTC_OBJS:%.o=%.d)
++ -include $(CONVERT_OBJS:%.o=%.d)
++--include $(FTDUMP_OBJS:%.o=%.d)
+++-include $(FDTDUMP_OBJS:%.o=%.d)
++ endif
++
++
++@@ -178,7 +178,7 @@ convert-dtsv0: $(CONVERT_OBJS)
++ @$(VECHO) LD $@
++ $(LINK.c) -o $@ $^
++
++-ftdump: $(FTDUMP_OBJS)
+++fdtdump: $(FDTDUMP_OBJS)
++
++
++ #
++diff --git a/Makefile.utils b/Makefile.utils
++index 0ed9297..fae5b00 100644
++--- a/Makefile.utils
+++++ b/Makefile.utils
++@@ -3,8 +3,8 @@
++ # be easily embeddable into other systems of Makefiles.
++ #
++
++-FTDUMP_SRCS = \
++- ftdump.c \
+++FDTDUMP_SRCS = \
+++ fdtdump.c \
++ util.c
++
++-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 @@
++ /*
++- * ftdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
+++ * fdtdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
++ */
++
++ #include <stdint.h>
diff --combined debian/patches/series
index 3870dc4,0000000..d692a6e
mode 100644,000000..100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@@ -1,1 -1,0 +1,16 @@@
- 01_build_doc.diff
++01_build_doc.patch
++02_remove-unused-check-variable.patch
++03_Remove-unused-variable-in-flat_read_mem_reserve.patch
++04_Split-out-is_printable_string-into-util.patch
++05_Add-missing-tests-to-gitignore.patch
++06_Refactor-character-literal-parsing-code.patch
++07_Remove-gcc-4.6-set-but-not-used-warnings.patch
++08_Support-character-literals-in-cell-lists.patch
++09_Create-Makefile_utils-and-move-ftdump-into-it.patch
++10_Add-fdt-read_write-utility-functions.patch
++11_Make-testutils-use-utilfdt.patch
++12_use-utilfdt-to-read-blob.patch
++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
diff --combined debian/rules
index 06a5659,0000000..2eba1c4
mode 100755,000000..100755
--- a/debian/rules
+++ b/debian/rules
@@@ -1,69 -1,0 +1,69 @@@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
- export CFLAGS = -Wall -g
++export CFLAGS = -Wall -g -fPIC
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
+ $(MAKE) CFLAGS="$(CFLAGS)"
+ $(MAKE) -C Documentation
+ touch build-stamp
+
+clean: clean1
+clean1:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp install-stamp
+ $(MAKE) clean
+ [ ! -f Documentation/Makefile ] || $(MAKE) -C Documentation clean
+ QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2
+ rm -rf .pc
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
- dh_clean -k
++ dh_prep
+ dh_installdirs
+ install -m755 dtc $(CURDIR)/debian/device-tree-compiler/usr/bin
+ touch install-stamp
+
+# Build architecture-independent files here.
+binary-indep: build install
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs Documentation/dtc-paper.dvi Documentation/dtc-paper.ps \
+ Documentation/dtc-paper.pdf Documentation/dtc-manual.txt
+ dh_installexamples
+ dh_installman debian/manpages/*
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --combined debian/source/format
index 0000000,0000000..d3827e7
new file mode 100644
--- /dev/null
+++ b/debian/source/format
@@@ -1,0 -1,0 +1,1 @@@
++1.0
--
OpenFirmware Device Tree Compiler for Flat Device Trees
More information about the Crosstoolchain-logs
mailing list