Add support for sorting EFI variables by name when using printenv -e.
The -s flag sorts variables alphabetically before display, useful when
dealing with large numbers of variables.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: Improvements to env print -e
Printing EFI variables can be quite verbose, with many hundreds of lines
of text. Part of this is because GUIDs and hex dumps are included. It
can also be hard to find a few variables visually in an unsorted list.
This series makes the feature more user-friendly:
- Puts verbose output behind a -v flag, so that 'env print -e' behaves
more like 'env print'
- Adds a -s option to sort the list
END
Series-links: 1:15
Rather than printing as we go, add variables to an alist so they can be
printed when all variables are present.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than freeing the variable in several places, put it at the end.
Assume failure by default, returning success only if all steps passed.
Signed-off-by: Simon Glass <sjg@chromium.org>
This variable name is quite long. There is only one 'name' (the variable
name) and it has to be u16 as it is an EFI variable. So rename it to
'name'.
Signed-off-by: Simon Glass <sjg@chromium.org>
Change the default behavior of 'printenv -e' to show only EFI variable
names. The previous verbose output is now available with the -v flag.
This makes the command more user-friendly for quick variable listing.
Update documentation to reflect the new behavior and provide examples
of all three output modes: default (names only), -n (details without
hex dump), and -v (full verbose output).
It might be nicer to use -d to enable the dump, rather than have it on
by default.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Now that the EFI app supports booting Ubuntu via the EFI bootmeth, add
a test for this, for ARM. This uses the sjg lab.
Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: app: Support booting an OS
This series completes the work to get the EFI app booting an EFI
application (e.g. Ubuntu):
- efidebug dh now works, and is slightly enhanced
- device paths which refer to the underlying EFI layer can now be
requested by the app
- a test is provided, for EFI on ARM booting into Ubuntu using the sjg
lab
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:12
Add proper device-path handling for UCLASS_EFI_MEDIA devices in both
dp_size() and dp_fill() functions. This enables EFI applications to use
firmware device-paths for media devices accessed through the EFI block
I/O protocol.
Add some debugging while we are here.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
If a component name is available, show it, along with the supported
languages.
Also indicate at the top if the handle is a driver, rather than listing
that protocol at the end.
Signed-off-by: Simon Glass <sjg@chromium.org>
Make use of the boot-time services rather than internal functions, so
that the app can implement this command.
Signed-off-by: Simon Glass <sjg@chromium.org>
The 'efidebug dh' command dereferences a handle to obtain the device
name.
The format of an EFI handle is not defined by the spec, so when running
in the app we cannot assume that the handle can be dereferenced. Even if
the EFI provider happens to be U-Boot it might be a different version.
So don't try display the device name with the app.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than accessing the EFI loader's structure, create an
efi_get_boot() function to match that used by the app, so that the
call to protocols_per_handle() can operate in the app as well.
Signed-off-by: Simon Glass <sjg@chromium.org>
Even if this is a subtle dig at EFI, it is only used once and there is
not much benefit in retaining it. Access the system-table directly,
instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
The intend of this macro is to debug calls from an app. But the efidebug
command is not an app, so it really doesn't make a lot of sense to call
via that macro. Remove EFI_CALL() from do_efi_show_handles() so that the
app can use this code.
Signed-off-by: Simon Glass <sjg@chromium.org>
If only a single test runs, it does not set the max_count variable, so
it remains as zero. Handle this situation as a special case.
Signed-off-by: Simon Glass <sjg@chromium.org>
Archived series currently cause an error when autolink is attempted. Add
a check to avoid this.
Series-to: u-boot
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:458284
The name 'x86a' must be parsed as a branch name, not as versio 86 of
branch 'x'. Correct the regex and add a test for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Sometimes series don't have a cover letter. Add a --use-commit option to
easily use the first commit's subject instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Sometimes it is useful to include archived series in the progress report
so you can see all the work completed. Add a flag for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Sometimes it is useful to include archived series in the listing so you
can see which series could potentially be unarchived. Add a flag for
this.
Add a --include-archived option to the 'series ls' command for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
This function is needed by 'patman status', meaning that it must import
cser_helper which needs pygit2
Move it to patchstream so that pygit2 is not needed for the
'patman status' command.
Signed-off-by: Simon Glass <sjg@chromium.org>
If pygit2 does not exist, patman refuses to work at all, but most
subcommands don't need it. Move the imports to resolve this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Mention the efidebug command specifically the EFI-app documentaion, to
highlight its usefulness.
Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: Move towards the EFI app booting EFI applications
This series adds various new features to the EFI app, mostly by moving
code over from the EFI loader implementation.
In particular it adds support for the efidebug command (with only a
subset of subcommands so far).
The main approach is to make use of the system table (for both the app
and the loader) instead of directly calling EFI-loader code.
It also includes a few fixes, which likely have no effect but will help
to avoid confusion in future.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-version: 2
Series-changes: 2
- Mention the 'dh' subcommand
- Mention that 'order' allows the boot order to be changed
- Mention the eficonfig command and the underlying UEFI firmware
Series-links: 2:10
The app has a function of this name, but it does not return any value.
Return success (always) so that we can use the same signature.
Signed-off-by: Simon Glass <sjg@chromium.org>
This file contains some useful utility functions which are not specific
to the EFI loader. Move them to lib/efi so they can be used by the app.
Signed-off-by: Simon Glass <sjg@chromium.org>
This printf() extension is useful for the app. Add an implementation of
efi_dp_str() so that it works as expected.
Signed-off-by: Simon Glass <sjg@chromium.org>
Some protocols are generally useful for the app and it makes sense to
store these in the priv struct rather than requesting them each time
they are needed.
Add a new function which locates the device-path-to-text protocol and
stores it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Seeing the boot order is useful in the app. Everything we need is
present except an implementation of efi_query_variable_info_int(), so
add that and enable 'efidebug boot dump'.
Signed-off-by: Simon Glass <sjg@chromium.org>
The global-variable GUID is already set in the common device_path.c file
but its declaration is only in the efi_loader header.
Move it and also move over the FDT GUIDs.
Signed-off-by: Simon Glass <sjg@chromium.org>
These functions are useful for the app as well as the loader.
For now, efi_set_load_options() calls efi_search_protocol() which is
still in the loader, but we can provide an 'app' version when needed. It
doesn't seem worth keeping that one function in a separate file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Checking if a variable is a load option is useful for the app, so move
efi_varname_is_load_option() and u16_tohex() into a new helper.c file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a function which allows the app to obtain the runtime services
without first obtaining the priv data.
Make use of this in efi_vars.c
Signed-off-by: Simon Glass <sjg@chromium.org>
It is useful to be able to see the available tables in the app, so
enable this subcommand. Provide an implementation of efi_get_sys_table()
that works for the EFI loader.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is helpful to see the memory map in some cases, so enable this
subcommand in the app.
Unfortunately we cannot assume that desc_size is the same in the
underlying EFI implementation, so use a variable for that.
Signed-off-by: Simon Glass <sjg@chromium.org>
This command is useful for the app, so enable it. For now most of the
subcommands don't work, so provide a message in that case. This seems
better than silently pretending that the subcommand doesn't exist.
Signed-off-by: Simon Glass <sjg@chromium.org>
This call seems to have been added in an unrelated commit, likely to fix
a bug:
046fe7b507 ("efi_loader: efi_dp_from_file() expect UTF-8 path")
With standard boot we don't need to call efi_set_bootdev(). Also this
function is not available in the EFI app.
So for now, add a condition, to avoid a build error in the x86 app when
CONFIG_EFI_BINARY_EXEC is enabled.
Signed-off-by: Simon Glass <sjg@chromium.org>
While this doesn't really affect anything in practice, it is better to
deal with an incorrect use of this function (calling it with a UCLASS
which is not enabled).
Add a break after the UCLASS_BLK case, to help this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a48a8929de ("efi: Move most of efi_device_path into lib/efi")
The conversion to using a size variable was missing a break statement
for the BLK case. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: ffde1a3922 ("efi: Use variables in dp_size()")