|
NAMEdtc —
device tree compiler
SYNOPSIS
DESCRIPTIONThedtc utility converts between flattened device tree
(FDT) representations. It is most commonly used to generate device tree blobs
(DTB), the binary representation of an FDT, from device tree sources (DTS),
the ASCII text source representation.
The binary can be written in two formats, binary and assembly. The binary is identical to the in-memory representation and can be used directly by firmware, loaders, and so on. The assembly format, documented in ASM FORMAT, will produce the same binary format when assembled, but also includes some global variables that refer to parts of the table. This format is most commonly used to produce a kernel specific to a device, with the device tree blob compiled in. The options are as follows:
ASM FORMATThe assembly format defines several globals that can be referred to from other compilation units, in addition to any labels specified in the source. These are:
CHECKERSThe utility provides a number of semantic checks on the correctness of the tree. These can be disabled with the-W flag. For example,
-W no-type-phandle will disable
the phandle type check. The supported checks are:
OVERLAYSThe utility provides support for generating overlays, also known as plugins. Overlays are a method of patching a base device tree that has been compiled with the-@ flag, with some limited support for
patching device trees that were not compiled with the
-@ flag.
To denote that a DTS is intended to be used as an overlay, /plugin/; should be included in the header, following any applicable /dts-v1/; tag. Conventional overlays are crafted by creating fragment nodes in a root. Each fragment node must have either a target property set to a label reference, or a target-path string property set to a path. It must then have an __overlay__ child node, whose properties and child nodes are merged into the base device tree when the overlay is applied. Much simpler syntactic sugar was later invented to simplify generating overlays. Instead of creating targetted fragments manually, one can instead create a root node that targets a label in the base FDT using the &label syntax supported in conventional DTS. This will indicate that a fragment should be generated for the node, with the given label being the target, and the properties and child nodes will be used as the __overlay__. Additionally, a path-based version of this syntactic sugar is supported. A root node may target a path in the base FDT using a name of the form &{/path}. A fragment will be generated for the node as it is in the &label case, except the target-path property will be set to /path and no target will be set. Both conventional overlays and the later-added syntactic sugar are supported. Overlay blobs can be applied at boot time by setting fdt_overlays in loader.conf(5). Multiple overlays may be specified, and they will be applied in the order given. NODE OMISSIONThis utility supports the /omit-if-no-ref/ statement to mark nodes for omission if they are ultimately not referenced elsewhere in the device tree. This may be used in more space-constrained environments to remove nodes that may not be applicable to the specific device the tree is being compiled for.When the EXAMPLESThe command:dtc -o blob.S -O asm
device.dts will generate a blob.S file from the device tree source device.dts and print errors if any occur during parsing or property checking. The resulting file can be assembled and linked into a binary. The command: dtc -o - -O dts -I dtb
device.dtb will write the device tree source for the device tree blob device.dtb to the standard output. This is useful when debugging device trees. The command: dtc -@ -O dtb -I dts -o device.dtb
device.dts will generate a device.dtb file from the device tree source device.dts with a __symbols__ node included so that overlays may be applied to it. The command: dtc -@ -O dtb -I dts -o
device_overlay.dtbo device_overlay.dts will generate a device_overlay.dtbo file, using the standard extension for a device tree overlay, from the device tree source device_overlay.dts. A __symbols__ node will be included so that overlays may be applied to it. The presence of a /plugin/; directive in device_overlay.dts will indicate to the utility that it should also generate the underlying metadata required in overlays. COMPATIBILITYThis utility is intended to be compatible with the device tree compiler provided by elinux.org. Currently, it implements the subset of features required to build FreeBSD and others that have been requested by FreeBSD developers.The fs input format is not supported. This builds a tree from a Linux /proc/device-tree, a file system hierarchy not found in FreeBSD, which instead exposes the DTB directly via a sysctl. The warnings and errors supported by the elinux.org tool are not documented. This tool supports the warnings described in the CHECKERS section. SEE ALSOfdt(4)STANDARDSThe device tree formats understood by this tool conform to the Power.org Standard for Embedded Power Architecture Platform Requirements (ePAPR), except as noted in the BUGS section and with the following exceptions for compatibility with the elinux.org tool:
The /include/ directive is not part of the standard, however it is implemented with the semantics compatible with the elinux.org tool. It must appear in the top level of a file, and imports a new root definition. If a file, plus all of its inclusions, contains multiple roots then they are merged. All nodes that are present in the second but not the first are imported. Any that appear in both are recursively merged, with properties from the second replacing those from the first and properties child nodes being recursively merged. HISTORYA dtc tool first appeared in FreeBSD 9.0. This version of the tool first appeared in FreeBSD 10.0.AUTHORSdtc was written by David T.
Chisnall. Some features were added later by
Kyle Evans. Note: The fact that the tool and the author share the same initials is entirely coincidental. BUGSThe device tree compiler does not yet support the following features:
The current version performs a very limited set of semantic checks on the tree. This will be improved in future versions.
Visit the GSP FreeBSD Man Page Interface. |