[PATCH] efi_loader: Handle GD_FLG_SKIP_RELOC

Marek Vasut marex at denx.de
Mon Oct 25 20:52:16 CEST 2021

On 10/25/21 8:46 PM, Heinrich Schuchardt wrote:
> On 10/24/21 01:03, Marek Vasut wrote:
>> On 10/11/21 1:36 PM, Heinrich Schuchardt wrote:
>> Hi,
>>>> In case U-Boot starts with GD_FLG_SKIP_RELOC, the efi loader
>>>> relocation code breaks down because it assumes gd->relocaddr
>>>> points to relocated U-Boot code, which is not the case. Add
>>>> special case for handling GD_FLG_SKIP_RELOC, which uses the
>>>> __image_copy_start instead of gd->relocaddr for efi loader
>>>> code relocation source address.
>>> GD_FLG_SKIP_RELOC is only to be used by the x86 EFI app which is
>>> incompatible with CONFIG_EFI_LOADER=y.
>>> lib/efi/efi_app.c:131:  board_init_f(GD_FLG_SKIP_RELOC);
>>> Why do we need this patch?
>> GD_FLG_SKIP_RELOC is set when U-Boot doesn't perform relocation, it has
>> nothing to do with EFI. That case is currently broken, try setting
>> GD_FLG_SKIP_RELOC early on in U-Boot (somewhere early, e.g. in
>> mach_cpu_init()) and the system crashes on board_init_r when
>> initializing EFI.
> You missed the second question:
> Why should the change be ARM specific?

It shouldn't, do you have a more generic idea ?

More information about the U-Boot mailing list