No description
Find a file
Pierre-Clément Tosi ef1978abee ANDROID: Merge upstream ed310803ea (v1.6.1)
Upgrade to the latest master from

    git://git.kernel.org/pub/scm/utils/dtc/dtc.git.

at commit ed310803ea.

Bug: 221191119
Bug: 222320399
Bug: 230794395
Bug: 234413190
Change-Id: I6cc623e217641d7db3d4f2c4873cda472da08ef4
(cherry picked from commit 9c26cc838f)
Merged-In: I6cc623e217641d7db3d4f2c4873cda472da08ef4
2022-07-08 09:16:48 +00:00
Documentation ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
fuzzing Create an initial version of libfdt fuzzer. 2022-02-17 01:14:59 +00:00
libfdt ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
pylibfdt ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
scripts dtc: Add GPLv2 SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00
tests ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
.cirrus.yml ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
.editorconfig Add .editorconfig 2019-10-09 22:41:44 +11:00
.gitignore ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
.travis.yml travis.yml: Run tests on the non-x86 builders, too 2019-12-04 16:54:04 +11:00
Android.bp [LSC] Add LOCAL_LICENSE_KINDS to external/dtc 2021-02-12 15:22:26 -08:00
BSD-2-Clause README.license: Update to reflect SPDX tag usage 2019-06-21 21:06:10 +10:00
checks.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
convert-dtsv0-lexer.l ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
data.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
dtc-lexer.l ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
dtc-parser.y ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
dtc.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
dtc.h ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
dtdiff dtc: Add GPLv2 SPDX tags to files missing license text 2019-06-21 21:06:10 +10:00
fdtdump.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
fdtget.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00: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 ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
flattree.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00: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 ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
Makefile ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00: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
MANIFEST.in ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
meson.build ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
meson_options.txt ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
METADATA Add METADATA to dtc: LGPL+GPL=RESTRICTED 2020-04-28 09:59:16 -07:00
MODULE_LICENSE_GPL Add metadata 2017-12-07 15:13:38 -08:00
NOTICE Add metadata 2017-12-07 15:13:38 -08:00
OWNERS Remove hridya@ from OWNERS file 2022-01-06 16:50:50 -08:00
README ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
README.license README.license: Update to reflect SPDX tag usage 2019-06-21 21:06:10 +10:00
README.version Reset master to upstream 2017-02-17 11:16:16 +08:00
setup.py ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
srcpos.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00: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 ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
util.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
util.h ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
version_gen.h.in ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00:00
version_non_gen.h Update dtc to 1.6.0 2020-07-09 14:54:01 -07:00
yamltree.c ANDROID: Merge upstream ed310803ea (v1.6.1) 2022-07-08 09:16:48 +00: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


The library can be installed with pip from a local source tree:

    pip install . [--user|--prefix=/path/to/install_dir]

Or directly from a remote git repo:

    pip install git+git://git.kernel.org/pub/scm/utils/dtc/dtc.git@main

The install depends on libfdt shared library being installed on the host system
first. Generally, using --user or --prefix is not necessary and pip will use the
default location for the Python installation which varies if the user is root or
not.

You can also install everything via make if you like, but pip is recommended.

To install both libfdt and pylibfdt you can use:

    make install [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.


Adding a new function to libfdt.h
---------------------------------

The shared library uses libfdt/version.lds to list the exported functions, so
add your new function there. Check that your function works with pylibfdt. If
it cannot be supported, put the declaration in libfdt.h behind #ifndef SWIG so
that swig ignores it.


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