efi: doc: Add documentation for about efidebug boot

So far this subcommand is undocumented. Provide some notes.

Also show a better error when 'efidebug boot rm' fails.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-28 15:30:00 -06:00
parent 2a374c390e
commit 370247c724
2 changed files with 74 additions and 6 deletions

View File

@@ -1167,9 +1167,12 @@ static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag,
guid = efi_global_variable_guid;
for (i = 1; i < argc; i++, argv++) {
id = (int)hextoul(argv[1], &endp);
if (*endp != '\0' || id > 0xffff)
id = (int)hextoul(argv[i], &endp);
if (*endp || id > 0xffff) {
printf("Invalid ID '%s', use '0001' for example\n",
argv[i]);
return CMD_RET_FAILURE;
}
efi_create_indexed_name(var_name16, sizeof(var_name16),
"Boot", id);

View File

@@ -13,6 +13,11 @@ Synopsis
::
efidebug boot add -b <bootid> <label> <interface> <devnum>[:<part>] <file>
efidebug boot rm <bootid> [<bootid> ...]
efidebug boot dump
efidebug boot next <bootid>
efidebug boot order [<bootid> ...]
efidebug log
efidebug media
efidebug memmap [-s]
@@ -20,10 +25,44 @@ Synopsis
Description
-----------
The *efidebug* command provides access to debugging features for the EFI-loader
subsystem.
The *efidebug* command provides access some EFI features, including boot
management, memory mapping, and system information.
Only three of the subcommands are documented at present.
efidebug boot
~~~~~~~~~~~~~
The boot subcommands manage UEFI boot options (BootXXXX variables) and boot
order.
**efidebug boot add**
Create or modify a UEFI boot option. The basic syntax is:
``efidebug boot add -b <bootid> <label> <interface> <devnum>[:<part>] <file>``
Where:
- ``<bootid>`` is a hexadecimal boot option ID (e.g., 0001, 000A)
- ``<label>`` is a descriptive name for the boot option
- ``<interface>`` is the storage interface (e.g., mmc, usb, virtio)
- ``<devnum>[:<part>]`` specifies device and optionally partition number
- ``<file>`` is the path to the EFI executable
Additional options include ``-i`` for initrd, ``-s`` for optional data,
and ``-d`` for device tree files.
**efidebug boot rm**
Remove one or more UEFI boot options by their boot IDs.
**efidebug boot dump**
List all defined UEFI boot options with their details including boot ID,
label, and file path.
**efidebug boot next**
Set the BootNext variable to specify which boot option should be used for
the next boot only.
**efidebug boot order**
Show the current boot order when called without arguments, or sets a new
boot order when given a list of boot IDs.
efidebug log
~~~~~~~~~~~~
@@ -57,12 +96,38 @@ address, making it easier to visualize the memory layout in ascending order.
Example
-------
This shows managing UEFI boot options::
=> efidebug boot add -b 1 "Ubuntu" mmc 0:2 /EFI/ubuntu/grubx64.efi
=> efidebug boot add -b 2 "Windows" mmc 0:1 /EFI/Microsoft/Boot/bootmgfw.efi
=> efidebug boot dump
Boot0001:
attributes: A-- (0x00000001)
label: Ubuntu
file_path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/
HD(2,GPT,dfae5a37-e8d5-4a2e-aab6-6b6e8c8cb8a3,0x100800,
0x5dc1800)/\EFI\ubuntu\grubx64.efi
data:
Boot0002:
attributes: A-- (0x00000001)
label: Windows
file_path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/
HD(1,GPT,c8a9e8e7-2d2a-4b8e-9b4f-7b7b3b7b7b7b,0x800,
0x100000)/\EFI\Microsoft\Boot\bootmgfw.efi
data:
=> efidebug boot order 1 2
=> efidebug boot order
BootOrder: 0001 0002
=> efidebug boot next 2
=> efidebug boot rm 1
This shows checking the EFI media devices::
=> efidebug media
Device Media type Device Path
------------------- --------------- -----------
efi_media_1 ahci PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
efi_media_1 ahci PciRoot(0x0)/Pci(0x3,0x0)/
Sata(0x0,0xFFFF,0x0)
efi_media_2 pci PciRoot(0x0)/Pci(0x5,0x0)
This shows checking the UEFI memory map, first unsorted and then sorted by