Commit Graph

26 Commits

Author SHA1 Message Date
Rob Herring b993734718 scripts/dtc: Update to upstream version 53bf130b1cdd
Sync to upstream dtc commit 53bf130b1cdd ("libfdt: simplify
fdt_node_check_compatible()"). This adds the following commits from
upstream:

53bf130 libfdt: simplify fdt_node_check_compatible()
c9d9121 Warn on node name unit-address presence/absence mismatch
2e53f9d Catch unsigned 32bit overflow when parsing flattened device tree offsets

Signed-off-by: Rob Herring <robh@kernel.org>
2016-03-29 13:29:22 -05:00
Rob Herring 91feabc2e2 scripts/dtc: Update to upstream commit b06e55c88b9b
Sync to upstream dtc commit b06e55c88b9b ("Prevent crash on modulo by
zero"). This adds the following commits from upstream:

b06e55c Prevent crash on modulo by zero
b433450 Fix some bugs in processing of line directives
d728ad5 Fix crash on nul character in string escape sequence
1ab2205 Gracefully handle bad octal literals
1937095 Prevent crash on division by zero
d0b3ab0 libfdt: Fix undefined behaviour in fdt_offset_ptr()
d4c7c25 libfdt: check for potential overrun in _fdt_splice()
f58799b libfdt: Add some missing symbols to version.lds
af9f26d Remove duplicated -Werror in dtc Makefile
604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings
554fde2 libfdt: fix comment block of fdt_get_property_namelen()
e5e6df7 fdtdump: Fix bug printing bytestrings with negative values
067829e Remove redundant fdtdump test code
897a429 Move fdt_path_offset alias tests to right tests section
2d1417c Add simple .travis.yml
f6dbc6c guess output file format
5e78dff guess input file format based on file content or file name
8b927bf tests: convert `echo -n` to `printf`
64c46b0 Fix crash with poorly defined #size-cells

Cc: Grant Likely <grant.likely@linaro.org>
Tested-by: Frank Rowand <frank.rowand@sonymobile.com>
Reviewed-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-02-11 19:45:09 -06:00
Frank Rowand 60c7f4cb1f scripts/dtc: dtx_diff - add info to error message
If kernel config options are not properly set, "make scripts" will not
compile dtc.  Update the unable to find dtc error message to check
the kernel config and give better advice on how to create dtc.

Reword another error message to increase clarity.

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-02-11 19:40:57 -06:00
Frank Rowand 10eadc253d dtc: create tool to diff device trees
Create script to diff device trees.

The device tree can be in any of the forms recognized by the dtc compiler:
  - source
  - binary blob
  - file system tree (from /proc/devicetree)

If the device tree is a source file, then it is pre-processed in the
same way as it would be when built in the linux kernel source tree
before diffing.

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-01-25 08:47:47 -06:00
Rob Herring 4760597116 scripts/dtc: Update to upstream version 9d3649bd3be245c9
Sync dtc with upstream as of commit 9d3649bd3be2 (Add testcases for
fdt_path_offset_namelen()).

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: devicetree@vger.kernel.org
2015-04-29 17:17:27 -05:00
Gaurav Minocha 695e9fdd20 scripts/dtc: add missing libfdt and fixups to import script
The following script is used to import dtc upstream
into kernel. It was missing import of dtc/libfdt, with
this commit it will include the same.

Also, currently in arch and driver code that needs early access to
the flattened device tree it is necessary to add specific CFLAGS
so that when scripts/dtc/libfdt/libfdt.h is included the C
preprocessor is able to locate the libfdt versions of libfdt_env.h
and fdt.h without generating an error. So, this script replaces
angular brackets with quotation used to include header files
fdt.h and libfdt_env.h

Signed-off-by: Gaurav Minocha <gaurav.minocha.os@gmail.com>
[robh: reword commit headline and add 'git add']
Signed-off-by: Rob Herring <robh@kernel.org>
2015-04-29 16:08:05 -05:00
Masahiro Yamada 7eb6e34052 kbuild: trivial - remove trailing empty lines
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-06-10 00:04:06 +02:00
Grant Likely c8a3e6a866 scripts/dtc: Add a script to update to mainline dtc source
A very simple script that automates pulling in a newer version of DTC.
Not particularly robust, but a whole lot better than doing it by hand
every time.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-01-21 13:48:34 +00:00
Grant Likely 73ab39b14c 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>
2014-01-21 13:35:11 +00:00
Grant Likely a878b91019 scripts/dtc: Update shipped files to build with bison 2.7.12
Preparation patch before updating to upstream dtc version 1.4.0. This
change only contains the changes caused by a new version of bison
on the shipped files. There are no functional changes.

The shipped files were build on an Ubuntu 13.10 system

Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-01-21 13:31:40 +00:00
Grant Likely 706b78f37f dtc: ensure #line directives don't consume data from the next line
Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
could match line-break characters. If the #line directive did not contain
the optional flags field at the end, this could cause any integer data on
the next line to be consumed as part of the #line directive parsing. This
could cause syntax errors (i.e. #line parsing consuming the leading 0
from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
which is a syntax error), or invalid compilation results (i.e. simply
consuming literal 1234 as part of the #line processing, thus removing it
from the cell data).

Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.

Convert all instances of {WS}, even though the other instances should be
irrelevant for any well-formed #line directive. This is done for
consistency and ultimate safety.

[Cherry picked from DTC commit a1ee6f068e1c8dbc62873645037a353d7852d5cc]

Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-06-13 22:12:15 +01:00
Grant Likely 2a6a08ca5e dtc: Update generated files to output from Bison 2.5
This patch merely updates the generated dtc parser and lexer files to
the output generated by Bison 2.5. The previous versions were generated
from version 2.4.1. The only reason for this commit is to minimize the
diff on the next commit which fixes a bug in the DTC #line directive
parsing. Otherwise the Bison changes would be intermingled with the
functional changes.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-06-13 22:12:14 +01:00
Magnus Damm 4f3be1cfa8 script: dtc: clean generated files
Fix "make distclean" to clean up generated dtc files.

Without this patch the following files are left around:
 - dtc-lexer.lex.c
 - dtc-parser.tab.c
 - dtc-parser.tab.h

Signed-off-by: Magnus Damm <damm@opensource.se>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2012-11-21 15:53:22 +00:00
Stephen Warren 205a8eb7ce dtc: fix for_each_*() to skip first object if deleted
The previous definition of for_each_*() would always include the very
first object within the list, irrespective of whether it was marked
deleted, since the deleted flag was not checked on the first object,
but only on any "next" object.

Fix for_each_*() to check the deleted flag in the loop body every
iteration to correct this.

(upstream dtc commit 1762ab42ef77db7ab2776d0d6cba3515150f518a)

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-10-17 15:53:04 -05:00
Stephen Warren cd296721a9 dtc: import latest upstream dtc
This updates scripts/dtc to commit 317a5d9 "dtc: zero out new label
objects" from git://git.jdl.com/software/dtc.git.

This adds features such as:
* /bits/ syntax for cell data.
* Math expressions within cell data.
* The ability to delete properties or nodes.
* Support for #line directives in the input file, which allows the use of
  cpp on *.dts.
* -i command-line option (/include/ path)
* -W/-E command-line options for error/warning control.
* Removal of spew to STDOUT containing the filename being compiled.
* Many additions to the libfdt API.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-10-01 11:11:35 -05:00
Felipe Balbi db7f4e3d2b scripts: dtc: fix compile warnings
Fix following compile warnings:

scripts/dtc/flattree.c: In function ‘flat_read_mem_reserve’:
scripts/dtc/flattree.c:700:14: warning: variable ‘p’ set but not used
	[-Wunused-but-set-variable]

scripts/dtc/dtc.c: In function ‘main’:
scripts/dtc/dtc.c:104:17: warning: variable ‘check’ set but not used
	[-Wunused-but-set-variable]

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-03-24 23:07:35 +01:00
Stephen Warren 136ec2049f dtc: Implement -d option to write out a dependency file
This will allow callers to rebuild .dtb files when any of the /include/d
.dtsi files are modified, not just the top-level .dts file.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-01-14 23:47:37 +01:00
Arnaud Lacombe edfc86aada dtc: regen parser
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-06-09 14:04:47 -04:00
Arnaud Lacombe 95abef888a dtc: migrate parser to implicit rules
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-06-09 14:04:46 -04:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
John Bonesio 658f29a51e of/flattree: Update dtc to current mainline.
Pull in recent changes from the main dtc repository. These changes
primarily allow multiple device trees to be declared which are merged
by dtc. This feature allows us to include a basic dts file and then
provide more information for the specific system through the merging
functionality.

Changes pulled from git://git.jdl.com/software/dtc.git
commit id: 37c0b6a0, "dtc: Add code to make diffing trees easier"

Signed-off-by: John Bonesio <bones@secretlab.ca>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-01-03 16:02:49 -07:00
Martin Ettl 5e8e1cc0a1 scripts/dtc: Fix a resource leak
during a check of the current git head of the linux kernel with the
static code analysis tool cppcheck
(http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page)
the tool discovered a resource leak in linux-2.6/scripts/dtc/fstree.c.

Please refer the attached patch, that fixes the issue.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15363
Signed-off-by: Martin Ettl <ettl.martin@gmx.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-02 13:51:11 +02:00
Josh Triplett 5ccd991548 dtc: Mark various internal functions static
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
2009-11-15 15:01:41 -08:00
Josh Triplett 23c4ace526 dtc: Set "noinput" in the lexer to avoid an unused function
Regenerate the corresponding generated lexer.

Regenerating the lexer with current flex also provides prototypes for
various yy* functions, making some -Wmissing-prototypes warnings go away
as well.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
2009-11-15 15:01:41 -08:00
Jon Smirl b810c6ec5c powerpc: Have git ignore generated files from dtc compile
Have git ignore generated files from dtc compile

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2009-06-26 14:37:23 +10:00
David Gibson 9fffb55f66 Move dtc and libfdt sources from arch/powerpc/boot to scripts/dtc
The powerpc kernel always requires an Open Firmware like device tree
to supply device information.  On systems without OF, this comes from
a flattened device tree blob.  This blob is usually generated by dtc,
a tool which compiles a text description of the device tree into the
flattened format used by the kernel.  Sometimes, the bootwrapper makes
small changes to the pre-compiled device tree blob (e.g. filling in
the size of RAM).  To do this it uses the libfdt library.

Because these are only used on powerpc, the code for both these tools
is included under arch/powerpc/boot (these were imported and are
periodically updated from the upstream dtc tree).

However, the microblaze architecture, currently being prepared for
merging to mainline also uses dtc to produce device tree blobs.  A few
other archs have also mentioned some interest in using dtc.
Therefore, this patch moves dtc and libfdt from arch/powerpc into
scripts, where it can be used by any architecture.

The vast bulk of this patch is a literal move, the rest is adjusting
the various Makefiles to use dtc and libfdt correctly from their new
locations.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-05-02 16:52:26 -07:00