No description
Find a file
Andre Przywara 5bec74a6d1 dtc: Fix signedness comparisons warnings: reservednum
With -Wsign-compare, compilers warn about a mismatching signedness
in comparisons in code using the "reservednum" variable.

There is obviously little sense in having a negative number of reserved
memory entries, so let's make this variable and all its users unsigned.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20210611171040.25524-6-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-15 12:48:25 +10:00
Documentation Update Jon Loeliger's email 2021-01-28 11:24:20 +11:00
libfdt Fix CID 1461557 2021-06-08 16:32:59 +10:00
pylibfdt pylibfdt: Rework "avoid unused variable warning" lines 2021-05-25 13:27:00 +10:00
scripts dtc: Add GPLv2 SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00
tests checks: Drop interrupt_cells_is_cell check 2021-06-08 11:58:43 +10:00
.cirrus.yml Execute tests on FreeBSD with Cirrus CI 2020-03-04 16:40:00 +11:00
.editorconfig Add .editorconfig 2019-10-09 22:41:44 +11:00
.gitignore gitignore: Ignore the swp files 2021-02-03 21:19:53 +11:00
.travis.yml travis.yml: Run tests on the non-x86 builders, too 2019-12-04 16:54:04 +11:00
BSD-2-Clause README.license: Update to reflect SPDX tag usage 2019-06-21 21:06:10 +10:00
checks.c checks: Introduce is_multiple_of() 2021-06-08 15:17:11 +10:00
convert-dtsv0-lexer.l convert-dtsv0: Fix signedness comparisons warning 2020-10-13 15:48:40 +11:00
data.c dtc: Fix signedness comparisons warnings: Wrap (-1) 2020-10-13 15:58:53 +11:00
dtc-lexer.l Make handling of cpp line information more tolerant 2021-06-08 14:15:25 +10:00
dtc-parser.y dtc: Avoid UB when shifting 2020-07-15 20:40:54 +10:00
dtc.c dtc: Fix signedness comparisons warnings: reservednum 2021-06-15 12:48:25 +10:00
dtc.h dtc: Fix signedness comparisons warnings: reservednum 2021-06-15 12:48:25 +10:00
dtdiff dtc: Add GPLv2 SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00
fdtdump.c fdtdump: Fix signedness comparisons warnings 2021-06-15 12:35:54 +10:00
fdtget.c dtc: Replace GPLv2 boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdtoverlay.c fdtoverlay: Return non-zero exit code if overlays can't be applied 2019-10-11 15:58:18 +11:00
fdtput.c dtc: Replace GPLv2 boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
flattree.c dtc: Fix signedness comparisons warnings: reservednum 2021-06-15 12:48:25 +10:00
fstree.c fstree: replace lstat with stat 2019-10-14 17:07:10 +11:00
GPL Update the GPL2 text to the latest revision 2019-05-21 09:58:37 +10:00
livetree.c dtc: Fix signedness comparisons warnings: change types 2020-10-13 15:56:53 +11:00
Makefile Bump version to v1.6.1 2021-06-08 17:00:49 +10:00
Makefile.convert-dtsv0 dtc: Add GPLv2 SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00
Makefile.dtc dtc: Replace GPLv2 boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
Makefile.utils dtc: Add GPLv2 SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00
meson.build meson: fix -Wall warning 2020-12-08 15:30:28 +11:00
meson_options.txt build-sys: add meson build 2020-10-21 14:36:07 +11:00
README Update Jon Loeliger's email 2021-01-28 11:24:20 +11:00
README.license README.license: Update to reflect SPDX tag usage 2019-06-21 21:06:10 +10:00
srcpos.c srcpos: increase MAX_SRCFILE_DEPTH 2021-01-13 12:05:26 +11:00
srcpos.h dtc: Replace GPLv2 boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
TODO dtc: Update TODO files 2007-12-19 08:20:26 -06:00
treesource.c dtc: Consider one-character strings as strings 2020-06-24 16:11:55 +10:00
util.c Use correct inttypes.h format specifier 2019-11-07 17:46:43 +01:00
util.h util: limit gnu_printf format attribute to gcc >= 4.4.0 2021-02-07 14:22:39 +11:00
version_gen.h.in build-sys: add meson build 2020-10-21 14:36:07 +11:00
yamltree.c yamltree: Remove marker ordering dependency 2021-06-08 11:53:19 +10:00

The source tree contains the Device Tree Compiler (dtc) toolchain for
working with device tree source and binary files and also libfdt, a
utility library for reading and manipulating the binary format.

DTC and LIBFDT are maintained by:

David Gibson <david@gibson.dropbear.id.au>
Jon Loeliger <loeliger@gmail.com>


Python library
--------------

A Python library is also available. To build this you will need to install
swig and Python development files. On Debian distributions:

   sudo apt-get install swig python3-dev

The library provides an Fdt class which you can use like this:

$ PYTHONPATH=../pylibfdt python3
>>> import libfdt
>>> fdt = libfdt.Fdt(open('test_tree1.dtb', mode='rb').read())
>>> node = fdt.path_offset('/subnode@1')
>>> print(node)
124
>>> prop_offset = fdt.first_property_offset(node)
>>> prop = fdt.get_property_by_offset(prop_offset)
>>> print('%s=%s' % (prop.name, prop.as_str()))
compatible=subnode1
>>> node2 = fdt.path_offset('/')
>>> print(fdt.getprop(node2, 'compatible').as_str())
test_tree1

You will find tests in tests/pylibfdt_tests.py showing how to use each
method. Help is available using the Python help command, e.g.:

    $ cd pylibfdt
    $ python3 -c "import libfdt; help(libfdt)"

If you add new features, please check code coverage:

    $ sudo apt-get install python3-coverage
    $ cd tests
    # It's just 'coverage' on most other distributions
    $ python3-coverage run pylibfdt_tests.py
    $ python3-coverage html
    # Open 'htmlcov/index.html' in your browser


To install the library via the normal setup.py method, use:

    ./pylibfdt/setup.py install [--prefix=/path/to/install_dir]

If --prefix is not provided, the default prefix is used, typically '/usr'
or '/usr/local'. See Python's distutils documentation for details. You can
also install via the Makefile if you like, but the above is more common.

To install both libfdt and pylibfdt you can use:

    make install [SETUP_PREFIX=/path/to/install_dir] \
            [PREFIX=/path/to/install_dir]

To disable building the python library, even if swig and Python are available,
use:

    make NO_PYTHON=1


More work remains to support all of libfdt, including access to numeric
values.


Tests
-----

Test files are kept in the tests/ directory. Use 'make check' to build and run
all tests.

If you want to adjust a test file, be aware that tree_tree1.dts is compiled
and checked against a binary tree from assembler macros in trees.S. So
if you change that file you must change tree.S also.


Mailing list
------------
The following list is for discussion about dtc and libfdt implementation
mailto:devicetree-compiler@vger.kernel.org

Core device tree bindings are discussed on the devicetree-spec list:
mailto:devicetree-spec@vger.kernel.org