bootefi.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. .. Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
  3. bootefi command
  4. ===============
  5. Synopsis
  6. --------
  7. ::
  8. bootefi <image_addr>[:<image_size>] [<fdt_addr>]
  9. bootefi bootmgr [<fdt_addr>]
  10. bootefi hello [<fdt_addr>]
  11. bootefi selftest [<fdt_addr>]
  12. Description
  13. -----------
  14. The *bootefi* command is used to launch a UEFI binary which can be either of
  15. * UEFI application
  16. * UEFI boot services driver
  17. * UEFI run-time services driver
  18. An operating system requires a hardware description which can either be
  19. presented as ACPI table (CONFIG\_GENERATE\_ACPI\_TABLE=y) or as device-tree.
  20. The load address of the device-tree may be provided as parameter *fdt\_addr*. If
  21. this address is not specified, the bootefi command will try to fall back in
  22. sequence to:
  23. * the device-tree specified by environment variable *fdt\_addr*
  24. * the device-tree specified by environment variable *fdtcontroladdr*
  25. The load address of the binary is specified by parameter *image_address*. A
  26. command sequence to run a UEFI application might look like
  27. ::
  28. load mmc 0:2 $fdt_addr_r dtb
  29. load mmc 0:1 $kernel_addr_r /EFI/grub/grubaa64.efi
  30. bootefi $kernel_addr_r $fdt_addr_r
  31. The last UEFI binary loaded defines the image file path in the loaded image
  32. protocol.
  33. The value of the environment variable *bootargs* is converted from UTF-8 to
  34. UTF-16 and passed as load options in the loaded image protocol to the UEFI
  35. binary.
  36. image_addr
  37. Address of the UEFI binary.
  38. fdt_addr
  39. Address of the device-tree or '-'. If no address is specifiy, the
  40. environment variable $fdt_addr is used as first fallback, the address of
  41. U-Boot's internal device-tree $fdtcontroladdr as second fallback.
  42. When using ACPI no device-tree shall be specified.
  43. image_size
  44. Size of the UEFI binary file. This argument is only needed if *image_addr*
  45. does not match the address of the last loaded UEFI binary. In this case
  46. a memory device path will be used as image file path in the loaded image
  47. protocol.
  48. Note
  49. UEFI binaries that are contained in FIT images are launched via the
  50. *bootm* command.
  51. UEFI boot manager
  52. '''''''''''''''''
  53. The UEFI boot manager is invoked by the *bootefi bootmgr* sub-command.
  54. Here boot options are defined by UEFI variables with a name consisting of the
  55. letters *Boot* followed by a four digit hexadecimal number, e.g. *Boot0001* or
  56. *BootA03E*. The boot variable defines a label, the device path of the binary to
  57. execute as well as the load options passed in the loaded image protocol.
  58. If the UEFI variable *BootNext* is defined, it specifies the number of the boot
  59. option to execute next. If no binary can be loaded via *BootNext* the variable
  60. *BootOrder* specifies in which sequence boot options shalled be tried.
  61. The values of these variables can be managed using the U-Boot command
  62. *efidebug*.
  63. UEFI hello world application
  64. ''''''''''''''''''''''''''''
  65. U-Boot can be compiled with a hello world application that can be launched using
  66. the *bootefi hello* sub-command. A session might look like
  67. ::
  68. => setenv bootargs 'Greetings to the world'
  69. => bootefi hello
  70. Booting /MemoryMapped(0x0,0x10001000,0x1000)
  71. Hello, world!
  72. Running on UEFI 2.8
  73. Have SMBIOS table
  74. Have device tree
  75. Load options: Greetings to the world
  76. UEFI selftest
  77. '''''''''''''
  78. U-Boot can be compiled with UEFI unit tests. These unit tests are invoked using
  79. the *bootefi selftest* sub-command.
  80. Which unit test is executed is controlled by the environment variable
  81. *efi\_selftest*. If this variable is not set, all unit tests that are not marked
  82. as 'on request' are executed.
  83. To show a list of the available unit tests the value *list* can be used
  84. ::
  85. => setenv efi_selftest list
  86. => bootefi selftest
  87. Available tests:
  88. 'block image transfer' - on request
  89. 'block device'
  90. 'configuration tables'
  91. ...
  92. A single test is selected for execution by setting the *efi\_selftest*
  93. environment variable to match one of the listed identifiers
  94. ::
  95. => setenv efi_selftest 'block image transfer'
  96. => bootefi selftest
  97. Some of the tests execute the ExitBootServices() UEFI boot service and will not
  98. return to the command line but require a board reset.
  99. Configuration
  100. -------------
  101. To use the *bootefi* command you must specify CONFIG\_CMD\_BOOTEFI=y.
  102. The *bootefi bootmgr* sub-command requries CMD\_BOOTEFI\_BOOTMGR=y.
  103. The *bootefi hello* sub-command requries CMD\_BOOTEFI\_HELLO=y.
  104. The *bootefi selftest* sub-command depends on CMD\_BOOTEFI\_SELFTEST=y.
  105. See also
  106. --------
  107. * *bootm* for launching UEFI binaries packed in FIT images
  108. * :doc:`booti<booti>`, *bootm*, *bootz* for launching a Linux kernel without
  109. using the UEFI sub-system
  110. * *efidebug* for setting UEFI boot variables and boot options