aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-01-21 07:54:49 -0500
committerGrant Likely <grant.likely@linaro.org>2014-01-21 08:35:11 -0500
commit73ab39b14cdf6b83da6817166f6c8a9dcc25e392 (patch)
treedb578fb9a2335ed044161b40971e8a2846e11b1b /scripts/dtc
parenta878b91019809b1f2276bebefd6c96567431c316 (diff)
scripts/dtc: Update to upstream version v1.4.0
Update to the latest version of dtc with the following notable enhancements and bug fixes: * fdtput: expand fdt if value does not fit * dtc/fdt{get, put}/convert-dtsv0-lexer: convert to new usage helpers * libfdt: Add fdt_next_subnode() to permit easy subnode iteration * utilfdt_read: pass back up the length of data read * util_version: new helper for displaying version info * die: constify format string arg * utilfdt_read_err: use xmalloc funcs * Export fdt_stringlist_contains() * dtc: Drop the '-S is deprecated' warning * dtc/libfdt: sparse fixes * dtc/libfdt: introduce fdt types for annotation by endian checkers * Fix util_is_printable_string * dtc: srcpos_verror() should print to stderr * libfdt: Added missing functions to shared library Shipped bison/flex generated files were built on an Ubuntu 13.10 system. Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'scripts/dtc')
-rw-r--r--scripts/dtc/dtc.c119
-rw-r--r--scripts/dtc/dtc.h1
-rw-r--r--scripts/dtc/srcpos.c6
-rw-r--r--scripts/dtc/util.c141
-rw-r--r--scripts/dtc/util.h107
-rw-r--r--scripts/dtc/version_gen.h2
6 files changed, 294 insertions, 82 deletions
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
index a375683c1534..e3c96536fd9d 100644
--- a/scripts/dtc/dtc.c
+++ b/scripts/dtc/dtc.c
@@ -21,8 +21,6 @@
21#include "dtc.h" 21#include "dtc.h"
22#include "srcpos.h" 22#include "srcpos.h"
23 23
24#include "version_gen.h"
25
26/* 24/*
27 * Command line options 25 * Command line options
28 */ 26 */
@@ -49,55 +47,60 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
49 fill_fullpaths(child, tree->fullpath); 47 fill_fullpaths(child, tree->fullpath);
50} 48}
51 49
52static void __attribute__ ((noreturn)) usage(void) 50/* Usage related data. */
53{ 51static const char usage_synopsis[] = "dtc [options] <input file>";
54 fprintf(stderr, "Usage:\n"); 52static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
55 fprintf(stderr, "\tdtc [options] <input file>\n"); 53static struct option const usage_long_opts[] = {
56 fprintf(stderr, "\nOptions:\n"); 54 {"quiet", no_argument, NULL, 'q'},
57 fprintf(stderr, "\t-h\n"); 55 {"in-format", a_argument, NULL, 'I'},
58 fprintf(stderr, "\t\tThis help text\n"); 56 {"out", a_argument, NULL, 'o'},
59 fprintf(stderr, "\t-q\n"); 57 {"out-format", a_argument, NULL, 'O'},
60 fprintf(stderr, "\t\tQuiet: -q suppress warnings, -qq errors, -qqq all\n"); 58 {"out-version", a_argument, NULL, 'V'},
61 fprintf(stderr, "\t-I <input format>\n"); 59 {"out-dependency", a_argument, NULL, 'd'},
62 fprintf(stderr, "\t\tInput formats are:\n"); 60 {"reserve", a_argument, NULL, 'R'},
63 fprintf(stderr, "\t\t\tdts - device tree source text\n"); 61 {"space", a_argument, NULL, 'S'},
64 fprintf(stderr, "\t\t\tdtb - device tree blob\n"); 62 {"pad", a_argument, NULL, 'p'},
65 fprintf(stderr, "\t\t\tfs - /proc/device-tree style directory\n"); 63 {"boot-cpu", a_argument, NULL, 'b'},
66 fprintf(stderr, "\t-o <output file>\n"); 64 {"force", no_argument, NULL, 'f'},
67 fprintf(stderr, "\t-O <output format>\n"); 65 {"include", a_argument, NULL, 'i'},
68 fprintf(stderr, "\t\tOutput formats are:\n"); 66 {"sort", no_argument, NULL, 's'},
69 fprintf(stderr, "\t\t\tdts - device tree source text\n"); 67 {"phandle", a_argument, NULL, 'H'},
70 fprintf(stderr, "\t\t\tdtb - device tree blob\n"); 68 {"warning", a_argument, NULL, 'W'},
71 fprintf(stderr, "\t\t\tasm - assembler source\n"); 69 {"error", a_argument, NULL, 'E'},
72 fprintf(stderr, "\t-V <output version>\n"); 70 {"help", no_argument, NULL, 'h'},
73 fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); 71 {"version", no_argument, NULL, 'v'},
74 fprintf(stderr, "\t-d <output dependency file>\n"); 72 {NULL, no_argument, NULL, 0x0},
75 fprintf(stderr, "\t-R <number>\n"); 73};
76 fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); 74static const char * const usage_opts_help[] = {
77 fprintf(stderr, "\t-S <bytes>\n"); 75 "\n\tQuiet: -q suppress warnings, -qq errors, -qqq all",
78 fprintf(stderr, "\t\tMake the blob at least <bytes> long (extra space)\n"); 76 "\n\tInput formats are:\n"
79 fprintf(stderr, "\t-p <bytes>\n"); 77 "\t\tdts - device tree source text\n"
80 fprintf(stderr, "\t\tAdd padding to the blob of <bytes> long (extra space)\n"); 78 "\t\tdtb - device tree blob\n"
81 fprintf(stderr, "\t-b <number>\n"); 79 "\t\tfs - /proc/device-tree style directory",
82 fprintf(stderr, "\t\tSet the physical boot cpu\n"); 80 "\n\tOutput file",
83 fprintf(stderr, "\t-f\n"); 81 "\n\tOutput formats are:\n"
84 fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n"); 82 "\t\tdts - device tree source text\n"
85 fprintf(stderr, "\t-i\n"); 83 "\t\tdtb - device tree blob\n"
86 fprintf(stderr, "\t\tAdd a path to search for include files\n"); 84 "\t\tasm - assembler source",
87 fprintf(stderr, "\t-s\n"); 85 "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
88 fprintf(stderr, "\t\tSort nodes and properties before outputting (only useful for\n\t\tcomparing trees)\n"); 86 "\n\tOutput dependency file",
89 fprintf(stderr, "\t-v\n"); 87 "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
90 fprintf(stderr, "\t\tPrint DTC version and exit\n"); 88 "\n\tMake the blob at least <bytes> long (extra space)",
91 fprintf(stderr, "\t-H <phandle format>\n"); 89 "\n\tAdd padding to the blob of <bytes> long (extra space)",
92 fprintf(stderr, "\t\tphandle formats are:\n"); 90 "\n\tSet the physical boot cpu",
93 fprintf(stderr, "\t\t\tlegacy - \"linux,phandle\" properties only\n"); 91 "\n\tTry to produce output even if the input tree has errors",
94 fprintf(stderr, "\t\t\tepapr - \"phandle\" properties only\n"); 92 "\n\tAdd a path to search for include files",
95 fprintf(stderr, "\t\t\tboth - Both \"linux,phandle\" and \"phandle\" properties\n"); 93 "\n\tSort nodes and properties before outputting (useful for comparing trees)",
96 fprintf(stderr, "\t-W [no-]<checkname>\n"); 94 "\n\tValid phandle formats are:\n"
97 fprintf(stderr, "\t-E [no-]<checkname>\n"); 95 "\t\tlegacy - \"linux,phandle\" properties only\n"
98 fprintf(stderr, "\t\t\tenable or disable warnings and errors\n"); 96 "\t\tepapr - \"phandle\" properties only\n"
99 exit(3); 97 "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
100} 98 "\n\tEnable/disable warnings (prefix with \"no-\")",
99 "\n\tEnable/disable errors (prefix with \"no-\")",
100 "\n\tPrint this help and exit",
101 "\n\tPrint version and exit",
102 NULL,
103};
101 104
102int main(int argc, char *argv[]) 105int main(int argc, char *argv[])
103{ 106{
@@ -118,8 +121,7 @@ int main(int argc, char *argv[])
118 minsize = 0; 121 minsize = 0;
119 padsize = 0; 122 padsize = 0;
120 123
121 while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fqb:i:vH:sW:E:")) 124 while ((opt = util_getopt_long()) != EOF) {
122 != EOF) {
123 switch (opt) { 125 switch (opt) {
124 case 'I': 126 case 'I':
125 inform = optarg; 127 inform = optarg;
@@ -158,8 +160,7 @@ int main(int argc, char *argv[])
158 srcfile_add_search_path(optarg); 160 srcfile_add_search_path(optarg);
159 break; 161 break;
160 case 'v': 162 case 'v':
161 printf("Version: %s\n", DTC_VERSION); 163 util_version();
162 exit(0);
163 case 'H': 164 case 'H':
164 if (streq(optarg, "legacy")) 165 if (streq(optarg, "legacy"))
165 phandle_format = PHANDLE_LEGACY; 166 phandle_format = PHANDLE_LEGACY;
@@ -185,13 +186,14 @@ int main(int argc, char *argv[])
185 break; 186 break;
186 187
187 case 'h': 188 case 'h':
189 usage(NULL);
188 default: 190 default:
189 usage(); 191 usage("unknown option");
190 } 192 }
191 } 193 }
192 194
193 if (argc > (optind+1)) 195 if (argc > (optind+1))
194 usage(); 196 usage("missing files");
195 else if (argc < (optind+1)) 197 else if (argc < (optind+1))
196 arg = "-"; 198 arg = "-";
197 else 199 else
@@ -201,9 +203,6 @@ int main(int argc, char *argv[])
201 if (minsize && padsize) 203 if (minsize && padsize)
202 die("Can't set both -p and -S\n"); 204 die("Can't set both -p and -S\n");
203 205
204 if (minsize)
205 fprintf(stderr, "DTC: Use of \"-S\" is deprecated; it will be removed soon, use \"-p\" instead\n");
206
207 if (depname) { 206 if (depname) {
208 depfile = fopen(depname, "w"); 207 depfile = fopen(depname, "w");
209 if (!depfile) 208 if (!depfile)
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
index 3e42a071070e..264a20cf66a8 100644
--- a/scripts/dtc/dtc.h
+++ b/scripts/dtc/dtc.h
@@ -66,7 +66,6 @@ typedef uint32_t cell_t;
66#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0) 66#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
67 67
68#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) 68#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
69#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
70 69
71/* Data blobs */ 70/* Data blobs */
72enum markertype { 71enum markertype {
diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c
index 246ab4bc0d9d..c20bc5315bc1 100644
--- a/scripts/dtc/srcpos.c
+++ b/scripts/dtc/srcpos.c
@@ -297,9 +297,9 @@ srcpos_verror(struct srcpos *pos, char const *fmt, va_list va)
297 297
298 srcstr = srcpos_string(pos); 298 srcstr = srcpos_string(pos);
299 299
300 fprintf(stdout, "Error: %s ", srcstr); 300 fprintf(stderr, "Error: %s ", srcstr);
301 v