Home | History | Annotate | only in /src/external/gpl2/dtc/dist
Up to higher level directory
NameDateSize
BSD-2-Clause22-Dec-20191.6K
checks.c22-Dec-201949.3K
convert-dtsv0-lexer.l22-Dec-20194.4K
data.c22-Dec-20194.5K
Documentation/25-Feb-2026
dtc-lexer.l22-May-20206.2K
dtc-parser.y22-Dec-201910.7K
dtc.c22-Dec-20199.3K
dtc.h22-Dec-20198.3K
dtdiff22-Dec-2019680
fdtdump.c22-Dec-20196K
fdtget.c22-Dec-20198.5K
fdtoverlay.c22-Dec-20194.3K
fdtput.c22-Dec-201910.7K
flattree.c22-Dec-201921.5K
fstree.c22-Dec-20191.6K
GPL22-Dec-201917.7K
livetree.c22-Dec-201920.4K
Makefile22-Dec-20198.2K
Makefile.convert-dtsv022-Dec-2019330
Makefile.dtc22-Dec-2019470
Makefile.utils22-Dec-2019499
pylibfdt/25-Feb-2026
README22-Dec-20192.7K
README.license22-Dec-20192.8K
scripts/25-Feb-2026
srcpos.c22-Dec-20198.6K
srcpos.h22-Dec-20192.9K
tests/25-Feb-2026
TODO04-Dec-2015260
treesource.c22-Dec-20197K
util.c22-Dec-20198.5K
util.h22-Dec-20197K
yamltree.c22-Dec-20196.3K

README

      1 The source tree contains the Device Tree Compiler (dtc) toolchain for
      2 working with device tree source and binary files and also libfdt, a
      3 utility library for reading and manipulating the binary format.
      4 
      5 DTC and LIBFDT are maintained by:
      6 
      7 David Gibson <david (a] gibson.dropbear.id.au>
      8 Jon Loeliger <jdl (a] jdl.com>
      9 
     10 
     11 Python library
     12 --------------
     13 
     14 A Python library is also available. To build this you will need to install
     15 swig and Python development files. On Debian distributions:
     16 
     17    sudo apt-get install swig python3-dev
     18 
     19 The library provides an Fdt class which you can use like this:
     20 
     21 $ PYTHONPATH=../pylibfdt python3
     22 >>> import libfdt
     23 >>> fdt = libfdt.Fdt(open('test_tree1.dtb', mode='rb').read())
     24 >>> node = fdt.path_offset('/subnode@1')
     25 >>> print(node)
     26 124
     27 >>> prop_offset = fdt.first_property_offset(node)
     28 >>> prop = fdt.get_property_by_offset(prop_offset)
     29 >>> print('%s=%s' % (prop.name, prop.as_str()))
     30 compatible=subnode1
     31 >>> node2 = fdt.path_offset('/')
     32 >>> print(fdt.getprop(node2, 'compatible').as_str())
     33 test_tree1
     34 
     35 You will find tests in tests/pylibfdt_tests.py showing how to use each
     36 method. Help is available using the Python help command, e.g.:
     37 
     38     $ cd pylibfdt
     39     $ python3 -c "import libfdt; help(libfdt)"
     40 
     41 If you add new features, please check code coverage:
     42 
     43     $ sudo apt-get install python3-coverage
     44     $ cd tests
     45     # It's just 'coverage' on most other distributions
     46     $ python3-coverage run pylibfdt_tests.py
     47     $ python3-coverage html
     48     # Open 'htmlcov/index.html' in your browser
     49 
     50 
     51 To install the library via the normal setup.py method, use:
     52 
     53     ./pylibfdt/setup.py install [--prefix=/path/to/install_dir]
     54 
     55 If --prefix is not provided, the default prefix is used, typically '/usr'
     56 or '/usr/local'. See Python's distutils documentation for details. You can
     57 also install via the Makefile if you like, but the above is more common.
     58 
     59 To install both libfdt and pylibfdt you can use:
     60 
     61     make install [SETUP_PREFIX=/path/to/install_dir] \
     62             [PREFIX=/path/to/install_dir]
     63 
     64 To disable building the python library, even if swig and Python are available,
     65 use:
     66 
     67     make NO_PYTHON=1
     68 
     69 
     70 More work remains to support all of libfdt, including access to numeric
     71 values.
     72 
     73 
     74 Tests
     75 -----
     76 
     77 Test files are kept in the tests/ directory. Use 'make check' to build and run
     78 all tests.
     79 
     80 If you want to adjust a test file, be aware that tree_tree1.dts is compiled
     81 and checked against a binary tree from assembler macros in trees.S. So
     82 if you change that file you must change tree.S also.
     83 
     84 
     85 Mailing list
     86 ------------
     87 The following list is for discussion about dtc and libfdt implementation
     88 mailto:devicetree-compiler (a] vger.kernel.org
     89 
     90 Core device tree bindings are discussed on the devicetree-spec list:
     91 mailto:devicetree-spec (a] vger.kernel.org
     92 

README.license

      1 Licensing and contribution policy of dtc and libfdt
      2 ===================================================
      3 
      4 This dtc package contains two pieces of software: dtc itself, and
      5 libfdt which comprises the files in the libfdt/ subdirectory.  These
      6 two pieces of software, although closely related, are quite distinct.
      7 dtc does not incorporate or rely on libfdt for its operation, nor vice
      8 versa.  It is important that these two pieces of software have
      9 different license conditions.
     10 
     11 As SPDX license tags in each source file attest, dtc is licensed
     12 under the GNU GPL.  The full text of the GPL can be found in the file
     13 entitled 'GPL' which should be included in this package.  dtc code,
     14 therefore, may not be incorporated into works which do not have a GPL
     15 compatible license.
     16 
     17 libfdt, however, is GPL/BSD dual-licensed.  That is, it may be used
     18 either under the terms of the GPL, or under the terms of the 2-clause
     19 BSD license (aka the ISC license).  The full terms of that license can
     20 be found are in the file entitled 'BSD-2-Clause'. This is, in
     21 practice, equivalent to being BSD licensed, since the terms of the BSD
     22 license are strictly more permissive than the GPL.
     23 
     24 I made the decision to license libfdt in this way because I want to
     25 encourage widespread and correct usage of flattened device trees,
     26 including by proprietary or otherwise GPL-incompatible firmware or
     27 tools.  Allowing libfdt to be used under the terms of the BSD license
     28 makes that it easier for vendors or authors of such software to do so.
     29 
     30 This does mean that libfdt code could be "stolen" - say, included in a
     31 proprietary fimware and extended without contributing those extensions
     32 back to the libfdt mainline.  While I hope that doesn't happen, I
     33 believe the goal of allowing libfdt to be widely used is more
     34 important than avoiding that.  libfdt is quite small, and hardly
     35 rocket science; so the incentive for such impolite behaviour is small,
     36 and the inconvenience caused thereby is not dire.
     37 
     38 Licenses such as the LGPL which would allow code to be used in non-GPL
     39 software, but also require contributions to be returned were
     40 considered.  However, libfdt is designed to be used in firmwares and
     41 other environments with unusual technical constraints.  It's difficult
     42 to anticipate all possible changes which might be needed to meld
     43 libfdt into such environments and so difficult to suitably word a
     44 license that puts the boundary between what is and isn't permitted in
     45 the intended place.  Again, I judged encouraging widespread use of
     46 libfdt by keeping the license terms simple and familiar to be the more
     47 important goal.
     48 
     49 **IMPORTANT** It's intended that all of libfdt as released remain
     50 permissively licensed this way.  Therefore only contributions which
     51 are released under these terms can be merged into the libfdt mainline.
     52 
     53 
     54 David Gibson <david (a] gibson.dropbear.id.au>
     55 (principal original author of dtc and libfdt)
     56 2 November 2007
     57