日期:2014-05-16  浏览次数:20756 次

linux内核启动流程(下)
接上回
start_kernel在/init/main.c中定义
asmlinkage void __init start_kernel(void)
{
char * command_line;
extern struct kernel_param __start___param[], __stop___param[];

smp_setup_processor_id();

/*
 * Need to run as early as possible, to initialize the
 * lockdep hash:
 */
unwind_init();        //Convert the symbol addresses to absolute values
lockdep_init();        //锁定入口,初始化散列
/*
void lockdep_init(void)
 {
         int i;

         /*
          * Some architectures have their own start_kernel()
          * code which calls lockdep_init(), while we also
          * call lockdep_init() from the start_kernel() itself,
          * and we want to initialize the hashes only once:
          */
         if (lockdep_initialized)
                 return;
 
         for (i = 0; i < CLASSHASH_SIZE; i++)
                 INIT_LIST_HEAD(classhash_table + i);
 
         for (i = 0; i < CHAINHASH_SIZE; i++)
                 INIT_LIST_HEAD(chainhash_table + i);
 
         lockdep_initialized = 1;
 }
*/
cgroup_init_early();    //cgroup: 它的全称为control group.即一组进程的行为控制.该函数主要是做数据结构和其中链表的初始化

local_irq_disable();    //关闭系统总中断
early_boot_irqs_off();    //设置系统中断的关闭标志
early_init_irq_lock_class();

/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */