[PATCH 0/4] efi_loader: enable running the debug UEFI shell

Simon Glass sjg at chromium.org
Fri Jan 3 21:11:02 CET 2025


Hi Heinrich,

On Fri, 3 Jan 2025 at 16:35, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
>
>
> Simon Glass <sjg at chromium.org> schrieb am Fr., 3. Jan. 2025, 02:40:
>>
>> Hi Heinrich,
>>
>> On Fri, 3 Jan 2025 at 07:11, Heinrich Schuchardt
>> <heinrich.schuchardt at canonical.com> wrote:
>> >
>> > Currently running the SCT fails on x86. The EFI shell overrides U-Boot's
>> > Simple Text Output Protocol. When ConsoleLoggerPrintWithPageBreak() is
>> > invoked with ConsoleInfo == NULL a crash occurs.
>> >
>> > Debugging requires running the debug version of the UEFI shell.
>> > We can use `add-symbol-file` in gdb to point to
>> > Build/Shell/DEBUG_GCC/X64/ShellPkg/Application/Shell/Shell/DEBUG/Shell.dll
>> > and the load address of Shell.efi.
>> >
>> > The debug version of the UEFI shell checks several requirements and
>> > fails to run without them:
>> >
>> > * HOB list (only on x86)
>> > * HII configuration protocol
>> > * DXE services table
>> >
>> > Implement the missing requirements.
>> >
>> > When starting image add the image load address to the debug output.
>> >
>> > Heinrich Schuchardt (4):
>> >   efi_loader: implement a HOB list
>> >   efi_loader: build with HII configuration protocol
>> >   efi_loader: install DXE services table
>> >   efi_loader: print image load address in StartImage
>> >
>> >  include/efi_dxe.h               |  54 ++++++++++
>> >  include/efi_hob.h               |  32 ++++++
>> >  include/efi_loader.h            |  16 +++
>> >  lib/efi_loader/Kconfig          |  15 +++
>> >  lib/efi_loader/Makefile         |   4 +-
>> >  lib/efi_loader/efi_boottime.c   |   7 +-
>> >  lib/efi_loader/efi_dxe.c        | 176 ++++++++++++++++++++++++++++++++
>> >  lib/efi_loader/efi_hii_config.c |   4 -
>> >  lib/efi_loader/efi_hob.c        |  33 ++++++
>> >  lib/efi_loader/efi_root_node.c  |   3 +
>> >  lib/efi_loader/efi_setup.c      |  13 +++
>> >  11 files changed, 349 insertions(+), 8 deletions(-)
>> >  create mode 100644 include/efi_dxe.h
>> >  create mode 100644 include/efi_hob.h
>> >  create mode 100644 lib/efi_loader/efi_dxe.c
>> >  create mode 100644 lib/efi_loader/efi_hob.c
>>
>> Please can you document how to actually run UEFI like this? Also, is
>> it possible to add a test for this new code?
>
>
> Building the EFI Shell is documented in the EDK II project. U-Boot's bootefi command is already documented. What documentation are you missing?

How about this:

Mention ACTIVE_PLATFORM       = ShellPkg/ShellPkg.dsc

How to run U-Boot (presumably with gdb?)

How to figure out the load address when the .dll is loaded

Perhaps where to set a breakpoint, etc?

I think it could take the form of an example showing the commands to
do the debugging would be helpful. Probably 'history' will do some of
the work for you.

>
> The HII config protocol just returns EFI_OUT_OF_RESOURCES in each function. So there is not much functionality to be tested. We could verify that the protocol as well as the HOB and DXE tables are available.

Yes I think that would be good.

Regards,
Simon


More information about the U-Boot mailing list