Re: [PATCH v2 04/13] ARM: lds: Add SoC specific sections to go before .text_head_prologue

Jules Maselbas jmaselbas at zdiv.net
Thu Jun 1 14:20:03 PDT 2023



On June 1, 2023 8:34:21 AM GMT+02:00, Ahmad Fatoum <a.fatoum at pengutronix.de> wrote:
> On 25.05.23 01:43, Jules Maselbas wrote:
> > On sunxi platforms the boot rom (BROM) looks for a specific header which
> > will also be loaded in memory, causing pbl, or barebox, image not loaded
> > at the expected BASE addresse. This also cause an issue with relocatable
> > pbl: instruction used for relocation expect the image to be aligned on a
> > 4K page boundary.
> > 
> > The proposed solution here is to allow to soc specific section to be put
> > in the very begging of the .text section, before anything else.
> > 
> > Signed-off-by: Jules Maselbas <jmaselbas at zdiv.net>
> > ---
> > rfc->v2:
> >  - fix typo in commit title
> >  - replace the use of macro with SORT_BY_NAME(.text_head_soc_header*)
> > 
> >  arch/arm/lib/pbl.lds.S | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
> > index 114ec7bc81..059909806e 100644
> > --- a/arch/arm/lib/pbl.lds.S
> > +++ b/arch/arm/lib/pbl.lds.S
> > @@ -27,6 +27,7 @@ SECTIONS
> >  	.text      :
> >  	{
> >  		_stext = .;
> > +		*(SORT_BY_NAME(.text_head_soc_header*))
> 
> You shouldn't need SORT_BY_NAME here, because they should be just one.
sadly there isnt one but two:
 - egon header
 - switch to aarch64 header

moreover the egon header is only needed once ... well actually egon header cannot be executed in aarch64 so it should never came after it (hence only once)
This makes two configurations:
 - eGON header followed by switch to aarch64 (xload conf)
 - only te switch to aarch64 (boot from USB/fel)

maybe this wont be an issue if there is only one image (not xload).

> 
> >  		*(.text_head_prologue*)
> >  		*(.text_head_entry*)
> >  		__bare_init_start = .;
> 



More information about the barebox mailing list