Re: Question about linux boot procedure (head_64.S)

2009-09-01 Thread Michael Ellerman
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


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Question about linux boot procedure (head_64.S)

2009-09-01 Thread Geoff Levand
On 09/01/2009 05:25 PM, Lee HongWoo wrote:
 On Wed, Sep 2, 2009 at 2:32 AM, Geoff Levand 
 geoffrey.lev...@am.sony.comwrote:
 In the general case, __start is the entry point of the kernel.
 It is where the bootloader or boot wrapper program jumps to
 when it transfers control to the kernel.
 
 I believe __start is the entry point of the kernel in this case.
 And the entry point is __GLOBAL(__start) in the head_64.S.
 
 What I asked is where or what __start is called in the prom_init.c
 __start(hdr, KERNELBASE + offset, 0);

I think Michael answered this.  Just FYI, more info about the powerpc
boot is in the kernel source file:

  Documentation/powerpc/booting-without-of.txt

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev