blob: 36e8cc0d440e7dc818dad69b72fc11dcbdbf721d [file] [log] [blame]
Simon Glass3e9fddf2021-08-01 18:57:10 -06001.. SPDX-License-Identifier: GPL-2.0+
2
3Devicetree Introduction
4=======================
Simon Glass6a055c02021-08-01 18:57:12 -06005
6U-Boot uses a devicetree for configuration. This includes the devices used by
7the board, the format of the image created with binman, which UART to use for
8the console, public keys used for secure boot and many other things.
9
10See :doc:`control` for more information.
11
12Why does U-Boot put <thing> in the devicetree?
13----------------------------------------------
14
15This question comes up a lot with people new to U-Boot, particular those coming
16from Linux who are used to quite strict rules about what can go into the
17devicetree.
18
19U-Boot uses the same devicetree as Linux but adds more things necessary for the
20bootloader environment (see :ref:`dttweaks`).
21
22U-Boot does not have a user space to provide policy and configuration. It cannot
23do what Linux does and run programs and look up filesystems to figure out how to
24boot. So configuration and runtime information goes into the devicetree in
25U-Boot.
26
27Of course it is possible to:
28
29- add tables into the rodata section of the U-Boot binary
30- append some info to the end of U-Boot in a different format
31- modify the linker script to bring in a file with some info in it
32- put things in ACPI tables
33- link in a UEFI hand-off block structure and put things in there
34
35but *please don't*. In general, devicetree is the sane place to hold U-Boot's
36configuration.
37
38So, please, do NOT ask why U-Boot puts <thing> in the devicetree. It is the only
39place it can go. It is a highly suitable data structure for just about anything
40that U-Boot needs to know at runtime.
41
42Note, it is possible to use platdata directly so drivers avoid devicetreee in
43SPL. But of-platdata is the modern way of avoiding devicetree overhead, so
44please use that instead.