2 .\" Copyright (c) 2013 David Chisnall
3 .\" All rights reserved.
5 .\" This software was developed by SRI International and the University of
6 .\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7 .\" ("CTSRD"), as part of the DARPA CRASH research programme.
9 .\" This software was developed by SRI International and the University of
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .Nd device tree compiler
42 .Op Fl b Ar boot_cpu_id
43 .Op Fl d Ar dependency_file
44 .Op Fl i Ar include_path
45 .Op Fl E Ar [no-]checker_name
46 .Op Fl H Ar phandle_format
47 .Op Fl I Ar input_format
48 .Op Fl O Ar output_format
49 .Op Fl o Ar output_file
53 .Op Fl V Ar blob_version
54 .Op Fl W Ar [no-]checker_name
55 .Op Fl P Ar predefined_properties
60 utility converts between flattened device tree (FDT) representations.
61 It is most commonly used to generate device tree blobs (DTB), the binary
62 representation of an FDT, from device tree sources (DTS), the ASCII text source
65 The binary can be written in two formats, binary and assembly.
66 The binary is identical to the in-memory representation and can be used
67 directly by firmware, loaders, and so on.
68 The assembly format, documented in
70 will produce the same binary format when assembled, but also includes some
71 global variables that refer to parts of the table.
72 This format is most commonly used to produce a kernel specific to a device,
73 with the device tree blob compiled in.
75 The options are as follows:
76 .Bl -tag -width indent
77 .It Fl d Ar dependency_file
78 Writes a dependency file understandable by make to the specified file.
79 This file can be included in a Makefile and will ensure that the output file
80 depends on the input file and any files that it includes.
81 This argument is only useful when the input is DTS, as only the source format
82 has a notion of inclusions.
83 .It Fl i Ar include_path
84 Adds a path to search for include files.
85 .It Fl E Ar [no-]checker_name
86 Enable or disable a specified checker.
87 The argument is the name of the checker.
88 The full list of checkers is given in
91 Emit a __symbols__ node to allow plugins to be loaded.
93 Force the tool to attempt to generate the output, even if the input had errors.
95 Display the help text and exit.
96 .It Fl H Ar phandle_format
97 Specifies the type of phandle nodes to generate in the output.
100 .Bl -tag -width indent -compact
102 Generate the legacy linux,phandle nodes expected by older systems.
104 Generate the phandle nodes, as described in the ePAPR specification.
105 This is the most sensible option for device trees being used with
108 Generate both, for maximum compatibility.
110 .It Fl I Ar input_format
111 Specifies the input format.
114 .Bl -tag -width indent -compact
117 The binary representation of the FDT.
120 The ASCII representation of the FDT.
121 This is the default if the input format is not explicitly stated.
123 .It Fl O Ar output_format
124 Specifies the output format.
127 .Bl -tag -width indent -compact
129 Assembler source for generating a device tree blob, as described in
133 The binary representation of the FDT.
134 This is the default if the output format is not explicitly stated.
137 The ASCII representation of the FDT.
139 .It Fl o Ar output_file
140 The file to which to write the output.
141 .It Fl P Ar predefined_macro
142 Defines a macro, in the form
146 to be used for device tree source files that contain conditional components.
147 This tool supports two extensions to the standard to support conditional
148 compilation of device trees.
150 .Ar /include/if [property]/ "file.dts"
151 directive that is allowed at the start of a file and which will only include
152 the specified file if it the specified property is passed with this flag.
155 format for property values.
156 These allow property value to be specified on the command line.
158 The number of empty reservation table entries to pad the table with.
159 This is useful if you are generating a device tree blob for bootloader or
160 similar that needs to reserve some memory before passing control to the
163 The minimum size in bytes of the blob.
164 The blob will be padded after the strings table to ensure that it is the
166 This is useful for environments where the device tree blob must be modified in
169 The number of bytes of padding to add to the blob.
170 The blob will be padded after the strings table to ensure that it is the
172 This is useful for environments where the device tree blob must be modified in
174 .It Fl W Ar [no-]checker_name
175 Enable or disable a specified checker.
179 Sorts the properties and nodes in the tree.
180 This is mainly useful when using tools like
182 to compare two device tree sources.
183 .It Fl V Ar output_version
184 The version of the format to output.
185 This is only relevant for binary outputs, and only a value of 17 is currently
188 Display the tool version and exit.
193 The assembly format defines several globals that can be referred to from other
194 compilation units, in addition to any labels specified in the source.
197 .Bl -tag -width "dt_strings_start" -compact -offset indent
199 start of the device tree blob.
201 start of the header, usually identical to the start of the blob.
203 start of the reservation map.
205 start of the structure table.
207 end of the structure table.
209 start of the strings table.
211 end of the strings table.
213 end of the device tree blob.
216 The utility provides a number of semantic checks on the correctness of the
218 These can be disabled with the
222 .Fl W Ar no-type-phandle
223 will disable the phandle type check.
224 The supported checks are:
226 .Bl -tag -width "no-type-phandle" -compact -offset indent
228 Checks the type of the
232 Checks the type of the
236 Checks the type of the
240 Checks that all nodes with children have both
248 statements refer to nodes that are merged.
251 The utility provides support for generating overlays, also known as plugins.
252 Overlays are a method of patching a base device tree that has been compiled with
255 flag, with some limited support for patching device trees that were not compiled
260 To denote that a DTS is intended to be used as an overlay,
262 should be included in the header, following any applicable
266 Conventional overlays are crafted by creating
269 Each fragment node must have either a
271 property set to a label reference, or a
273 string property set to a path.
276 child node, whose properties and child nodes are merged into the base device
277 tree when the overlay is applied.
279 Much simpler syntactic sugar was later invented to simplify generating overlays.
280 Instead of creating targeted fragments manually, one can instead create a root
281 node that targets a label in the base FDT using the
283 syntax supported in conventional DTS.
284 This will indicate that a fragment should be generated for the node, with the
287 being the target, and the properties and child nodes will be used as the
290 Additionally, a path-based version of this syntactic sugar is supported.
291 A root node may target a path in the base FDT using a name of the form
293 A fragment will be generated for the node as it is in the
297 property will be set to
303 Both conventional overlays and the later-added syntactic sugar are supported.
305 Overlay blobs can be applied at boot time by setting
309 Multiple overlays may be specified, and they will be applied in the order given.
311 This utility supports the
313 statement to mark nodes for omission if they are ultimately not referenced
314 elsewhere in the device tree.
315 This may be used in more space-constrained environments to remove nodes that may
316 not be applicable to the specific device the tree is being compiled for.
320 flag is used to write symbols, nodes with labels will be considered referenced
321 and will not be removed from the tree.
325 .Dl "dtc -o blob.S -O asm device.dts"
329 file from the device tree source
331 and print errors if any occur during parsing or property checking.
332 The resulting file can be assembled and linked into a binary.
336 .Dl "dtc -o - -O dts -I dtb device.dtb"
338 will write the device tree source for the device tree blob
340 to the standard output.
341 This is useful when debugging device trees.
345 .Dl "dtc -@ -O dtb -I dts -o device.dtb device.dts"
349 file from the device tree source
351 with a __symbols__ node included so that overlays may be applied to it.
355 .Dl "dtc -@ -O dtb -I dts -o device_overlay.dtbo device_overlay.dts"
358 .Pa device_overlay.dtbo
359 file, using the standard extension for a device tree overlay, from the device
361 .Pa device_overlay.dts .
362 A __symbols__ node will be included so that overlays may be applied to it.
366 .Pa device_overlay.dts
367 will indicate to the utility that it should also generate the underlying
368 metadata required in overlays.
370 This utility is intended to be compatible with the device tree compiler
371 provided by elinux.org.
372 Currently, it implements the subset of features
375 and others that have been requested by
381 input format is not supported.
382 This builds a tree from a Linux
383 .Pa /proc/device-tree ,
384 a file system hierarchy not found in
386 which instead exposes the DTB directly via a sysctl.
388 The warnings and errors supported by the elinux.org tool are not documented.
389 This tool supports the warnings described in the
395 The device tree formats understood by this tool conform to the Power.org
396 Standard for Embedded Power Architecture Platform Requirements
398 except as noted in the
400 section and with the following exceptions for compatibility with the elinux.org
405 The target of cross references is defined to be a node name in the
406 specification, but is in fact a label.
409 The /include/ directive is not part of the standard, however it is implemented
410 with the semantics compatible with the elinux.org tool.
411 It must appear in the top level of a file, and imports a new root definition.
412 If a file, plus all of its inclusions, contains multiple roots then they are
414 All nodes that are present in the second but not the first are imported.
415 Any that appear in both are recursively merged, with properties from the second
416 replacing those from the first and properties child nodes being recursively
419 A dtc tool first appeared in
421 This version of the tool first appeared in
426 .An David T. Chisnall .
427 Some features were added later by
430 Note: The fact that the tool and the author share the same initials is entirely
433 The device tree compiler does not yet support the following features:
437 Labels in the middle of property values.
438 This is only useful in the assembly output, and only vaguely useful there, so
439 is unlikely to be added soon.
441 Full paths, rather than labels, as the targets for phandles.
442 This is not very hard to add, but will probably not be added until something
446 The current version performs a very limited set of semantic checks on the tree.
447 This will be improved in future versions.