Help needed: EFI debug
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 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
Quoted 5 lines · Michael Lawnick
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.
Quoted 10 lines
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 forputc().
Next I triedefi_st_printf()but this already crashes in U-Boot startup context.
How do you achieveprintf()debugging in this scenario? Which initialization steps are required to getefi_st_printf()working outsideself_testcontext?
Quoted 2 lines
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.
At UEFI runtime you might be able to invoke a Linux syscall. I never tried it.
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.
Best regards
Heinrich
Am 13.01.2023 um 15:52 schrieb Heinrich Schuchardt:
Quoted 11 lines · Michael Lawnick
Quoted 5 lines
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 thisHello 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.
Quoted 10 lines
Quoted 10 lines
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 forputc().
Next I triedefi_st_printf()but this already crashes in U-Boot startup context.
How do you achieveprintf()debugging in this scenario? Which initialization steps are required to getefi_st_printf()working outsideself_testcontext?
Quoted 6 lines
Quoted 2 lines
TIA & KR
MichaelU-Boots print functions can only be used before
ExitBootServices(). Don't use any library function that is not declared__efi_runtimeafter this point.
that was my problem.
Quoted 2 lines
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.
Quoted 6 lines
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 instanceBoth calls are needed.
Nice ugly idea :-)
THX
Michael