Question about linux boot procedure (head_64.S)

Michael Ellerman michael at ellerman.id.au
Wed Sep 2 10:47:09 EST 2009


On Tue, 2009-09-01 at 19:58 +0900, Lee HongWoo wrote:
> Hi ~ 
> 
> This is a boot flow of linux kernel under the arch/powerpc/kernel and
> I'm using pasemi cpu. 
> 
> __start  (in head_64.S) 
>   ---> __start_initialization_multiplatform (in head_64.S) 
>     ---> __boot_from_prom (in head_64.S) 
>        ---> prom_init ( in prom_init.c) 
>          ---> __start ???
> 
> And I don't understand where __start is called, because I can find
> __start only in head_64.S. 
> If it calls __start in head_64.S, it's a recursive call. 
> 
> Can anybody explain about this precedure ? 

It calls __start() with different arguments. They are checked in
__start_initialization_multiplatform:

308         /*
309          * Are we booted from a PROM Of-type client-interface ?             
310          */
311         cmpldi  cr0,r5,0
312         beq     1f
313         b       .__boot_from_prom               /* yes -> prom */


The first time through __start we are running under OF. The kernel can
detect this based on the arguments it is passed (r5 in particular).

prom_init() deals with talking to OF and flattening the OF device tree.
We then call back into __start but this time r5 is 0:

2555         __start(hdr, kbase, 0);                                            

So the second time through we don't call into prom_init(), instead the
kernel continues using the flattened device tree.

The startup is structured this way so that the kernel can boot either
from OF (in which case we call prom_init()), or directly with a
flattened device tree.

cheers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090902/6a6c1e7f/attachment.pgp>


More information about the Linuxppc-dev mailing list