[PATCH] board_f: Copy GD to new GD even if relocation disabled

Marek Vasut marex at denx.de
Fri Oct 15 16:29:06 CEST 2021


On 10/14/21 3:52 AM, Peng Fan (OSS) wrote:
[...]
>> diff --git a/common/board_f.c b/common/board_f.c
>> index 3dc0eaa59c..2161a7411d 100644
>> --- a/common/board_f.c
>> +++ b/common/board_f.c
>> @@ -674,6 +674,7 @@ static int reloc_bloblist(void)
>>   static int setup_reloc(void)
>>   {
>>       if (gd->flags & GD_FLG_SKIP_RELOC) {
>> +        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
>>           debug("Skipping relocation due to flag\n");
>>           return 0;
>>       }
>>
> 
> I still think my patch is better :)
> https://patchwork.ozlabs.org/project/uboot/patch/20211013095445.18428-1-peng.fan@oss.nxp.com/ 
> 
> 
> But anyway if you prefer, you could have a v2 to include dtb relocation.

Your patch does not reflect the gd->reloc_off update in new_gd in case 
GD_SKIP_RELOC_FLAG is NOT set, that's a bug. This patch does not have 
that problem. I thought about expanding the if above to deduplicate the 
memcpy, but that looked rather ugly, but we can try that instead.


More information about the U-Boot mailing list