intro.rst 1.7 KB

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