[PATCH] env: Leave invalid env for nowhere location
marex at denx.de
Thu Jun 10 15:28:30 CEST 2021
On 6/10/21 10:25 AM, Kunihiko Hayashi wrote:
>>> gd->reloc_off is relocated address offset from zero, however,
>>> gd->env_addr has still non-relocated address.
>>> >>>> | gd->env_addr += gd->reloc_off;
>>> I think the env should be relocated if CONFIG_SYS_RELOC_GD_ENV_ADDR=y.
>>> But this code sets gd->env_addr incorrectly.
>>> In that case, there is a non-relocated <textbase> address instead of
>>> This should be "gd->env_addr = (gd->env_addr - <textbase>) +
>>> However, I'm not sure how we get non-relocated <textbase> address.
>> Maybe what you need to do is store current $pc register when you enter
>> U-Boot very early on, in _start function, and then use it here ?
>> Although, I am not entirely sure whether this is still possible on arm64.
> Exactly. I guess it's reasonable to fix gd->env_addr when
> before relocation. I'll try it.
That sounds good, thank you !
More information about the U-Boot