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 E Ar [no-]checker_name
45 .Op Fl H Ar phandle_format
46 .Op Fl I Ar input_format
47 .Op Fl O Ar output_format
48 .Op Fl o Ar output_file
52 .Op Fl V Ar blob_version
53 .Op Fl W Ar [no-]checker_name
54 .Op Fl P Ar predefined_properties
59 utility converts flattened device tree (FDT) representations.
60 It is most commonly used to generate device tree blobs (DTB), the binary
61 representation of an FDT, from device tree sources (DTS), the ASCII text source
64 The binary can be written in two formats, binary and assembly.
65 The binary is identical to the in-memory representation and can be used
66 directly by firmware, loaders, and so on.
67 The assembly format, documented in
69 will produce the same binary format when assembled, but also includes some
70 global variables that refer to parts of the table.
71 This format is most commonly used to produce a kernel specific to a device,
72 with the device tree blob compiled in.
74 The options are as follows:
75 .Bl -tag -width indent
76 .It Fl d Ar dependency_file
77 Writes a dependency file understandable by make to the specified file.
78 This file can be included in a Makefile and will ensure that the output file
79 depends on the input file and any files that it includes.
80 This argument is only useful when the input is DTS, as only the source format
81 has a notion of inclusions.
82 .It Fl E Ar [no-]checker_name
83 Enable or disable a specified checker.
84 The argument is the name of the checker.
85 The full list of checkers is given in
88 Emit a __symbols__ node to allow plugins to be loaded.
90 Force the tool to attempt to generate the output, even if the input had errors.
92 Display the help text and exit.
93 .It Fl H Ar phandle_format
94 Specifies the type of phandle nodes to generate in the output.
97 .Bl -tag -width indent -compact
99 Generate the legacy linux,phandle nodes expected by older systems.
101 Generate the phandle nodes, as described in the ePAPR specification.
102 This is the most sensible option for device trees being used with
105 Generate both, for maximum compatibility.
107 .It Fl I Ar input_format
108 Specifies the input format.
111 .Bl -tag -width indent -compact
114 The binary representation of the FDT.
117 The ASCII representation of the FDT.
118 This is the default if the input format is not explicitly stated.
120 .It Fl O Ar output_format
121 Specifies the output format.
124 .Bl -tag -width indent -compact
126 Assembler source for generating a device tree blob, as described in
130 The binary representation of the FDT.
131 This is the default if the output format is not explicitly stated.
134 The ASCII representation of the FDT.
136 .It Fl o Ar output_file
137 The file to which to write the output.
138 .It Fl P Ar predefined_macro
139 Defines a macro, in the form
143 to be used for device tree source files that contain conditional components.
144 This tool supports two extensions to the standard to support conditional
145 compilation of device trees.
147 .Ar /include/if [property]/ "file.dts"
148 directive that is allowed at the start of a file and which will only include
149 the specified file if it the specified property is passed with this flag.
152 format for property values.
153 These allow property value to be specified on the command line.
155 The number of empty reservation table entries to pad the table with.
157 useful if you are generating a device tree blob for bootloader or similar that
158 needs to reserve some memory before passing control to the operating system.
160 The minimum size in bytes of the blob.
161 The blob will be padded after the strings table to ensure that it is the
163 This is useful for environments where the device tree blob must be modified in
166 The number of bytes of padding to add to the blob.
167 The blob will be padded after the strings table to ensure that it is the
169 This is useful for environments where the device tree blob must be modified in
171 .It Fl W Ar [no-]checker_name
172 Enable or disable a specified checker.
176 Sorts the properties and nodes in the tree.
177 This is mainly useful when using tools like
179 to compare two device tree sources.
180 .It Fl V Ar output_version
181 The version of the format to output.
182 This is only relevant for binary outputs, and only a value of 17 is currently
185 Display the tool version and exit.
190 The assembly format defines several globals that can be referred to from other
191 compilation units, in addition to any labels specified in the source.
194 .Bl -tag -width "dt_strings_start" -compact -offset indent
196 start of the device tree blob.
198 start of the header, usually identical to the start of the blob.
200 start of the reservation map.
202 start of the structure table.
204 end of the structure table.
206 start of the strings table.
208 end of the strings table.
210 end of the device tree blob.
213 The utility provides a number of semantic checks on the correctness of the
215 These can be disabled with the
219 .Fl W Ar no-type-phandle
220 will disable the phandle type check.
221 The supported checks are:
223 .Bl -tag -width "no-type-phandle" -compact -offset indent
225 Checks the type of the
229 Checks the type of the
233 Checks the type of the
237 Checks that all nodes with children have both
245 statements refer to nodes that are merged.
250 .Dl "dtc -o blob.S -O asm device.dts"
254 file from the device tree source
256 and print errors if any occur during parsing or property checking.
258 resulting file can be assembled and linked into a binary.
262 .Dl "dtc -o - -O dts -I dtb device.dtb"
264 will write the device tree source for the device tree blob
266 to the standard output.
267 This is useful when debugging device trees.
269 This utility is intended to be compatible with the device tree compiler
270 provided by elinux.org.
271 Currently, it implements the subset of features
272 required to build FreeBSD and others that have been requested by FreeBSD
277 input format is not supported.
278 This builds a tree from a Linux
279 .Pa /proc/device-tree ,
280 a file system hierarchy not found in FreeBSD, which instead exposes the DTB
281 directly via a sysctl.
283 The warnings and errors supported by the elinux.org tool are not documented.
284 This tool supports the warnings described in the
290 The device tree formats understood by this tool conform to the Power.org
291 Standard for Embedded Power Architecture Platform Requirements
293 except as noted in the
295 section and with the following exceptions for compatibility with the elinux.org
300 The target of cross references is defined to be a node name in the
301 specification, but is in fact a label.
304 The /include/ directive is not part of the standard, however it is implemented
305 with the semantics compatible with the elinux.org tool.
306 It must appear in the top level of a file, and imports a new root definition.
307 If a file, plus all of its inclusions, contains multiple roots then they are
309 All nodes that are present in the second but not the first are imported.
310 Any that appear in both are recursively merged, with properties from the second
311 replacing those from the first and properties child nodes being recursively
314 A dtc tool first appeared in
316 This version of the tool first appeared in
319 .An David T. Chisnall
321 Note: The fact that the tool and the author share the same initials is entirely
324 The device tree compiler does not yet support the following features:
328 Labels in the middle of property values.
329 This is only useful in the assembly output, and only vaguely useful there, so
330 is unlikely to be added soon.
332 Full paths, rather than labels, as the targets for phandles.
333 This is not very hard to add, but will probably not be added until something
337 The current version performs a very limited set of semantic checks on the tree.
338 This will be improved in future versions.