|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| Documentation/ | | 03-May-2024 | - | 1,856 | 1,478 |
| libfdt/ | | 03-May-2024 | - | 5,993 | 2,940 |
| pylibfdt/ | | 03-May-2024 | - | 1,203 | 889 |
| scripts/ | | 03-May-2024 | - | 57 | 31 |
| tests/ | | 03-May-2024 | - | 12,476 | 9,396 |
| .cirrus.yml | D | 03-May-2024 | 405 | 24 | 21 |
| .editorconfig | D | 03-May-2024 | 562 | 31 | 24 |
| .gitignore | D | 03-May-2024 | 148 | 20 | 19 |
| .travis.yml | D | 03-May-2024 | 1.4 KiB | 66 | 55 |
| Android.bp | D | 03-May-2024 | 2.3 KiB | 91 | 84 |
| BSD-2-Clause | D | 03-May-2024 | 1.6 KiB | 33 | 27 |
| GPL | D | 03-May-2024 | 17.7 KiB | 340 | 281 |
| METADATA | D | 03-May-2024 | 43 | 4 | 3 |
| MODULE_LICENSE_GPL | D | 03-May-2024 | 0 | | |
| Makefile | D | 03-May-2024 | 8.5 KiB | 384 | 261 |
| Makefile.convert-dtsv0 | D | 03-May-2024 | 330 | 15 | 5 |
| Makefile.dtc | D | 03-May-2024 | 467 | 24 | 15 |
| Makefile.utils | D | 03-May-2024 | 499 | 32 | 16 |
| NOTICE | D | 03-May-2024 | 17.6 KiB | 341 | 281 |
| OWNERS | D | 03-May-2024 | 180 | 6 | 5 |
| README | D | 03-May-2024 | 2.7 KiB | 92 | 62 |
| README.license | D | 03-May-2024 | 2.8 KiB | 57 | 47 |
| README.version | D | 03-May-2024 | 149 | 4 | 3 |
| TODO | D | 03-May-2024 | 260 | 9 | 8 |
| checks.c | D | 03-May-2024 | 50.4 KiB | 1,956 | 1,533 |
| convert-dtsv0-lexer.l | D | 03-May-2024 | 4.3 KiB | 236 | 187 |
| data.c | D | 03-May-2024 | 4.5 KiB | 257 | 187 |
| dtc-lexer.l | D | 03-May-2024 | 6.1 KiB | 298 | 233 |
| dtc-parser.y | D | 03-May-2024 | 10.6 KiB | 582 | 483 |
| dtc.c | D | 03-May-2024 | 9.2 KiB | 370 | 314 |
| dtc.h | D | 03-May-2024 | 8.9 KiB | 333 | 239 |
| dtdiff | D | 03-May-2024 | 680 | 40 | 26 |
| fdtdump.c | D | 03-May-2024 | 6.1 KiB | 249 | 204 |
| fdtget.c | D | 03-May-2024 | 8.4 KiB | 370 | 258 |
| fdtoverlay.c | D | 03-May-2024 | 4.2 KiB | 209 | 160 |
| fdtput.c | D | 03-May-2024 | 10.7 KiB | 467 | 333 |
| flattree.c | D | 03-May-2024 | 21.4 KiB | 926 | 688 |
| fstree.c | D | 03-May-2024 | 1.5 KiB | 77 | 55 |
| livetree.c | D | 03-May-2024 | 20.3 KiB | 1,033 | 763 |
| srcpos.c | D | 03-May-2024 | 8.6 KiB | 407 | 290 |
| srcpos.h | D | 03-May-2024 | 2.9 KiB | 104 | 57 |
| treesource.c | D | 03-May-2024 | 6.8 KiB | 346 | 295 |
| util.c | D | 03-May-2024 | 8.5 KiB | 469 | 350 |
| util.h | D | 03-May-2024 | 6.9 KiB | 247 | 84 |
| version_non_gen.h | D | 03-May-2024 | 46 | 2 | 1 |
| yamltree.c | D | 03-May-2024 | 6.2 KiB | 234 | 183 |
README
1The source tree contains the Device Tree Compiler (dtc) toolchain for
2working with device tree source and binary files and also libfdt, a
3utility library for reading and manipulating the binary format.
4
5DTC and LIBFDT are maintained by:
6
7David Gibson <david@gibson.dropbear.id.au>
8Jon Loeliger <jdl@jdl.com>
9
10
11Python library
12--------------
13
14A Python library is also available. To build this you will need to install
15swig and Python development files. On Debian distributions:
16
17 sudo apt-get install swig python3-dev
18
19The 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)
26124
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()))
30compatible=subnode1
31>>> node2 = fdt.path_offset('/')
32>>> print(fdt.getprop(node2, 'compatible').as_str())
33test_tree1
34
35You will find tests in tests/pylibfdt_tests.py showing how to use each
36method. Help is available using the Python help command, e.g.:
37
38 $ cd pylibfdt
39 $ python3 -c "import libfdt; help(libfdt)"
40
41If 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
51To install the library via the normal setup.py method, use:
52
53 ./pylibfdt/setup.py install [--prefix=/path/to/install_dir]
54
55If --prefix is not provided, the default prefix is used, typically '/usr'
56or '/usr/local'. See Python's distutils documentation for details. You can
57also install via the Makefile if you like, but the above is more common.
58
59To 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
64To disable building the python library, even if swig and Python are available,
65use:
66
67 make NO_PYTHON=1
68
69
70More work remains to support all of libfdt, including access to numeric
71values.
72
73
74Tests
75-----
76
77Test files are kept in the tests/ directory. Use 'make check' to build and run
78all tests.
79
80If you want to adjust a test file, be aware that tree_tree1.dts is compiled
81and checked against a binary tree from assembler macros in trees.S. So
82if you change that file you must change tree.S also.
83
84
85Mailing list
86------------
87The following list is for discussion about dtc and libfdt implementation
88mailto:devicetree-compiler@vger.kernel.org
89
90Core device tree bindings are discussed on the devicetree-spec list:
91mailto:devicetree-spec@vger.kernel.org
92
README.license
1Licensing and contribution policy of dtc and libfdt
2===================================================
3
4This dtc package contains two pieces of software: dtc itself, and
5libfdt which comprises the files in the libfdt/ subdirectory. These
6two pieces of software, although closely related, are quite distinct.
7dtc does not incorporate or rely on libfdt for its operation, nor vice
8versa. It is important that these two pieces of software have
9different license conditions.
10
11As SPDX license tags in each source file attest, dtc is licensed
12under the GNU GPL. The full text of the GPL can be found in the file
13entitled 'GPL' which should be included in this package. dtc code,
14therefore, may not be incorporated into works which do not have a GPL
15compatible license.
16
17libfdt, however, is GPL/BSD dual-licensed. That is, it may be used
18either under the terms of the GPL, or under the terms of the 2-clause
19BSD license (aka the ISC license). The full terms of that license can
20be found are in the file entitled 'BSD-2-Clause'. This is, in
21practice, equivalent to being BSD licensed, since the terms of the BSD
22license are strictly more permissive than the GPL.
23
24I made the decision to license libfdt in this way because I want to
25encourage widespread and correct usage of flattened device trees,
26including by proprietary or otherwise GPL-incompatible firmware or
27tools. Allowing libfdt to be used under the terms of the BSD license
28makes that it easier for vendors or authors of such software to do so.
29
30This does mean that libfdt code could be "stolen" - say, included in a
31proprietary fimware and extended without contributing those extensions
32back to the libfdt mainline. While I hope that doesn't happen, I
33believe the goal of allowing libfdt to be widely used is more
34important than avoiding that. libfdt is quite small, and hardly
35rocket science; so the incentive for such impolite behaviour is small,
36and the inconvenience caused thereby is not dire.
37
38Licenses such as the LGPL which would allow code to be used in non-GPL
39software, but also require contributions to be returned were
40considered. However, libfdt is designed to be used in firmwares and
41other environments with unusual technical constraints. It's difficult
42to anticipate all possible changes which might be needed to meld
43libfdt into such environments and so difficult to suitably word a
44license that puts the boundary between what is and isn't permitted in
45the intended place. Again, I judged encouraging widespread use of
46libfdt by keeping the license terms simple and familiar to be the more
47important goal.
48
49**IMPORTANT** It's intended that all of libfdt as released remain
50permissively licensed this way. Therefore only contributions which
51are released under these terms can be merged into the libfdt mainline.
52
53
54David Gibson <david@gibson.dropbear.id.au>
55(principal original author of dtc and libfdt)
562 November 2007
57
README.version