[U-Boot] [PATCH] arm: Allow u-boot to run from offset base address

Steve Rae srae at broadcom.com
Tue Jun 10 21:38:42 CEST 2014



On 14-06-10 11:13 AM, Wolfgang Denk wrote:
> Dear Steve,
>
> In message <539746C4.9040004 at broadcom.com> you wrote:
>>
>> There could be "many" reasons why the CONFIG_SYS_TEXT_BASE is not
>> aligned on a 0x1000 byte boundary (Darwin has attempted to document his
>> particular use-case...)
>
> We should be more precise here and ask for any _good_ reasons.
>
> I can think of many good reasons to keep the text base aligned.  As
> for the reasons to use an unaligned address that were brought up here,
> I still think that it would have been better to use an aligned taxe
> base and do the rest with a customized linker script.
>
>> But we think that the solution to support this is relatively
>> straightforward:
>> (1) after determining the "relocation address" (which will be on a
>> 0x1000 byte boundary),
>> (2) add "CONFIG_SYS_TEXT_BASE % 4096" to that "relocation address"
>> (which effectively makes the "relocation offset" a multiple of 0x1000
>> too...)
>> So, in the scenario #1, (CONFIG_SYS_TEXT_BASE % 4096) = 0, so this
>> algorithm changes nothing.
>> And in scenario #2, (CONFIG_SYS_TEXT_BASE % 4096) = 0x20, therefore, we
>> would now get the following:
>> the relocation offset is:	0x77f9b000
>> therefore, after relocation:
>> _start	symbol is at		0xfff9b020 (0x88000020+0x77f9b000)
>> vectors	symbol is at		0xfff9b800 (0x88000800+0x77f9b000)
>
> I still cannot understand why _start and CONFIG_SYS_TEXT_BASE would
> have to be the same.  There is no such requirement.  What exactly
> prevents you from assigning _start a location at offset 0x20 to the
> start of the text segment, i. e. CONFIG_SYS_TEXT_BASE ?

Wolfgang et al.

I agree that they do not need to be the same...
So our issue is that basically "for every ARMv7 board in the company", 
we are currently maintaining our own modified/customized version of 
"arch/arm/cpu/armv7/start.S" in order to add the appropriate 32 byte 
header...
And we could choose to do it using other methods, but they all require 
us to maintain a customized version of linker scripts, or some other 
code, or ....
The request here is that with the addition of some relatively 
straightforward (upstreamed) code, then this can be handled 
automatically by a post-processing step and we would be able to use a 
pristine version of the upstreamed code...
Our desire is to get this into the beginnings of the "ARMv8" boards, so 
that we can avoid the maintenance issues we have with the current ARMv7 
boards.

We appreciate your consideration of this request.
Thanks, Steve

>
> Then everything should be still the same for you, and no voodoo coding
> would be needed.
>
>> (3) HOWEVER, shifting the address UP may cause the end of the relocated
>> code to run past the end of the available memory... So we could:
>
> This problem is void if you just use a poperly aligned text base in
> combination with a prope start.S resp. linker script to make sure
> _start is where you want it.
>
>> I trust that everyone will find this explanation acceptable...
>
> No, I do not see a good reason to add such code.
>
> Best regards,
>
> Wolfgang Denk
>


More information about the U-Boot mailing list