linux 内核启动过程


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()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值