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