dtc-1.8.1

#### Beyond Linux® From Scratch (System V Edition) - Version r13.1-84

### Chapter 13. Programming

- Prev

  Doxygen-1.18.0

- Next

  GCC-16.2.0

- Up
- Home

# dtc-1.8.1

## Introduction to Dtc

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

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://kernel.org/pub/software/utils/dtc/dtc-1.8.1.tar.xz

- Download MD5 sum: 9753bdbf18763efef1f5ae8c0cecb5f6

- Download size: 176 KB

- Estimated disk space required: 14 MB (with tests)

- Estimated build time: 0.2 SBU (with tests)

### Dtc Dependencies

#### Optional

libyaml-0.2.5, SWIG-4.5.1, and texlive-20260301

## Installation of Dtc

Install dtc by running the following commands:

    mkdir build &&
    cd    build &&

    meson setup ..                 \
          --prefix=/usr            \
          --buildtype=release      \
          --default-library=shared \
          -D python=disabled       &&
    ninja

To test the results, issue: meson configure -D werror=false && ninja test.

Now, as the `root` user:

    ninja install

If you have texlive-20260301 installed, you can build the PDF format of the documentation by issuing the following command:

    pushd ../Documentation
      latexmk -bibtex --pdf dtc-paper &&
      latexmk -bibtex --pdf dtc-paper -c
    popd

To install the documentation, as the `root` user issue the following command:

    cp -R ../Documentation -T /usr/share/doc/dtc-1.8.1

If you have installed SWIG-4.5.1 and you wish to install the Python 3 bindings of this package, fix the code for the compatibility with SWIG 4.5.0 or newer first:

    sed -e 's/PyString_FromString/PyUnicode_FromString/' \
        -e 's/PyString_AsString/PyBytes_AsString/'       \
        -e 's/PyInt_AsLong/PyLong_AsLong/'               \
        -i ../pylibfdt/libfdt.i

Build the Python 3 module:

    pip3 wheel -w dist --no-build-isolation --no-deps --no-cache-dir ..

As the `root` user, install the Python 3 module:

    pip3 install --no-index --find-links dist --no-user libfdt

## Command Explanations

`--buildtype=release`: Specify a buildtype suitable for stable releases of the package, as the default may produce unoptimized binaries.

`-D python=disabled`: This switch prevents building the Python 3 binding with the deprecated method (running setup.py directly). We will build the Python 3 binding with the pip3 wheel command separately if wanted.

`CC='gcc -Wl,-z,noexecstack'`: This variable prevents marking the shared libraries in the test suite as requiring executable stack. Glibc 2.41 or later has stopped allowing `dlopen`ing such a shared library so the test suite would fail. But those shared libraries don't really need an executable stack, so we can use `-Wl,-z,noexecstack` to fix up the test suite. It's needed in the `CC` environment for the meson test because those shared libraries are built by a test script instead of the meson/ninja building system, and the test script does not recognize other “common” environment variables like `LDFLAGS`.

## Contents

Installed Programs: convert-dtsv0, dtc, dtdiff, fdtdump, fdtget, fdtoverlay, and fdtput
Installed Library: libfdt.so
Installed Directory: /usr/lib/python3.14/site-packages/libfdt-1.8.1.dist-info and /usr/share/doc/dtc-1.8.1 (optionally)

### Short Descriptions

convert-dtsv0 | converts device tree v0 source to device tree v1
dtc | compiles device tree source (dts) to device tree binary blob (dtb), or de-compiles dtb to dts
dtdiff | compares two different device trees
fdtdump | prints a readable version of a flat device-tree file
fdtget | reads values from device-tree
fdtoverlay | applies a number of overlays to a base device tree blob
fdtput | writes a property value to a device tree
`libfdt.so` | is a utility library for reading and manipulating device trees in the binary format

- Prev

  Doxygen-1.18.0

- Next

  GCC-16.2.0

- Up
- Home