blob: 3efe9e9df572f7ef1120f72bc24a495a8fefcdee [file] [log] [blame]
Heinrich Schuchardt0c1b71c2020-12-16 22:08:38 +01001.. SPDX-License-Identifier: GPL-2.0+
2.. Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
3
Heinrich Schuchardt60971e62024-01-14 14:53:13 +01004.. index::
5 single: bootefi (command)
6
Heinrich Schuchardt0c1b71c2020-12-16 22:08:38 +01007bootefi command
8===============
9
10Synopsis
11--------
12
13::
14
Heinrich Schuchardt8131c852022-05-19 08:00:56 +020015 bootefi <image_addr>[:<image_size>] [<fdt_addr>]
16 bootefi bootmgr [<fdt_addr>]
17 bootefi hello [<fdt_addr>]
18 bootefi selftest [<fdt_addr>]
Heinrich Schuchardt0c1b71c2020-12-16 22:08:38 +010019
20Description
21-----------
22
23The *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
29An operating system requires a hardware description which can either be
Heinrich Schuchardt56bc2392022-04-02 07:16:56 +020030presented as ACPI table (CONFIG\_GENERATE\_ACPI\_TABLE=y) or as device-tree.
Heinrich Schuchardt0c1b71c2020-12-16 22:08:38 +010031The load address of the device-tree may be provided as parameter *fdt\_addr*. If
32this address is not specified, the bootefi command will try to fall back in
33sequence to:
34
35* the device-tree specified by environment variable *fdt\_addr*
36* the device-tree specified by environment variable *fdtcontroladdr*
37
38The load address of the binary is specified by parameter *image_address*. A
39command 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 Schuchardt7f97d8c2022-04-11 21:06:13 +020047The last UEFI binary loaded defines the image file path in the loaded image
48protocol.
Heinrich Schuchardt0c1b71c2020-12-16 22:08:38 +010049
50The value of the environment variable *bootargs* is converted from UTF-8 to
51UTF-16 and passed as load options in the loaded image protocol to the UEFI
52binary.
53
Heinrich Schuchardt7f97d8c2022-04-11 21:06:13 +020054image_addr
55 Address of the UEFI binary.
56
57fdt_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
63image_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 Schuchardt0c1b71c2020-12-16 22:08:38 +010069Note
70 UEFI binaries that are contained in FIT images are launched via the
71 *bootm* command.
72
73UEFI boot manager
74'''''''''''''''''
75
76The UEFI boot manager is invoked by the *bootefi bootmgr* sub-command.
77Here boot options are defined by UEFI variables with a name consisting of the
78letters *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
80execute as well as the load options passed in the loaded image protocol.
81
82If the UEFI variable *BootNext* is defined, it specifies the number of the boot
83option 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
86The values of these variables can be managed using the U-Boot command
87*efidebug*.
88
89UEFI hello world application
90''''''''''''''''''''''''''''
91
92U-Boot can be compiled with a hello world application that can be launched using
93the *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
106UEFI selftest
107'''''''''''''
108
109U-Boot can be compiled with UEFI unit tests. These unit tests are invoked using
110the *bootefi selftest* sub-command.
111
112Which 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
114as 'on request' are executed.
115
116To 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
129A single test is selected for execution by setting the *efi\_selftest*
130environment variable to match one of the listed identifiers
131
132::
133
134 => setenv efi_selftest 'block image transfer'
135 => bootefi selftest
136
137Some of the tests execute the ExitBootServices() UEFI boot service and will not
138return to the command line but require a board reset.
139
140Configuration
141-------------
142
143To use the *bootefi* command you must specify CONFIG\_CMD\_BOOTEFI=y.
Heinrich Schuchardt56bc2392022-04-02 07:16:56 +0200144The *bootefi bootmgr* sub-command requries CMD\_BOOTEFI\_BOOTMGR=y.
Heinrich Schuchardt0c1b71c2020-12-16 22:08:38 +0100145The *bootefi hello* sub-command requries CMD\_BOOTEFI\_HELLO=y.
146The *bootefi selftest* sub-command depends on CMD\_BOOTEFI\_SELFTEST=y.
147
148See also
149--------
150
151* *bootm* for launching UEFI binaries packed in FIT images
Heinrich Schuchardt56bc2392022-04-02 07:16:56 +0200152* :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