Help needed: EFI debug

Michael Lawnick ml.lawnick at gmx.de
Tue Jan 17 08:54:58 CET 2023


Am 13.01.2023 um 15:52 schrieb Heinrich Schuchardt:
> On 1/13/23 14:47, Michael Lawnick wrote:
>> Hi,
>>
>> I am trying to printf-debug EFI execution triggered by Linux call.
>> Specifically I remove a persistent variable via Linux console and want
>> to follow execution. Without any printf() this works fine. I need this
>
> Hello Michael,
>
> U-Boot does not implement SetVariable() at runtime yet.
>
Hi Heinrich,

seems we got this by our SoC Vendor who provides us with U-Boot with EFI
support.

>> to refine existing implementation of saving variables to SPI flash.
>>
>> While printf() works in U-Boot startup context it leads to crash when
>> EFI function was called from Linux. Same for putc().
>> Next I tried efi_st_printf() but this already crashes in U-Boot startup
>> context.
>> How do you achieve printf() debugging in this scenario?
>> Which initialization steps are required to get efi_st_printf() working
>> outside self_test context?
>>
>> TIA & KR
>> Michael
>
> U-Boots print functions can only be used before ExitBootServices().
> Don't use any library function that is not declared __efi_runtime after
> this point.

that was my problem.

> At UEFI runtime you might be able to invoke a Linux syscall. I never
> tried it.

Meanwhile I found out that the SPI write is moved into ATF from where I
have much less restrictions. As such my problem is solved for now.

> Or move the debug output into a different UEFI variable using
>
> * efi_var_mem_del() to delete the existing instance
> * efi_var_mem_ins() to create the new instance
>
> Both calls are needed.

Nice ugly idea :-)

THX
Michael




More information about the U-Boot mailing list