1
0

0001-scripts-dtc-Update-to-version-with-overlays.patch 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. From 5f84cb93eef9f8a8ff7f49d593893f252744d0fe Mon Sep 17 00:00:00 2001
  2. From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
  3. Date: Wed, 26 Aug 2015 18:28:08 +0300
  4. Subject: [PATCH] scripts/dtc: Update to version with overlays
  5. Update to mainline dtc with overlay support
  6. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
  7. ---
  8. checks.c | 20 +++++-
  9. dtc-lexer.l | 5 ++
  10. dtc-parser.y | 54 ++++++++++++++--
  11. dtc.c | 83 ++++++++++++++++++++++--
  12. dtc.h | 13 +++-
  13. livetree.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  14. treesource.c | 3 +
  15. util.c | 2 +-
  16. 8 files changed, 367 insertions(+), 15 deletions(-)
  17. diff --git a/checks.c b/checks.c
  18. index 3bf0fa4..af25c2b 100644
  19. --- a/checks.c
  20. +++ b/checks.c
  21. @@ -465,8 +465,12 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
  22. refnode = get_node_by_ref(dt, m->ref);
  23. if (! refnode) {
  24. - FAIL(c, "Reference to non-existent node or label \"%s\"\n",
  25. - m->ref);
  26. + if (!source_is_plugin)
  27. + FAIL(c, "Reference to non-existent node or "
  28. + "label \"%s\"\n", m->ref);
  29. + else /* mark the entry as unresolved */
  30. + *((cell_t *)(prop->val.val + m->offset)) =
  31. + cpu_to_fdt32(0xffffffff);
  32. continue;
  33. }
  34. @@ -559,7 +563,7 @@ static void check_reg_format(struct check *c, struct node *dt,
  35. size_cells = node_size_cells(node->parent);
  36. entrylen = (addr_cells + size_cells) * sizeof(cell_t);
  37. - if ((prop->val.len % entrylen) != 0)
  38. + if (!entrylen || (prop->val.len % entrylen) != 0)
  39. FAIL(c, "\"reg\" property in %s has invalid length (%d bytes) "
  40. "(#address-cells == %d, #size-cells == %d)",
  41. node->fullpath, prop->val.len, addr_cells, size_cells);
  42. @@ -651,6 +655,15 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
  43. }
  44. TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
  45. +static void check_deprecated_plugin_syntax(struct check *c,
  46. + struct node *dt)
  47. +{
  48. + if (deprecated_plugin_syntax_warning)
  49. + FAIL(c, "Use '/dts-v1/ /plugin/'; syntax. /dts-v1/; /plugin/; "
  50. + "is going to be removed in next versions");
  51. +}
  52. +TREE_WARNING(deprecated_plugin_syntax, NULL);
  53. +
  54. static struct check *check_table[] = {
  55. &duplicate_node_names, &duplicate_property_names,
  56. &node_name_chars, &node_name_format, &property_name_chars,
  57. @@ -668,6 +681,7 @@ static struct check *check_table[] = {
  58. &avoid_default_addr_size,
  59. &obsolete_chosen_interrupt_controller,
  60. + &deprecated_plugin_syntax,
  61. &always_fail,
  62. };
  63. diff --git a/dtc-lexer.l b/dtc-lexer.l
  64. index 0ee1caf..dd44ba2 100644
  65. --- a/dtc-lexer.l
  66. +++ b/dtc-lexer.l
  67. @@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...);
  68. return DT_V1;
  69. }
  70. +<*>"/plugin/" {
  71. + DPRINT("Keyword: /plugin/\n");
  72. + return DT_PLUGIN;
  73. + }
  74. +
  75. <*>"/memreserve/" {
  76. DPRINT("Keyword: /memreserve/\n");
  77. BEGIN_DEFAULT();
  78. diff --git a/dtc-parser.y b/dtc-parser.y
  79. index ea57e0a..7d9652d 100644
  80. --- a/dtc-parser.y
  81. +++ b/dtc-parser.y
  82. @@ -19,6 +19,7 @@
  83. */
  84. %{
  85. #include <stdio.h>
  86. +#include <inttypes.h>
  87. #include "dtc.h"
  88. #include "srcpos.h"
  89. @@ -52,9 +53,11 @@ extern bool treesource_error;
  90. struct node *nodelist;
  91. struct reserve_info *re;
  92. uint64_t integer;
  93. + bool is_plugin;
  94. }
  95. %token DT_V1
  96. +%token DT_PLUGIN
  97. %token DT_MEMRESERVE
  98. %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
  99. %token DT_BITS
  100. @@ -71,6 +74,7 @@ extern bool treesource_error;
  101. %type <data> propdata
  102. %type <data> propdataprefix
  103. +%type <is_plugin> plugindecl
  104. %type <re> memreserve
  105. %type <re> memreserves
  106. %type <array> arrayprefix
  107. @@ -101,10 +105,39 @@ extern bool treesource_error;
  108. %%
  109. sourcefile:
  110. - DT_V1 ';' memreserves devicetree
  111. + basesource
  112. + | pluginsource
  113. + ;
  114. +
  115. +basesource:
  116. + DT_V1 ';' plugindecl memreserves devicetree
  117. + {
  118. + source_is_plugin = $3;
  119. + if (source_is_plugin)
  120. + deprecated_plugin_syntax_warning = true;
  121. + the_boot_info = build_boot_info($4, $5,
  122. + guess_boot_cpuid($5));
  123. + }
  124. + ;
  125. +
  126. +plugindecl:
  127. + /* empty */
  128. + {
  129. + $$ = false;
  130. + }
  131. + | DT_PLUGIN ';'
  132. + {
  133. + $$ = true;
  134. + }
  135. + ;
  136. +
  137. +pluginsource:
  138. + DT_V1 DT_PLUGIN ';' memreserves devicetree
  139. {
  140. - the_boot_info = build_boot_info($3, $4,
  141. - guess_boot_cpuid($4));
  142. + source_is_plugin = true;
  143. + deprecated_plugin_syntax_warning = false;
  144. + the_boot_info = build_boot_info($4, $5,
  145. + guess_boot_cpuid($5));
  146. }
  147. ;
  148. @@ -144,10 +177,14 @@ devicetree:
  149. {
  150. struct node *target = get_node_by_ref($1, $2);
  151. - if (target)
  152. + if (target) {
  153. merge_nodes(target, $3);
  154. - else
  155. - ERROR(&@2, "Label or path %s not found", $2);
  156. + } else {
  157. + if (symbol_fixup_support)
  158. + add_orphan_node($1, $3, $2);
  159. + else
  160. + ERROR(&@2, "Label or path %s not found", $2);
  161. + }
  162. $$ = $1;
  163. }
  164. | devicetree DT_DEL_NODE DT_REF ';'
  165. @@ -162,6 +199,11 @@ devicetree:
  166. $$ = $1;
  167. }
  168. + | /* empty */
  169. + {
  170. + /* build empty node */
  171. + $$ = name_node(build_node(NULL, NULL), "");
  172. + }
  173. ;
  174. nodedef:
  175. diff --git a/dtc.c b/dtc.c
  176. index 8c4add6..ee37be9 100644
  177. --- a/dtc.c
  178. +++ b/dtc.c
  179. @@ -18,6 +18,8 @@
  180. * USA
  181. */
  182. +#include <sys/stat.h>
  183. +
  184. #include "dtc.h"
  185. #include "srcpos.h"
  186. @@ -29,6 +31,8 @@ int reservenum; /* Number of memory reservation slots */
  187. int minsize; /* Minimum blob size */
  188. int padsize; /* Additional padding to blob */
  189. int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
  190. +int symbol_fixup_support;
  191. +int auto_label_aliases;
  192. static void fill_fullpaths(struct node *tree, const char *prefix)
  193. {
  194. @@ -51,7 +55,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
  195. #define FDT_VERSION(version) _FDT_VERSION(version)
  196. #define _FDT_VERSION(version) #version
  197. static const char usage_synopsis[] = "dtc [options] <input file>";
  198. -static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
  199. +static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@Ahv";
  200. static struct option const usage_long_opts[] = {
  201. {"quiet", no_argument, NULL, 'q'},
  202. {"in-format", a_argument, NULL, 'I'},
  203. @@ -69,6 +73,8 @@ static struct option const usage_long_opts[] = {
  204. {"phandle", a_argument, NULL, 'H'},
  205. {"warning", a_argument, NULL, 'W'},
  206. {"error", a_argument, NULL, 'E'},
  207. + {"symbols", no_argument, NULL, '@'},
  208. + {"auto-alias", no_argument, NULL, 'A'},
  209. {"help", no_argument, NULL, 'h'},
  210. {"version", no_argument, NULL, 'v'},
  211. {NULL, no_argument, NULL, 0x0},
  212. @@ -99,16 +105,63 @@ static const char * const usage_opts_help[] = {
  213. "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
  214. "\n\tEnable/disable warnings (prefix with \"no-\")",
  215. "\n\tEnable/disable errors (prefix with \"no-\")",
  216. + "\n\tEnable symbols/fixup support",
  217. + "\n\tEnable auto-alias of labels",
  218. "\n\tPrint this help and exit",
  219. "\n\tPrint version and exit",
  220. NULL,
  221. };
  222. +static const char *guess_type_by_name(const char *fname, const char *fallback)
  223. +{
  224. + const char *s;
  225. +
  226. + s = strrchr(fname, '.');
  227. + if (s == NULL)
  228. + return fallback;
  229. + if (!strcasecmp(s, ".dts"))
  230. + return "dts";
  231. + if (!strcasecmp(s, ".dtb"))
  232. + return "dtb";
  233. + return fallback;
  234. +}
  235. +
  236. +static const char *guess_input_format(const char *fname, const char *fallback)
  237. +{
  238. + struct stat statbuf;
  239. + uint32_t magic;
  240. + FILE *f;
  241. +
  242. + if (stat(fname, &statbuf) != 0)
  243. + return fallback;
  244. +
  245. + if (S_ISDIR(statbuf.st_mode))
  246. + return "fs";
  247. +
  248. + if (!S_ISREG(statbuf.st_mode))
  249. + return fallback;
  250. +
  251. + f = fopen(fname, "r");
  252. + if (f == NULL)
  253. + return fallback;
  254. + if (fread(&magic, 4, 1, f) != 1) {
  255. + fclose(f);
  256. + return fallback;
  257. + }
  258. + fclose(f);
  259. +
  260. + magic = fdt32_to_cpu(magic);
  261. + if (magic == FDT_MAGIC)
  262. + return "dtb";
  263. +
  264. + return guess_type_by_name(fname, fallback);
  265. +}
  266. +
  267. int main(int argc, char *argv[])
  268. {
  269. struct boot_info *bi;
  270. - const char *inform = "dts";
  271. - const char *outform = "dts";
  272. + const char *inform = NULL;
  273. + const char *outform = NULL;
  274. const char *outname = "-";
  275. const char *depname = NULL;
  276. bool force = false, sort = false;
  277. @@ -186,7 +239,12 @@ int main(int argc, char *argv[])
  278. case 'E':
  279. parse_checks_option(false, true, optarg);
  280. break;
  281. -
  282. + case '@':
  283. + symbol_fixup_support = 1;
  284. + break;
  285. + case 'A':
  286. + auto_label_aliases = 1;
  287. + break;
  288. case 'h':
  289. usage(NULL);
  290. default:
  291. @@ -213,6 +271,17 @@ int main(int argc, char *argv[])
  292. fprintf(depfile, "%s:", outname);
  293. }
  294. + if (inform == NULL)
  295. + inform = guess_input_format(arg, "dts");
  296. + if (outform == NULL) {
  297. + outform = guess_type_by_name(outname, NULL);
  298. + if (outform == NULL) {
  299. + if (streq(inform, "dts"))
  300. + outform = "dtb";
  301. + else
  302. + outform = "dts";
  303. + }
  304. + }
  305. if (streq(inform, "dts"))
  306. bi = dt_from_source(arg);
  307. else if (streq(inform, "fs"))
  308. @@ -236,6 +305,12 @@ int main(int argc, char *argv[])
  309. if (sort)
  310. sort_tree(bi);
  311. + if (symbol_fixup_support || auto_label_aliases)
  312. + generate_label_node(bi->dt, bi->dt);
  313. +
  314. + if (symbol_fixup_support)
  315. + generate_fixups_node(bi->dt, bi->dt);
  316. +
  317. if (streq(outname, "-")) {
  318. outf = stdout;
  319. } else {
  320. diff --git a/dtc.h b/dtc.h
  321. index 56212c8..d025111 100644
  322. --- a/dtc.h
  323. +++ b/dtc.h
  324. @@ -20,7 +20,7 @@
  325. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  326. * USA
  327. */
  328. -
  329. +#define _GNU_SOURCE
  330. #include <stdio.h>
  331. #include <string.h>
  332. #include <stdlib.h>
  333. @@ -54,6 +54,14 @@ extern int reservenum; /* Number of memory reservation slots */
  334. extern int minsize; /* Minimum blob size */
  335. extern int padsize; /* Additional padding to blob */
  336. extern int phandle_format; /* Use linux,phandle or phandle properties */
  337. +extern int symbol_fixup_support;/* enable symbols & fixup support */
  338. +extern int auto_label_aliases; /* auto generate labels -> aliases */
  339. +
  340. +/*
  341. + * Tree source globals
  342. + */
  343. +extern bool source_is_plugin;
  344. +extern bool deprecated_plugin_syntax_warning;
  345. #define PHANDLE_LEGACY 0x1
  346. #define PHANDLE_EPAPR 0x2
  347. @@ -194,6 +202,7 @@ struct node *build_node_delete(void);
  348. struct node *name_node(struct node *node, char *name);
  349. struct node *chain_node(struct node *first, struct node *list);
  350. struct node *merge_nodes(struct node *old_node, struct node *new_node);
  351. +void add_orphan_node(struct node *old_node, struct node *new_node, char *ref);
  352. void add_property(struct node *node, struct property *prop);
  353. void delete_property_by_name(struct node *node, char *name);
  354. @@ -244,6 +253,8 @@ struct boot_info {
  355. struct boot_info *build_boot_info(struct reserve_info *reservelist,
  356. struct node *tree, uint32_t boot_cpuid_phys);
  357. void sort_tree(struct boot_info *bi);
  358. +void generate_label_node(struct node *node, struct node *dt);
  359. +void generate_fixups_node(struct node *node, struct node *dt);
  360. /* Checks */
  361. diff --git a/livetree.c b/livetree.c
  362. index e229b84..1ef9fc4 100644
  363. --- a/livetree.c
  364. +++ b/livetree.c
  365. @@ -216,6 +216,34 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
  366. return old_node;
  367. }
  368. +void add_orphan_node(struct node *dt, struct node *new_node, char *ref)
  369. +{
  370. + static unsigned int next_orphan_fragment = 0;
  371. + struct node *ovl = xmalloc(sizeof(*ovl));
  372. + struct property *p;
  373. + struct data d = empty_data;
  374. + char *name;
  375. + int ret;
  376. +
  377. + memset(ovl, 0, sizeof(*ovl));
  378. +
  379. + d = data_add_marker(d, REF_PHANDLE, ref);
  380. + d = data_append_integer(d, 0xffffffff, 32);
  381. +
  382. + p = build_property("target", d);
  383. + add_property(ovl, p);
  384. +
  385. + ret = asprintf(&name, "fragment@%u",
  386. + next_orphan_fragment++);
  387. + if (ret == -1)
  388. + die("asprintf() failed\n");
  389. + name_node(ovl, name);
  390. + name_node(new_node, "__overlay__");
  391. +
  392. + add_child(dt, ovl);
  393. + add_child(ovl, new_node);
  394. +}
  395. +
  396. struct node *chain_node(struct node *first, struct node *list)
  397. {
  398. assert(first->next_sibling == NULL);
  399. @@ -709,3 +737,177 @@ void sort_tree(struct boot_info *bi)
  400. sort_reserve_entries(bi);
  401. sort_node(bi->dt);
  402. }
  403. +
  404. +void generate_label_node(struct node *node, struct node *dt)
  405. +{
  406. + struct node *c, *an;
  407. + struct property *p;
  408. + struct label *l;
  409. + int has_label;
  410. + char *gen_node_name;
  411. +
  412. + if (auto_label_aliases)
  413. + gen_node_name = "aliases";
  414. + else
  415. + gen_node_name = "__symbols__";
  416. +
  417. + /* Make sure the label isn't already there */
  418. + has_label = 0;
  419. + for_each_label(node->labels, l) {
  420. + has_label = 1;
  421. + break;
  422. + }
  423. +
  424. + if (has_label) {
  425. +
  426. + /* an is the aliases/__symbols__ node */
  427. + an = get_subnode(dt, gen_node_name);
  428. + /* if no node exists, create it */
  429. + if (!an) {
  430. + an = build_node(NULL, NULL);
  431. + name_node(an, gen_node_name);
  432. + add_child(dt, an);
  433. + }
  434. +
  435. + /* now add the label in the node */
  436. + for_each_label(node->labels, l) {
  437. + /* check whether the label already exists */
  438. + p = get_property(an, l->label);
  439. + if (p) {
  440. + fprintf(stderr, "WARNING: label %s already"
  441. + " exists in /%s", l->label,
  442. + gen_node_name);
  443. + continue;
  444. + }
  445. +
  446. + /* insert it */
  447. + p = build_property(l->label,
  448. + data_copy_escape_string(node->fullpath,
  449. + strlen(node->fullpath)));
  450. + add_property(an, p);
  451. + }
  452. +
  453. + /* force allocation of a phandle for this node */
  454. + if (symbol_fixup_support)
  455. + (void)get_node_phandle(dt, node);
  456. + }
  457. +
  458. + for_each_child(node, c)
  459. + generate_label_node(c, dt);
  460. +}
  461. +
  462. +static void add_fixup_entry(struct node *dt, struct node *node,
  463. + struct property *prop, struct marker *m)
  464. +{
  465. + struct node *fn; /* local fixup node */
  466. + struct property *p;
  467. + char *fixups_name = "__fixups__";
  468. + struct data d;
  469. + char *entry;
  470. + int ret;
  471. +
  472. + /* fn is the node we're putting entries in */
  473. + fn = get_subnode(dt, fixups_name);
  474. + /* if no node exists, create it */
  475. + if (!fn) {
  476. + fn = build_node(NULL, NULL);
  477. + name_node(fn, fixups_name);
  478. + add_child(dt, fn);
  479. + }
  480. +
  481. + ret = asprintf(&entry, "%s:%s:%u",
  482. + node->fullpath, prop->name, m->offset);
  483. + if (ret == -1)
  484. + die("asprintf() failed\n");
  485. +
  486. + p = get_property(fn, m->ref);
  487. + d = data_append_data(p ? p->val : empty_data, entry, strlen(entry) + 1);
  488. + if (!p)
  489. + add_property(fn, build_property(m->ref, d));
  490. + else
  491. + p->val = d;
  492. +}
  493. +
  494. +static void add_local_fixup_entry(struct node *dt, struct node *node,
  495. + struct property *prop, struct marker *m,
  496. + struct node *refnode)
  497. +{
  498. + struct node *lfn, *wn, *nwn; /* local fixup node, walk node, new */
  499. + struct property *p;
  500. + struct data d;
  501. + char *local_fixups_name = "__local_fixups__";
  502. + char *s, *e, *comp;
  503. + int len;
  504. +
  505. + /* fn is the node we're putting entries in */
  506. + lfn = get_subnode(dt, local_fixups_name);
  507. + /* if no node exists, create it */
  508. + if (!lfn) {
  509. + lfn = build_node(NULL, NULL);
  510. + name_node(lfn, local_fixups_name);
  511. + add_child(dt, lfn);
  512. + }
  513. +
  514. + /* walk the path components creating nodes if they don't exist */
  515. + comp = NULL;
  516. + /* start skipping the first / */
  517. + s = node->fullpath + 1;
  518. + wn = lfn;
  519. + while (*s) {
  520. + /* retrieve path component */
  521. + e = strchr(s, '/');
  522. + if (e == NULL)
  523. + e = s + strlen(s);
  524. + len = e - s;
  525. + comp = xrealloc(comp, len + 1);
  526. + memcpy(comp, s, len);
  527. + comp[len] = '\0';
  528. +
  529. + /* if no node exists, create it */
  530. + nwn = get_subnode(wn, comp);
  531. + if (!nwn) {
  532. + nwn = build_node(NULL, NULL);
  533. + name_node(nwn, strdup(comp));
  534. + add_child(wn, nwn);
  535. + }
  536. + wn = nwn;
  537. +
  538. + /* last path component */
  539. + if (!*e)
  540. + break;
  541. +
  542. + /* next path component */
  543. + s = e + 1;
  544. + }
  545. + free(comp);
  546. +
  547. + p = get_property(wn, prop->name);
  548. + d = data_append_cell(p ? p->val : empty_data, (cell_t)m->offset);
  549. + if (!p)
  550. + add_property(wn, build_property(prop->name, d));
  551. + else
  552. + p->val = d;
  553. +}
  554. +
  555. +void generate_fixups_node(struct node *node, struct node *dt)
  556. +{
  557. + struct node *c;
  558. + struct property *prop;
  559. + struct marker *m;
  560. + struct node *refnode;
  561. +
  562. + for_each_property(node, prop) {
  563. + m = prop->val.markers;
  564. + for_each_marker_of_type(m, REF_PHANDLE) {
  565. + refnode = get_node_by_ref(dt, m->ref);
  566. + if (!refnode)
  567. + add_fixup_entry(dt, node, prop, m);
  568. + else
  569. + add_local_fixup_entry(dt, node, prop, m,
  570. + refnode);
  571. + }
  572. + }
  573. +
  574. + for_each_child(node, c)
  575. + generate_fixups_node(c, dt);
  576. +}
  577. diff --git a/treesource.c b/treesource.c
  578. index a55d1d1..e1d6657 100644
  579. --- a/treesource.c
  580. +++ b/treesource.c
  581. @@ -28,6 +28,9 @@ extern YYLTYPE yylloc;
  582. struct boot_info *the_boot_info;
  583. bool treesource_error;
  584. +bool source_is_plugin;
  585. +bool deprecated_plugin_syntax_warning;
  586. +
  587. struct boot_info *dt_from_source(const char *fname)
  588. {
  589. the_boot_info = NULL;
  590. diff --git a/util.c b/util.c
  591. index 9d65226..cbb945b 100644
  592. --- a/util.c
  593. +++ b/util.c
  594. @@ -349,7 +349,6 @@ int utilfdt_decode_type(const char *fmt, int *type, int *size)
  595. void utilfdt_print_data(const char *data, int len)
  596. {
  597. int i;
  598. - const char *p = data;
  599. const char *s;
  600. /* no data, don't print */
  601. @@ -376,6 +375,7 @@ void utilfdt_print_data(const char *data, int len)
  602. i < (len - 1) ? " " : "");
  603. printf(">");
  604. } else {
  605. + const unsigned char *p = (const unsigned char *)data;
  606. printf(" = [");
  607. for (i = 0; i < len; i++)
  608. printf("%02x%s", *p++, i < len - 1 ? " " : "");
  609. --
  610. 2.7.0