Question about linux boot procedure (head_64.S)
Lee HongWoo
hongwoo7 at gmail.com
Wed Sep 2 10:25:33 EST 2009
On Wed, Sep 2, 2009 at 2:32 AM, Geoff Levand <geoffrey.levand at am.sony.com>wrote:
> On 09/01/2009 03:58 AM, Lee HongWoo wrote:
> > __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 ?
>
> 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.
>
> -Geoff
>
>
Thanks Geoff,
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);
Below is the simple function call flow of linux kernel boot procedure.
file : head_64.S
_GLOBAL(__start)
/* NOP this out unconditionally */
BEGIN_FTR_SECTION
b .__start_initialization_multiplatform
END_FTR_SECTION(0, 1)
....
_GLOBAL(__start_initialization_multiplatform)
/*
* Are we booted from a PROM Of-type client-interface ?
*/
cmpldi cr0,r5,0
bne .__boot_from_prom /* yes -> prom */
....
_STATIC(__boot_from_prom)
/* Save parameters */
mr r31,r3
mr r30,r4
mr r29,r5
mr r28,r6
mr r27,r7
/*
* Align the stack to 16-byte boundary
* Depending on the size and layout of the ELF sections in the
initial
* boot binary, the stack pointer will be unalignet on PowerMac
*/
rldicr r1,r1,0,59
/* Make sure we are running in 64 bits mode */
bl .enable_64b_mode
/* put a relocation offset into r3 */
bl .reloc_offset
LOAD_REG_IMMEDIATE(r2,__toc_start)
addi r2,r2,0x4000
addi r2,r2,0x4000
/* Relocate the TOC from a virt addr to a real addr */
add r2,r2,r3
/* Restore parameters */
mr r3,r31
mr r4,r30
mr r5,r29
mr r6,r28
mr r7,r27
/* Do all of the interaction with OF client interface */
bl .prom_init
/* We never return */
trap
file : prom_init.c
unsigned long __init prom_init(unsigned long r3, unsigned long r4,
unsigned long pp,
unsigned long r6, unsigned long r7)
{
...
...
__start(hdr, KERNELBASE + offset, 0);
return 0;
}
HongWoo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090902/bc00d246/attachment.htm>
More information about the Linuxppc-dev
mailing list