* [U-Boot] how does board_init_f() -> board_init_r?
@ 2016-02-14 1:52 quantumlight
2016-02-16 16:01 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: quantumlight @ 2016-02-14 1:52 UTC (permalink / raw)
To: u-boot
I am trying to modify the bootloader code for NVIDIA's jetson board.
So I am looking at crt0.S. It seems that two builds happen, one with
CONFIG_SPL_BUILD and one without. So you end up with two file, u-boot.bin
and spl/u-boot-spl.bin.
However, I am unable to find the code path that calls board_init_r() after
board_init_f() finishes, although there are several candidates:
1) crt0.S - if CONFIG_SPL_BUILD was not defined, then it would fall straight
through to board_init_r() - HOWEVER, for u-boot.bin, isn't CONFIG_SPL_BUILD
defined in autoconf.h? Or is this some clever magic between how u-boot.bin
and spl/u-boot-spl.bin are stitched together?
2) _weak board_init_f in arch/arm/lib/spl.c - HOWEVER, shouldn't this be
overloaded by board_init_f in common/board_f.c?
3) board_init_f_r in common/board_f.c - HOWEVER, nothing calls
board_init_f_r().
Can someone illuminate me on how this happens?
--
View this message in context: http://u-boot.10912.n7.nabble.com/how-does-board-init-f-board-init-r-tp245816.html
Sent from the U-Boot mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] how does board_init_f() -> board_init_r?
2016-02-14 1:52 [U-Boot] how does board_init_f() -> board_init_r? quantumlight
@ 2016-02-16 16:01 ` Simon Glass
2016-02-16 16:41 ` Stephen Warren
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2016-02-16 16:01 UTC (permalink / raw)
To: u-boot
+Stephen who will know more
Hi,
On 13 February 2016 at 18:52, quantumlight <peter.feifan.chen@gmail.com> wrote:
> I am trying to modify the bootloader code for NVIDIA's jetson board.
>
> So I am looking at crt0.S. It seems that two builds happen, one with
> CONFIG_SPL_BUILD and one without. So you end up with two file, u-boot.bin
> and spl/u-boot-spl.bin.
SPL is built with ARMv4t
U-Boot proper is built with ARMv7
That's why SPL is used on Tegra. The SPL does not actually load
U-Boot. In fact both are bundle together and loaded at the same time.
SPL simply jumps to U-Boot when needed.
>
> However, I am unable to find the code path that calls board_init_r() after
> board_init_f() finishes, although there are several candidates:
>
> 1) crt0.S - if CONFIG_SPL_BUILD was not defined, then it would fall straight
> through to board_init_r() - HOWEVER, for u-boot.bin, isn't CONFIG_SPL_BUILD
> defined in autoconf.h? Or is this some clever magic between how u-boot.bin
> and spl/u-boot-spl.bin are stitched together?
For U-Boot, CONFIG_SPL_BUILD is not defined. That define means you are
building SPL.
The clever magic is mostly 'cat'. SPL is padded a little and then
U-Boot is added on the end.
> 2) _weak board_init_f in arch/arm/lib/spl.c - HOWEVER, shouldn't this be
> overloaded by board_init_f in common/board_f.c?
The latter is only used in U-Boot proper. SPL has its own board_init_f().
> 3) board_init_f_r in common/board_f.c - HOWEVER, nothing calls
> board_init_f_r().
No, that is not used on ARM.
>
> Can someone illuminate me on how this happens?
>
See the README under Board Initialisation Flow. In brief, the link
between board_init_f() and board_init_r() is generally the crt0.S that
you found. The catch is that some boards don't implement
board_init_f() in SPL, and so use the weak one, which in fact calls
board_init_r() directly.
See also arch/arm/mach-tegra/board.c which I think contains the code
to jump to SPL.
Regards,
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] how does board_init_f() -> board_init_r?
2016-02-16 16:01 ` Simon Glass
@ 2016-02-16 16:41 ` Stephen Warren
2016-02-17 7:19 ` Peter Chen
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2016-02-16 16:41 UTC (permalink / raw)
To: u-boot
On 02/16/2016 09:01 AM, Simon Glass wrote:
> +Stephen who will know more
>
> Hi,
>
> On 13 February 2016 at 18:52, quantumlight <peter.feifan.chen@gmail.com> wrote:
>> I am trying to modify the bootloader code for NVIDIA's jetson board.
>>
>> So I am looking at crt0.S. It seems that two builds happen, one with
>> CONFIG_SPL_BUILD and one without. So you end up with two file, u-boot.bin
>> and spl/u-boot-spl.bin.
>
> SPL is built with ARMv4t
> U-Boot proper is built with ARMv7
>
> That's why SPL is used on Tegra. The SPL does not actually load
> U-Boot. In fact both are bundle together and loaded at the same time.
> SPL simply jumps to U-Boot when needed.
There's some more background on this topic at:
ftp://download.nvidia.com/tegra-public-appnotes/index.html
In particular, see the "Tegra Boot Flow" link/document.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] how does board_init_f() -> board_init_r?
2016-02-16 16:41 ` Stephen Warren
@ 2016-02-17 7:19 ` Peter Chen
0 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2016-02-17 7:19 UTC (permalink / raw)
To: u-boot
Oh I see. Thanks.
On Tue, Feb 16, 2016 at 8:41 AM, Stephen Warren <swarren@wwwdotorg.org>
wrote:
> On 02/16/2016 09:01 AM, Simon Glass wrote:
>
>> +Stephen who will know more
>>
>> Hi,
>>
>> On 13 February 2016 at 18:52, quantumlight <peter.feifan.chen@gmail.com>
>> wrote:
>>
>>> I am trying to modify the bootloader code for NVIDIA's jetson board.
>>>
>>> So I am looking at crt0.S. It seems that two builds happen, one with
>>> CONFIG_SPL_BUILD and one without. So you end up with two file, u-boot.bin
>>> and spl/u-boot-spl.bin.
>>>
>>
>> SPL is built with ARMv4t
>> U-Boot proper is built with ARMv7
>>
>> That's why SPL is used on Tegra. The SPL does not actually load
>> U-Boot. In fact both are bundle together and loaded at the same time.
>> SPL simply jumps to U-Boot when needed.
>>
>
> There's some more background on this topic at:
>
> ftp://download.nvidia.com/tegra-public-appnotes/index.html
>
> In particular, see the "Tegra Boot Flow" link/document.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-17 7:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-14 1:52 [U-Boot] how does board_init_f() -> board_init_r? quantumlight
2016-02-16 16:01 ` Simon Glass
2016-02-16 16:41 ` Stephen Warren
2016-02-17 7:19 ` Peter Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.