Linux PPC 8xx boot sequence
The following traces the boot process
for PowerPC Linux, from the earliest kernel initialization through the
call to start_kernel( ), at which point the PPC platform-specific
initialization is complete and the platform-independent kernel code is
started. The trace focuses on initialization for 8xx series PowerPC
chips used in embedded applications. The
line numbers correspond to the 2.4.20 kernel; the kernel source itself
can be conveniently browsed on the Linux Cross-Reference website.
arch ppc/boot/simple/head.S
- start (38)
- first code in zImage
- store load address in r3 (69)
- turn off interrupts for 8xx (82)
- branch to "relocate" (119)
arch ppc/boot/common/relocate.S
- relocate (35)
- expects args
- r3: address where image was loaded
- r4: residual data from boot rom
- see if code needs relocation (compare passed load address with symbol "start"); if not, branch to start_ldr (56)
- move relocation code so it's beyond where code will be relocated (68)
- call do_relocate (110)
- do_relocate (122)
- relocate code (122+)
- call flush_instruction_cache (156)
- branch to start_ldr (156+)
- start_ldr (167)
- clear BSS (168)
- set up stack (179)
- call decompress_kernel (190)
- branch to address 0x00000000 (206)
arch ppc/boot/simple/misc-embedded.c
- decompress_kernel( ) (80)
- r3: address where image was loaded
- r4: size of image (words)
- r5: checksum
- r6: pointer to board info (or 0)
- (etc.)
arch/ppc/kernel/head_8xx.S (or head.S, head_4xx.S, etc.)
first kernel code executed after decompression; defines _stext label
- _stext (84)
- expects args
- r3: ptr to board info data or 0
- r4: initrd_start or if no initrd then 0
- r5: initrd_end - unused if r4 is 0
- r6: Start of command line string or 0
- r7: End of command line string - unused if r6 is 0
- move args to higher regs (85+)
- call initial_mmu to set up initial MMU state (95)
- turn on MMUand jump to start_here (101+)
- start_here (703)
- do something with init_task_union (??) (706)
- call early_init( ) (721)
- call machine_init( ) (731)
- call MMU_init( ) (732)
- jump to start_kernel( ) (783+)
arch/ppc/kernel/setup.c:
- early_init( ) (261)
- identify CPU (278)
- call do_cpu_ftr_fixups( ) to fix code sections as needed (??) (279)
- machine_init( ) (494)
- calls platform_init( ) (501)
- prints message (503)
- ppc_init( )
- call the init function pointer in the ppc_md struct if non-null
arch/ppc/kernel/m8xx_setup.c:
- platform_init( ) (344)
- (defined
for 8xx in arch/ppc/kernel/m8xx_setup.c; all-ppc version defined in
arch/ppc/kernel/setup.c; other versions defined in arch/ppc/platforms
files)
- call parse_bootinfo( ) (347)
- if board info supplied in r3, save to __res (349)
- set initrd start and end if any supplied in r4, r5 (358)
- if command line supplied in r6, copy to cmd_line (365)
- set up ppc_md struct by assigning function pointers to fields (371+)
- in particular, the init function pointer is set to NULL
Notes:
- have ppc_md struct that supplies various functions used during boot
- struct type is machdep_calls, defined in include/asm-ppc/machdep.h
Comments/questions? jsevy@cs.drexel.edu