Hi Heinrich
On Wed, 31 Dec 2025 at 12:48, Heinrich Schuchardt
<[email protected]> wrote:
>
> The debug version of the UEFI shell on x86 requires a HOB list.
> This implementation allows to generate an empty HOB list.
>
> Generate the HOB list on the sandbox and on x86 by default.
>
> Signed-off-by: Heinrich Schuchardt <[email protected]>
> ---
> v2:
> Free allocated memory if efi_install_configuration_table() fails.
> ---
> include/efi_hob.h | 32 ++++++++++++++++++++++++++++++++
> include/efi_loader.h | 9 +++++++++
> lib/efi_loader/Kconfig | 8 ++++++++
> lib/efi_loader/Makefile | 1 +
> lib/efi_loader/efi_hob.c | 38 ++++++++++++++++++++++++++++++++++++++
> lib/efi_loader/efi_setup.c | 7 +++++++
> 6 files changed, 95 insertions(+)
> create mode 100644 include/efi_hob.h
> create mode 100644 lib/efi_loader/efi_hob.c
[...]
> +efi_status_t efi_hob_list_register(void)
> +{
> + struct efi_hob_header *hob;
> + efi_status_t ret;
> +
> + hob = efi_alloc(sizeof(struct efi_hob_header));
> + if (!hob)
> + return EFI_OUT_OF_RESOURCES;
> +
> + hob->hob_type = EFI_HOB_TYPE_END_OF_HOB_LIST;
> + hob->hob_length = sizeof(struct efi_hob_header);
I generally prefer sizeof(*hob), but up to you
> + hob->reserved = 0;
> +
> + ret = efi_install_configuration_table(&efi_guid_hob_list, hob);
> + if (ret != EFI_SUCCESS)
> + efi_free_pool(hob);
> +
> + return ret;
> +}
> diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> index f06cf49e443..e9b6ffd27b8 100644
> --- a/lib/efi_loader/efi_setup.c
> +++ b/lib/efi_loader/efi_setup.c
> @@ -7,6 +7,7 @@
>
> #define LOG_CATEGORY LOGC_EFI
>
> +#include <efi_hob.h>
> #include <efi_loader.h>
> #include <efi_variable.h>
> #include <log.h>
> @@ -308,6 +309,12 @@ efi_status_t efi_init_obj_list(void)
> goto out;
> }
>
> + if (IS_ENABLED(CONFIG_EFI_HOB)) {
> + ret = efi_hob_list_register();
> + if (ret != EFI_SUCCESS)
> + goto out;
> + }
> +
> if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
> ret = efi_tcg2_register();
> if (ret != EFI_SUCCESS)
> --
> 2.51.0
>
With or without the change
Reviewed-by: Ilias Apalodimas <[email protected]>