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