Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1066520
  • 博文数量: 226
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 2504
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-21 14:12
文章分类

全部博文(226)

文章存档

2011年(1)

2010年(2)

2009年(68)

2008年(4)

2007年(27)

2006年(124)

我的朋友

分类:

2006-10-21 10:03:12

linux启动过程分析

linux bootup flow chart
when boot the kernel execute start_kernel(void) function   in init/main.c
1. lock_kernel(); This cannot happen asynchronously,so we use spin_lock to come into agreement with other CPU.
2. setup_arch(&command_line); arch/ppc/kernel/setup.c IO base is not yet inited 
       pmac_feature_init(); arch/ppc/platforms/pmac_feature.c
           probe_uninorth();/* Detect the UniNorth memory controller */
    probe_macios();/* Probe mac-io controllers */
    probe_motherboard();/* Probe machine type */
       do_init_bootmem(); arch/ppc/mm/init.c Initialize the bootmem system and give it all the memory we
  have available.set up the bootmem stuff with available memory ,
  Be sure to change arch/ppc/Makefile to match. 
3.parse_options(command_line);  init/main.c
 This routine also checks for options meant for the kernel.
4.trap_init(); deal with exception.
5.init_IRQ(); arch/ppc/kernel/irq.c 
6.sched_init(); kernel/sched.c
7.softirq_init(); kernel/softirq.c
8.time_init();arch/ppc/kernel/time.c
9.console_init();Initialize the console device. This is called *early*, so we can't necessarily 
depend on lots of kernel help here.Just do some early initializations, and do the complex setup later.
10.mem_init();arch/ppc/mm/init.c
11.kmem_cache_sizes_init();Initialisation - setup remaining internal and general caches.Called after 
   the gfp() functions have been enabled, and before smp_init().
12.pgtable_cache_init();include/asm-ppc/pgtable.h
13. fork_init(num_mappedpages);kernel/fork.c
14.proc_caches_init();kernel/fork.c
15.vfs_caches_init(num_physpages);fs/dcache.c
16.buffer_init(num_physpages);fs/buffer.c
17.page_cache_init(num_physpages);mm/filemap.c
18. ipc_init();ipc/util.c
19.check_bugs();arch/ppc/kernel/syscalls.c
20.rest_init();init/main.c
ok,thus we can call a kernel thread to begin init.(the call realize in rest_init function).
now in init() function.
1.lock_kernel();
2.do_basic_setup();
3.prepare_namespace();init/main.c
  Ok, the machine is now initialized. None of the devices have been touched yet, 
  but the CPU subsystem is up and running, and memory and process management works.
  Now we can finally start doing some real work..
  sock_init();
  start_context_thread();
  do_initcalls();
4.free_initmem();
5.unlock_kernel();
6.run_init_process("/sbin/init";
7.run_init_process("/etc/init";
8.run_init_process("/bin/init";
9.run_init_process("/bin/sh";
阅读(448) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~