专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »数据库 » mandrake:Mandrake9.0的启动过程(从init开始)(一) »正文

mandrake:Mandrake9.0的启动过程(从init开始)(一)

来源: 发布时间:星期三, 2008年12月31日 浏览:2次 评论:0
="t18">
  以阅读源代码方式研究 Linux启动过程是我早已有的心愿今天总算是开工了由于理解系统化过程要有汇编基础所以我只好先从init开始
  init源代码在/usr/src/linux-2.4.19-9mdk/init目录下在这个目录下共有 3个文件do_mounts.c、.c和version.c其中.c就是init进程源代码这段代码并不长只有640行
  首先用ctags -x .c 生成个tags文件用vi 打开后可以看到各个索引:
  LPS_PREC macro 183 .c # LPS_PREC 8
  MAX_INIT_ARGS macro 125 .c # MAX_INIT_ARGS 8
  MAX_INIT_ENVS macro 126 .c # MAX_INIT_ENVS 8
  __KERNEL_SYSCALLS__ macro 12 .c # __KERNEL_SYSCALLS__
  argv_init variable 135 .c char *
  argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
  calibrate_delay function 185 .c void __init
  calibrate_delay(void)
  checkup function 160 .c __init
  checkup(char *line)
  child_reaper variable 498 .c strUCt task_struct
  *child_reaper = &init_task;
  cols variable 131 .c rows, cols;
  debug_kernel function 226 .c __init
  debug_kernel(char *str)
  do_basic_up function 521 .c void __init
  do_basic_up(void)
  do_initcalls function 500 .c void __init
  do_initcalls(void)
  envp_init variable 136 .c char *
  envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
  execute_command variable 133 .c char *execute_command;
  gr_up function 148 .c __init
  gr_up(char *str)
  init function 603 .c init(void
  *unused)
  loops_per_jfy variable 178 .c unsigned long
  loops_per_jfy = (1<<12);
  parse_options function 254 .c void __init
  parse_options(char *line)
  profile_up function 138 .c __init
  profile_up(char *str)
  quiet_kernel function 234 .c __init
  quiet_kernel(char *str)
  rest_init function 389 .c void rest_init(void)
  rows variable 131 .c rows, cols;
  smp_init function 349 .c void __init
  smp_init(void)
  smp_init function 361 .c void __init
  smp_init(void)
  smp_init macro 354 .c # smp_init do { }
  while (0)
  start_kernel function 401 .c asmlinkage void __init
  start_kernel(void)
  wait_init_idle variable 344 .c unsigned long
  wait_init_idle;
  有了这个索引后查找就方便了再用vi 打开.c找到init如下:
  源码:-------------------------------------------------------
   init(void * unused)
  {
   lock_kernel;
   do_basic_up;
   prepare_;
  #def CONFIG_GRKERNSEC
   grsecurity_init;
  #end
   /*
   * Ok, we have completed the initial bootup, and
   * we're essentially up and running. Get rid of the
   * initmem segments and start the user-mode stuff..
   */
   free_initmem;
   unlock_kernel;
   (open("/dev/console", O_RDWR, 0) < 0)
   prk("Warning: unable to open an initial console.\n");
   (void) dup(0);
   (void) dup(0);
   /*
   * We try each of these until _disibledevent=m
  C right">(出处:清风软件Software下载学院)

相关文章

读者评论

  • 共0条 分0页

发表评论

  • 昵称:
  • 内容: