Pull request for efi next

UEFI:
 
 Implement a command eficonfig to maintain Load Options and boot order via
 menus.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmMh/kQACgkQxIHbvCwF
 GsSYVhAAlhyCiAQudBJtrOyAA0HDPMio/Fx9F3YV1Laay//6+xHhEh5H94fMr7jP
 BHOrpE+IDKQTiQ8X3FpJpm3FzgQBzu0s4gQ+8fCKwkXCkaPTtWhs3s5SdHN0TWmv
 qGlNbuPdoU+4i7PeBWw87EvOCzh4+snn+l3t+npMxUlZJInGy+6xj0irnSEXTvXV
 lpDRw2UDq3/smAS8tAcR+zriTH5o1Lx+0qPIO9Hw8BSDHOcvZD+S9d6cd6j+M+Wz
 rWk1Bshol6anIZWS5Gnx14ddKF8SQcSiPsDXg2Uj2DvFg7lWepKxAbDJD5CVF9R9
 aEu6THCurc+769A/IHAS9M0EDNnWoUGFSxe0JuEHdYVuGj30RRfzSaciKkNxsxUZ
 UGvDnQ+zdRoj6bTVi4Zf8SeZUTm/04lWMoIF05uhZFDiwxidbMowoNsk9FeKria/
 4vXybfj/IhRwbiAhOUqyDjGuoLj8iVeOAyzin4FnDvBwdshIkSsB+4y1sX1aQv02
 HQbP6WXkiYoYNkw5i9E9ZChioxkzMrn2za3GxWhkTBMJArDw6xSuHMdQsgwWWoqU
 fCKjwe+D96lHq5cKt3DmGTvGxQtx9ckSJGK5r+US5y1udzotjOKc1jqMkMvS3Jyg
 ureTj0wvLYSx+/UirVAZ4IDviDMBVEar79VS2xi+SYBMLeQPy3I=
 =P89S
 -----END PGP SIGNATURE-----

Merge tag 'efi-next-2022-09-14' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for efi next

UEFI:

Implement a command eficonfig to maintain Load Options and boot order via
menus.
This commit is contained in:
Tom Rini 2022-09-14 12:31:44 -04:00
commit 1520af3f84
19 changed files with 3437 additions and 53 deletions

View file

@ -4,6 +4,15 @@
bootmenu command
================
Synopsis
--------
::
bootmenu [delay]
Description
-----------
The "bootmenu" command uses U-Boot menu interfaces and provides
a simple mechanism for creating menus with different boot items.
The cursor keys "Up" and "Down" are used for navigation through
@ -79,6 +88,55 @@ The above example will be rendered as below::
The selected menu entry will be highlighted - it will have inverted
background and text colors.
UEFI boot variable enumeration
''''''''''''''''''''''''''''''
If enabled, the bootmenu command will automatically generate and add
UEFI-related boot menu entries for the following items.
* possible bootable media with default file names
* user-defined UEFI boot options
The bootmenu automatically enumerates the possible bootable
media devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
This auto generated entry is named as "<interface> <devnum>:<part>" format.
(e.g. "usb 0:1")
The bootmenu displays the UEFI-related menu entries in order of "BootOrder".
When the user selects the UEFI boot menu entry, the bootmenu sets
the selected boot variable index to "BootNext" without non-volatile attribute,
then call the uefi boot manager with the command "bootefi bootmgr".
Example bootmenu is as below::
*** U-Boot Boot Menu ***
mmc 0:1
mmc 0:2
debian
nvme 0:1
ubuntu
nvme 0:2
usb 0:2
U-Boot console
Default behavior when user exits from the bootmenu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
User can exit from bootmenu by selecting the last entry
"U-Boot console"/"Quit" or ESC/CTRL+C key.
When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is disabled,
user exits from the bootmenu and returns to the U-Boot console.
When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled, user can not
enter the U-Boot console. When the user exits from the bootmenu,
the bootmenu invokes the following default behavior.
* if CONFIG_CMD_BOOTEFI_BOOTMGR is enabled, execute "bootefi bootmgr" command
* "bootefi bootmgr" fails or is not enabled, then execute "run bootcmd" command.
Configuration
-------------
The "bootmenu" command is enabled by::
CONFIG_CMD_BOOTMENU=y
@ -88,3 +146,19 @@ To run the bootmenu at startup add these additional settings::
CONFIG_AUTOBOOT_KEYED=y
CONFIG_BOOTDELAY=30
CONFIG_AUTOBOOT_MENU_SHOW=y
UEFI boot variable enumeration is enabled by::
CONFIG_CMD_BOOTEFI_BOOTMGR=y
To improve the product security, entering U-Boot console from bootmenu
can be disabled by::
CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE=y
To scan the discoverable devices connected to the buses such as
USB and PCIe prior to bootmenu showing up, CONFIG_PREBOOT can be
used to run the command before showing the bootmenu, i.e.::
CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="pci enum; usb start; scsi scan; nvme scan; virtio scan"

View file

@ -0,0 +1,71 @@
.. SPDX-License-Identifier: GPL-2.0+
.. (C) Copyright 2022, Masahisa Kojima <masahisa.kojima@linaro.org>
eficonfig command
=================
Synopsis
--------
::
eficonfig
Description
-----------
The "eficonfig" command uses U-Boot menu interface and provides
a menu-driven UEFI variable maintenance feature.
The "eficonfig" has the following menu entries.
Add Boot Option
Add new UEFI Boot Option.
User can edit description, file path, and optional_data.
Edit Boot Option
Edit the existing UEFI Boot Option
User can edit description, file path, and optional_data.
Change Boot Order
Change the order of UEFI BootOrder variable.
Delete Boot Option
Delete the UEFI Boot Option
Configuration
-------------
The "eficonfig" command is enabled by::
CONFIG_CMD_EFICONFIG=y
If CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled, user can not enter
U-Boot console. In this case, bootmenu can be used to invoke "eficonfig"::
CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="setenv bootmenu_0 UEFI Maintenance Menu=eficonfig"
How to boot the system with newly added UEFI Boot Option
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
"eficonfig" command is responsible for configuring the UEFI variables,
not directly handle the system boot.
The new Boot Option added by "eficonfig" is appended at the last entry
of UEFI BootOrder variable, user may want to change the boot order
through "Change Boot Order".
If the bootmenu is enabled, CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled,
and "eficonfig" is configured as preboot command, the newly added Boot Options
are enumerated in the bootmenu when user exits from the eficonfig menu.
User may select the entry in the bootmenu to boot the system, or follow
the U-Boot configuration the system already has.
Auto boot with the UEFI Boot Option
'''''''''''''''''''''''''''''''''''
To do auto boot according to the UEFI BootOrder variable,
add "bootefi bootmgr" entry as a default or first bootmenu entry::
CONFIG_PREBOOT="setenv bootmenu_0 UEFI Boot Manager=bootefi bootmgr; setenv bootmenu_1 UEFI Maintenance Menu=eficonfig"
See also
--------
* :doc:`bootmenu<bootmenu>` provides a simple mechanism for creating menus with different boot items

View file

@ -36,6 +36,7 @@ Shell commands
cmd/cyclic
cmd/dm
cmd/echo
cmd/eficonfig
cmd/env
cmd/event
cmd/exception