No description
67849a3279
The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule. meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html) Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv). There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.). libfdt shared library is build following regular naming conventions: instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience. Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build. The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future. (run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20201012073405.1682782-3-marcandre.lureau@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> |
||
---|---|---|
Documentation | ||
libfdt | ||
pylibfdt | ||
scripts | ||
tests | ||
.cirrus.yml | ||
.editorconfig | ||
.gitignore | ||
.travis.yml | ||
BSD-2-Clause | ||
checks.c | ||
convert-dtsv0-lexer.l | ||
data.c | ||
dtc-lexer.l | ||
dtc-parser.y | ||
dtc.c | ||
dtc.h | ||
dtdiff | ||
fdtdump.c | ||
fdtget.c | ||
fdtoverlay.c | ||
fdtput.c | ||
flattree.c | ||
fstree.c | ||
GPL | ||
livetree.c | ||
Makefile | ||
Makefile.convert-dtsv0 | ||
Makefile.dtc | ||
Makefile.utils | ||
meson.build | ||
meson_options.txt | ||
README | ||
README.license | ||
srcpos.c | ||
srcpos.h | ||
TODO | ||
treesource.c | ||
util.c | ||
util.h | ||
version_gen.h.in | ||
yamltree.c |
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 <jdl@jdl.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