spl_boot.rst 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. .. SPDX-License-Identifier: GPL-2.0-or-later
  2. Booting from TPL/SPL
  3. ====================
  4. The main U-Boot binary may be too large to be loaded directly by the Boot ROM.
  5. This was the original driver for splitting up U-Boot into multiple boot stages.
  6. U-Boot typically goes through the following boot phases where TPL, VPL, and SPL
  7. are optional. While many boards use SPL only few use TPL.
  8. TPL
  9. Tertiary Program Loader. Very early init, as tiny as possible. This loads SPL
  10. (or VPL if enabled).
  11. VPL
  12. Verifying Program Loader. Optional verification step, which can select one of
  13. several SPL binaries, if A/B verified boot is enabled. Implementation of the
  14. VPL logic is work-in-progress. For now it just boots into SPL.
  15. SPL
  16. Secondary Program Loader. Sets up SDRAM and loads U-Boot proper. It may also
  17. load other firmware components.
  18. U-Boot
  19. U-Boot proper. This is the only stage containing command. It also implements
  20. logic to load an operating system, e.g. via UEFI.
  21. .. note::
  22. The naming convention on the PowerPC architecture deviates from the other
  23. archtitectures. Here the boot sequence is SPL->TPL->U-Boot.
  24. Further usages for U-Boot SPL comprise:
  25. * launching BL31 of ARM Trusted Firmware which invokes U-Boot as BL33
  26. * launching EDK II
  27. * launching Linux, e.g. :doc:`Falcon Mode <../develop/falcon>`
  28. * launching RISC-V OpenSBI which invokes main U-Boot
  29. Target binaries
  30. ---------------
  31. Binaries loaded by SPL/TPL can be:
  32. * raw binaries where the entry address equals the start address. This is the
  33. only binary format supported by TPL.
  34. * :doc:`FIT <fit/index>` images
  35. * legacy U-Boot images
  36. Configuration
  37. ~~~~~~~~~~~~~
  38. Raw images are only supported in SPL if CONFIG_SPL_RAW_IMAGE_SUPPORT=y.
  39. CONFIG_SPL_FIT=y and CONFIG_SPL_LOAD_FIT=y are needed to load FIT images.
  40. CONFIG_SPL_LEGACY_IMAGE_FORMAT=y is needed to load legacy U-Boot images.
  41. CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y enables checking the CRC32 of legacy U-Boot
  42. images.
  43. Image load methods
  44. ------------------
  45. The image boot methods available for a board must be defined in two places:
  46. The board code implements a function board_boot_order() enumerating up to
  47. five boot methods and the sequence in which they are tried. (The maximum
  48. number of boot methods is currently hard coded as variable spl_boot_list[]).
  49. If there is only one boot method function, spl_boot_device() may be implemented
  50. instead.
  51. The configuration controls which of these boot methods are actually available.
  52. Loading from block devices
  53. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  54. MMC1, MMC2, MMC2_2
  55. These methods read an image from SD card or eMMC. The first digit after
  56. 'MMC' indicates the device number. Required configuration settings include:
  57. * CONFIG_SPL_MMC=y or CONFIG_TPL_MMC=y
  58. To use a PCI connected MMC controller you need to additionally specify:
  59. * CONFIG_SPL_PCI=y
  60. * CONFIG_SPL_PCI_PNP=y
  61. * CONFIG_MMC=y
  62. * CONFIG_MMC_PCI=y
  63. * CONFIG_MMC_SDHCI=y
  64. To load from a file system use:
  65. * CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y
  66. * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="<filepath>"
  67. NVMe
  68. This methods load the image from an NVMe drive.
  69. Required configuration settings include:
  70. * CONFIG_SPL_PCI=y
  71. * CONFIG_SPL_PCI_PNP=y
  72. * CONFIG_SPL_NVME=y
  73. * CONFIG_SPL_NVME_PCI=y
  74. * CONFIG_SPL_NVME_BOOT_DEVICE (number of the NVMe device)
  75. * CONFIG_SYS_NVME_BOOT_PARTITION (partition to read from)
  76. To load from a file system use:
  77. * CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y
  78. * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="<filepath>"
  79. SATA
  80. This method reads an image from a SATA drive.
  81. Required configuration settings include:
  82. * CONFIG_SPL_SATA=y or CONFIG_TPL_SATA=y
  83. To use a PCIe connecte SATA controller you additionally need:
  84. * CONFIG_SPL_PCI=y
  85. * CONFIG_SPL_SATA=y
  86. * CONFIG_SPL_AHCI_PCI=y
  87. * CONFIG_SPL_PCI_PNP=y
  88. To load from a file system use:
  89. * CONFIG_SPL_FS_FAT=y
  90. * CONFIG_SYS_SATA_FAT_BOOT_PARTITION=<partition number>
  91. * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="<filepath>"
  92. USB
  93. The USB method loads an image from a USB block device.
  94. Required configuration settings include:
  95. * CONFIG_SPL_USB_HOST=y
  96. * CONFIG_SPL_USB_STORAGE=y
  97. To use a PCI connected USB 3.0 controller you additionally need:
  98. * CONFIG_SPL_FS_FAT=y
  99. * CONFIG_SPL_PCI=y
  100. * CONFIG_SPL_PCI_PNP=y
  101. * CONFIG_USB=y
  102. * CONFIG_USB_XHCI_HCD=y
  103. * CONFIG_USB_XHCI_PCI=y
  104. To load from a file system use:
  105. * CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y
  106. * CONFIG_SYS_USB_FAT_BOOT_PARTITION=<partition number>
  107. * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="<filepath>"
  108. Loading from raw flash devices
  109. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110. NAND
  111. This method loads the image from NAND flash. To read from raw NAND the
  112. following configuration settings are required:
  113. * CONFIG_SPL_NAND_SUPPORT=y or CONFIG_TPL_NAND_SUPPORT=y
  114. If CONFIG_SPL_NAND_RAW_ONLY=y only raw images can be loaded.
  115. For using UBI (Unsorted Block Images) volumes to read from NAND the
  116. following configuration settings are required:
  117. * CONFIG_SPL_UBI=y or CONFIG_TPL_UBI=y
  118. The UBI volume to read can either be specified
  119. * by name using CONFIG_SPL_UBI_LOAD_BY_VOLNAME or
  120. * by number using CONFIG_SPL_UBI_LOAD_MONITOR_ID.
  121. NOR
  122. This method loads the image from NOR flash.
  123. Required configuration settings include:
  124. * CONFIG_SPL_NOR_SUPPORT=y or CONFIG_TPL_NOR_SUPPORT=y
  125. OneNAND
  126. This methods loads the image from a OneNAND device. To read from raw OneNAND
  127. the following configuration settings are required:
  128. * CONFIG_SPL_ONENAND_SUPPORT=y or CONFIG_TPL_ONENAND_SUPPORT=y
  129. For using the Ubi file system to read from NAND the following configuration
  130. settings are required:
  131. * CONFIG_SPL_UBI=y or CONFIG_TPL_UBI=y
  132. SPI
  133. This method loads an image form SPI NOR flash.
  134. Required configuration settings include:
  135. * CONFIG_SPL_DM_SPI=y
  136. * CONFIG_SPL_SPI_FLASH=y
  137. * CONFIG_SPI_LOAD=y or CONFIG_TPL_SPI_LOAD=y
  138. Sunxi SPI
  139. This method which is specific to Allwinner SoCs loads an image form SPI NOR
  140. flash. Required configuration settings include:
  141. * CONFIG_SPL_SPI_SUNXI=y
  142. Loading from other devices
  143. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  144. BOOTROM
  145. The binary is loaded by the boot ROM.
  146. Required configuration settings include:
  147. * CONFIG_SPL_BOOTROM_SUPPORT=y or CONFIG_TPL_BOOTROM_SUPPORT=y
  148. DFU
  149. :doc:`Device Firmware Upgrade <dfu>` is used to load the binary into RAM.
  150. Required configuration settings include:
  151. * CONFIG_DFU=y
  152. * CONFIG_SPL_RAM_SUPPORT=y or CONFIG TPL_RAM_SUPPORT=y
  153. Ethernet
  154. This method loads an image over Ethernet. The BOOTP protocol is used to find
  155. a TFTP server and binary name. The binary is downloaded via the TFTP
  156. protocol. Required configuration settings include:
  157. * CONFIG_SPL_NET=y or CONFIG_TPL_NET=y
  158. * CONFIG_SPL_ETH_DEVICE=y or CONFIG_DM_USB_GADGET=y
  159. FEL
  160. This method does not actually load an image for U-Boot.
  161. FEL is a routine contained in the boot ROM of Allwinner SoCs which serves
  162. for the initial programming or recovery via USB
  163. RAM
  164. This method uses an image preloaded into RAM.
  165. Required configuration settings include:
  166. * CONFIG_SPL_RAM_SUPPORT=y or CONFIG_TPL_RAM_SUPPORT=y
  167. * CONFIG_RAM_DEVICE=y
  168. Sandbox file
  169. On the sandbox this method loads an image from the host file system.
  170. Sandbox image
  171. On the sandbox this method loads an image from the host file system.
  172. Semihosting
  173. When running in an ARM or RISC-V virtual machine the semihosting method can
  174. be used to load an image from the host file system.
  175. Required configuration settings include:
  176. * CONFIG_SPL_SEMIHOSTING=y
  177. * CONFIG_SPL_SEMIHOSTING_FALLBACK=y
  178. * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME=<path to file>
  179. UART
  180. This method loads an image via the Y-Modem protocol from the UART.
  181. Required configuration settings include:
  182. * CONFIG_SPL_YMODEM_SUPPORT=y or CONFIG_TPL_YMODEM_SUPPORT=y
  183. USB SDP
  184. This method loads the image using the Serial Download Protocol as
  185. implemented by the boot ROM of the i.MX family of SoCs.
  186. Required configuration settings include:
  187. * CONFIG_SPL_SERIAL=y
  188. * CONFIG_SPL_USB_SDP_SUPPORT=y or CONFIG_TPL_USB_SDP_SUPPORT
  189. VBE Simple
  190. This method is used by the VPL stage to extract the next stage image from
  191. the loaded image.
  192. Required configuration settings include:
  193. * CONFIG_VPL=y
  194. * CONFIG_SPL_BOOTMETH_VBE_SIMPLE_FW=y or CONFIG_TPL_BOOTMETH_VBE_SIMPLE_FW=y
  195. XIP
  196. This method executes an image in place.
  197. Required configuration settings include:
  198. * CONFIG_SPL_XIP_SUPPORT