* Question about linux boot procedure (head_64.S)
@ 2009-09-01 10:58 Lee HongWoo
2009-09-01 17:32 ` Geoff Levand
2009-09-02 0:47 ` Michael Ellerman
0 siblings, 2 replies; 6+ messages in thread
From: Lee HongWoo @ 2009-09-01 10:58 UTC (permalink / raw)
To: Linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
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 ?
Thanks in advance.
HongWoo.
[-- Attachment #2: Type: text/html, Size: 630 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Question about linux boot procedure (head_64.S)
@ 2009-09-01 11:27 Lee HongWoo
0 siblings, 0 replies; 6+ messages in thread
From: Lee HongWoo @ 2009-09-01 11:27 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
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 ?
Thanks in advance.
HongWoo.
[-- Attachment #2: Type: text/html, Size: 658 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about linux boot procedure (head_64.S)
2009-09-01 10:58 Question about linux boot procedure (head_64.S) Lee HongWoo
@ 2009-09-01 17:32 ` Geoff Levand
2009-09-02 0:25 ` Lee HongWoo
2009-09-02 0:47 ` Michael Ellerman
1 sibling, 1 reply; 6+ messages in thread
From: Geoff Levand @ 2009-09-01 17:32 UTC (permalink / raw)
To: Lee HongWoo; +Cc: Linuxppc-dev
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about linux boot procedure (head_64.S)
2009-09-01 17:32 ` Geoff Levand
@ 2009-09-02 0:25 ` Lee HongWoo
2009-09-02 1:19 ` Geoff Levand
0 siblings, 1 reply; 6+ messages in thread
From: Lee HongWoo @ 2009-09-02 0:25 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 2834 bytes --]
On Wed, Sep 2, 2009 at 2:32 AM, Geoff Levand <geoffrey.levand@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.
[-- Attachment #2: Type: text/html, Size: 3540 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about linux boot procedure (head_64.S)
2009-09-01 10:58 Question about linux boot procedure (head_64.S) Lee HongWoo
2009-09-01 17:32 ` Geoff Levand
@ 2009-09-02 0:47 ` Michael Ellerman
1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2009-09-02 0:47 UTC (permalink / raw)
To: Lee HongWoo; +Cc: Linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]
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
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about linux boot procedure (head_64.S)
2009-09-02 0:25 ` Lee HongWoo
@ 2009-09-02 1:19 ` Geoff Levand
0 siblings, 0 replies; 6+ messages in thread
From: Geoff Levand @ 2009-09-02 1:19 UTC (permalink / raw)
To: Lee HongWoo; +Cc: linuxppc-dev
On 09/01/2009 05:25 PM, Lee HongWoo wrote:
> On Wed, Sep 2, 2009 at 2:32 AM, Geoff Levand <geoffrey.levand@am.sony.com>wrote:
>> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-02 1:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-01 10:58 Question about linux boot procedure (head_64.S) Lee HongWoo
2009-09-01 17:32 ` Geoff Levand
2009-09-02 0:25 ` Lee HongWoo
2009-09-02 1:19 ` Geoff Levand
2009-09-02 0:47 ` Michael Ellerman
-- strict thread matches above, loose matches on Subject: below --
2009-09-01 11:27 Lee HongWoo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).