aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-09-27dtc: Bump version to v1.4.5v1.4.5David Gibson1-1/+1
Preparing for another release. No particular trigger for this, just a number of accumulated enhancements since v1.4.4. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-09-27Add fdtoverlay to .gitignoreDavid Gibson1-0/+1
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-09-27fdtoverlay: Sanity check blob sizeDavid Gibson1-0/+7
The fdtoverlay utility reads in the base fdt blob, then expands it to make room for all the overlays requested. However, it uses the totalsize field of the base blob without verifying that it actually read all of it in (it's possible the blob file could have been truncated). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-09-27pylibfdt: Use Python2 explicitlyDavid Gibson2-2/+2
The pylibfdt code is written for Python2, not Python3. So, it's safer to explicitly request Python2 in our scripts and when checking pkg-config. On Arch Linux at least, there isn't actually a plain "python" link, just "python2" and "python3", so the current setup won't work at all. According to https://www.python.org/dev/peps/pep-0394/ using "python2" should work, and is preferred. Updating pylibfdt to work with Python3 would be nice, but is a problem for another day. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-09-22checks: add interrupts property checkRob Herring3-0/+94
Add a check for nodes with interrupts property that they have a valid parent, the parent has #interrupt-cells property, and the size is a valid multiple of #interrupt-cells. This may not handle every possible case and doesn't deal with translation thru interrupt-map properties, but should be enough for modern dts files. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-09-22checks: add gpio binding properties checkRob Herring3-0/+88
The GPIO binding is different compared to other phandle plus args properties in that the property name has a variable, optional prefix. The format of the property name is [<name>-]gpio{s} where <name> can be any legal property string. Therefore, custom matching of property names is needed, but the common check_property_phandle_args() function can still be used. It's possible that there are property names matching which are not GPIO binding specifiers. There's only been one case found in testing which is "[<vendor>,]nr-gpio{s}". This property has been blacklisted and the same should be done to any others we find. This check will prevent getting any more of these, too. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-09-22checks: add phandle with arg property checksRob Herring5-0/+145
Many common bindings follow the same pattern of client properties containing a phandle and N arg cells where N is defined in the provider with a '#<specifier>-cells' property such as: intc0: interrupt-controller@0 { #interrupt-cells = <3>; }; intc1: interrupt-controller@1 { #interrupt-cells = <2>; }; node { interrupts-extended = <&intc0 1 2 3>, <&intc1 4 5>; }; Add checks for properties following this pattern. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21fdtget: Split out cell list display into a new functionSimon Glass1-15/+34
The show_data() function is quite long. Split out the part that loops through the values. This makes it easier to add new features. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21README: Add a note about test_tree1.dtsSimon Glass1-0/+11
Add a little note in the README about something which confused me. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21pylibfdt: Add support for fdt_subnode_offset()Simon Glass2-0/+29
Add this into the class to simplify use of this function. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21pylibfdt: Add support for fdt_node_offset_by_phandle()Simon Glass2-0/+24
Add this into the class to simplify use of this function. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21pylibfdt: Add support for fdt_parent_offset()Simon Glass2-0/+28
Add this into the class to simplify use of this function. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21pylibfdt: Add support for fdt_get_phandle()Simon Glass2-0/+18
Add this into the class to simplify use of this function. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21tests: Return a failure code when any tests failSimon Glass1-0/+1
At present 'make check' succeeds even if some tests fail. Adjust this so that we can use things like 'git bisect run make check' to find a failure. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21pylibfdt: Use local pylibfdt moduleSimon Glass1-2/+2
Some systems may have the Python libfdt.py library installed. Adjust the tests to prepend the local libfdt path so that we test the local version instead of the system version. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-21pylibfdt: Add a test for use of uint32_tSimon Glass1-0/+5
Using the libfdt function without going through the Python Fdt class requires use of the uint32_t type. Add a test that this works correctly. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-15pylibfdt: Add stdint include to fix uint32_tSimon Glass1-0/+2
Some types used by libfdt.h are not understood the Python module since they are defined outside it. An example is an attempt to do this: import libfdt result = libfdt.fdt_node_offset_by_phandle(fdt, phandle) This results in: TypeError: in method 'fdt_node_offset_by_phandle', argument 2 of type 'uint32_t' Include the standard integer header file to fix this. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-09tests: Add stacked overlay tests on fdtoverlayPantelis Antoniou4-0/+47
Add a stacked overlay unit test, piggybacking on fdtoverlay. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-09fdt: Allow stacked overlays phandle referencesPantelis Antoniou1-22/+206
This patch enables an overlay to refer to a previous overlay's labels by performing a merge of symbol information at application time. In a nutshell it allows an overlay to refer to a symbol that a previous overlay has defined. It requires both the base and all the overlays to be compiled with the -@ command line switch so that symbol information is included. base.dts -------- /dts-v1/; / { foo: foonode { foo-property; }; }; $ dtc -@ -I dts -O dtb -o base.dtb base.dts bar.dts ------- /dts-v1/; /plugin/; / { fragment@1 { target = <&foo>; __overlay__ { overlay-1-property; bar: barnode { bar-property; }; }; }; }; $ dtc -@ -I dts -O dtb -o bar.dtb bar.dts baz.dts ------- /dts-v1/; /plugin/; / { fragment@1 { target = <&bar>; __overlay__ { overlay-2-property; baz: baznode { baz-property; }; }; }; }; $ dtc -@ -I dts -O dtb -o baz.dtb baz.dts Applying the overlays: $ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtb Dumping: $ fdtdump target.dtb / { foonode { overlay-1-property; foo-property; linux,phandle = <0x00000001>; phandle = <0x00000001>; barnode { overlay-2-property; phandle = <0x00000002>; linux,phandle = <0x00000002>; bar-property; baznode { phandle = <0x00000003>; linux,phandle = <0x00000003>; baz-property; }; }; }; __symbols__ { baz = "/foonode/barnode/baznode"; bar = "/foonode/barnode"; foo = "/foonode"; }; }; Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-07-28Introduce fdt_setprop_placeholder() methodPantelis Antoniou2-3/+48
In some cases you need to add a property but the contents of it are not known at creation time, merely the extend of it. This method allows you to create a property of a given size (filled with garbage) while a pointer to the property data will be provided. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [dwg: Corrected commit message] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-07-13dtc: change default phandles to ePAPR style instead of bothRob Herring2-2/+2
Currently, both legacy (linux,phandle) and ePAPR (phandle) properties are inserted into dtbs by default. The newer ePAPR style has been supported in dtc and Linux kernel for 7 years. That should be a long enough transition period. We can save a little space by not putting both into the dtb. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-06-15tests: fdtoverlay unit testPantelis Antoniou3-1/+67
Add an fdtoverlay unit test. Applies applies overlay(s) and then retrieves an inserted property to verify. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-06-15fdtoverlay: A tool that applies overlaysPantelis Antoniou4-0/+193
Since libfdt support overlay application on FDT blobs, provide a command line tool that applies an arbitrary number of overlays, one after another to a base fdt blob and output the result in the given file. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-06-14manual: Document missing optionsPantelis Antoniou1-1/+5
The -d and -s options were undocumented. Add an entry in the manual. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-06-08dtc: fix sprintf() format string error, againDavid Gibson2-1/+2
2a42b14 "dtc: check.c fix compile error" changed a format string using %lx which wasn't correct for all platforms. Unfortunately it changed it to %zx, which is wrong for a different set of platforms (and only right on the others by accident). The parameter we're formatting here is uint64_t, not size_t, so we need to use the PRIx64 macro from <inttypes.h> to get this right. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-05-20Makefile: Fix build on MSYS2 and CygwinCufi, Carles1-1/+5
The host compiler on MSYS2 and Cygwin does not allow the -fPIC option, issuing a warning that is treated as an error and stops the build. Detect whether we're running under MSYS2 or Cygwin and avoid adding -fPIC to prevent the error from happening. Tested on Linux, MSYS2 and Cygwin. Signed-off-by: Carles Cufi <carles.cufi@gmail.com> [dwg: Added explicit empty CFLAGS for clarity] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-05-19Clean up shared library compile/link optionsDavid Gibson1-6/+8
- Allow overriding of shared library compile time flags for platforms whic need it - Include -fPIC in the link flags variable instead of including it raw in the target rule - Cosmetic formatting tweaks Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-05-17Suppress expected error message in fdtdump testDavid Gibson1-1/+1
Since 548aea2 "fdtdump: Discourage use of fdtdump", fdtdump unconditionally prints a message discouraging its own use except for debugging purposes. This shows up messily in the "make check" output, so suppress it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-05-17dtc: check.c fix compile errorShuah Khan1-1/+1
Fix the following compile error found on odroid-xu4: checks.c: In function ‘check_simple_bus_reg’: checks.c:876:41: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t{aka long long unsigned int}’ [-Werror=format=] snprintf(unit_addr, sizeof(unit_addr), "%lx", reg); ^ checks.c:876:41: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Werror=format=] cc1: all warnings being treated as errors Makefile:304: recipe for target 'checks.o' failed make: *** [checks.o] Error 1 Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> [dwg: Correct new format to be correct in general] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-19Fix get_node_by_path string equality checkTim Montague3-2/+26
When determining if to recurse into a node, get_node_by_path does not check if the length of each node name is equal. If searching for /foo/baz, this can result in recursing into /foobar because strneq("foo", "foobar", 3) is true. This can result in a reference to /foo/baz to be incorrectly set to /foobar/baz. A test for this was added. Signed-off-by: Tim Montague <tmontague@ghs.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-18fdtdump: Discourage use of fdtdumpDavid Gibson1-0/+5
fdtdump is, and always has been, a quick-and-dirty debugging tool. However I keep getting reports of people using it for real work. For production decompiling of a dtb, dtc in -I dtb -O dts mode is the right tool. In the hopes of getting that message out there, add a warning message to fdtdump to discourage its use. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-18fdtdump: Fix over-zealous version checkDavid Gibson1-1/+1
It's perfectly valid for a dtb to have version and last compat version set to the same value, and that value can be 17 (the latest defined version). However, since 0931cea "dtc: fdtdump: check fdt if not in scanning mode" fdtdump will refuse to process such a dtb. We get away with this in many cases because dtc's typical output has last compat version equal to 16, rather than 17, but it's still a bug. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-09Fix a few whitespace and style nitsSimon Glass4-7/+6
These were noticed when synching with U-Boot's downstream tree. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-08pylibfdt: Use setup.py to build the swig fileSimon Glass1-9/+5
Since we are using the standard .i extension for the swig file, we can use setup.py to build the wrapper. Drop the existing build code since it is not needed. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-08pylibfdt: Use Makefile constructs to implement NO_PYTHONSimon Glass2-10/+12
The current mechanism uses a shell construct, but it seems better to use a Makefile approach. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-08pylibfdt: Allow setup.py to operate stand-aloneSimon Glass5-16/+112
At present we require that setup.py is executed from the Makefile, which sets up various important things like the list of files to build and the version number. However many installation systems expect to be able to change to the directory containing setup.py and run it. This allows them to support (for example) building/installing for multiple Python versions, varying installation paths, particular C flags, etc. The problem in implementing this is that we don't want to duplicate the information in the Makefile. A common solution (so I am told) is to parse the Makefile to obtain the required information. Update the setup.py script to read a few Makefiles when it does not see the required information in its environment. This allows installation using: ./pylibfdt/setup.py install Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-07Add Coverity Scan supportDavid Gibson1-0/+14
I've recently signed up dtc for Coverity Scan coverage. This adds magic to the .travis.yml file to submit builds to Coverity for analysis. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-07pylibfdt: Fix code style in setup.pySimon Glass1-8/+9
We should follow PEP8 even for our setup() call. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-07pylibfdt: Rename libfdt.swig to libfdt.iSimon Glass2-1/+1
The .i extension allows Python distutils to automatically handle the swig file. Rename it. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-04-02Add a libfdt function to write a property placeholderSimon Glass7-2/+40
The existing function to add a new property to a tree being built requires that the entire contents of the new property be passed in. For some applications it is more convenient to be able to add the property contents later, perhaps by reading from a file. This avoids double-buffering of the contents. Add a new function to support this and adjust the existing fdt_property() to use it. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-29pylibfdt: Use the call function to simplify the MakefileSimon Glass1-7/+7
This is in a separate patch since I not sure if GNU make features are permitted in the Makefile. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-29pylibfdt: Use the correct libfdt version in the moduleSimon Glass2-2/+4
Use the same version number in the module as with the rest of libfdt. This can be examined with: import pkg_resources print pkg_resources.require('libfdt')[0].version Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-29pylibfdt: Enable installation of Python moduleSimon Glass3-1/+22
Adjust the setup script to support installation, and call it from the Makefile if enabled. It will be disabled if we were unable to build the module (e.g. due to swig being missing), or the NO_PYTHON environment variable is set. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-29pylibfdt: Allow building to be disabledSimon Glass2-0/+7
Some build systems want to build python libraries separately from the rest of the build. Add a NO_PYTHON option to enable this. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-27.travis.yml: Add builds with and without Python library prerequisitesDavid Gibson1-0/+11
To make sure the Makefile behaves in both cases, make Travis matrix builds with and without swig installed. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-27pylibfdt: Use package_dir to set the package directorySimon Glass2-2/+4
At present we manually move _libfdt.so into the correct place. Provide a package directory so we can avoid needing to do this. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-27pylibfdt: Use environment to pass C flags and filesSimon Glass2-11/+8
At present setup.py adjusts its command line when running, so that the C flags and file list can be passed as arguments. Pass them in environment variables instead, so we can avoid this messiness. It also allows us to support the 'install' command. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-27pylibfdt: Allow pkg-config to be supplied in the environmentSimon Glass1-1/+2
Some build systems have their own version of the pkg-config tool. Use a variable for this instead of hard-coding it, to allow for this. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Mike Frysinger <vapier@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-22Correct typo: s/pylibgfdt/pylibfdt/David Gibson1-1/+1
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-21Build pylibfdt as part of the normal build processSimon Glass2-2/+60
If swig and the Python are available, build pylibfdt automatically. Adjust the tests to run Python tests too in this case. Signed-off-by: Simon Glass <sjg@chromium.org> [dwg: Make error message clearer that missing swig or python-dev isn't fatal to the whole build] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>