1 headers.S:bootsect_start
bootsect_start
start2 (0)
_start (512)
start_of_setup
void main(void) : main.c
2 main.c:main->go_to_protected_mode
go_to_protected_mode()
pm.c: -> protected_mode_jump->code32_start
protected_mode_jump(boot_params.hdr.code32_start,
(u32)&boot_params + (ds() << 4));
跳转到header.S中定义的code32_start:
code32_start: # here loaders can put a different
# start address for 32-bit code.
#ifndef __BIG_KERNEL__
.long 0x1000 # 0x1000 = default for zImage
#else
.long 0x100000 # 0x100000 = default for big kernel
#endif
此处对应head_32.S
3 head_32.S:startup_32/decompress_kernel/jmp
startup_32
...
/*
* Do the decompression, and jump to the new kernel..
*/
...
call decompress_kernel
...
/*
* Jump to the decompressed kernel.
*/
xorl %ebx,%ebx
jmp *%ebp
应该是跳转到了arch/i386/kernel/head_32.S
4 head_32.S:startup_32
ENTRY(startup_32)
...
ENTRY(initial_code)
.long i386_start_kernel
...
head32.c:i386_start_kernel
void __init i386_start_kernel(void)
{
start_kernel();
}
5 init/main.c:start_kernel
start_kernel()