Set up the scheduler prior starting any interrupts (such as the
timer interrupt). Full topology setup happens at smp_init()
time - but meanwhile we still have a functioning scheduler. /
sched_init(); 初始化调度器
/
Disable preemption - early bootup scheduling is extremely
fragile until we cpu_idle() for the first time. /
preempt_disable();
if (WARN(!irqs_disabled(),
“Interrupts were enabled very early, fixing it
”))
local_irq_disable();
/
禁用抢占和中断
*/
idr_init_cache();
/*为IDR机制分配缓存,
IDR在linux内核中指的就是整数ID管理机制
*/
rcu_init();
/*内核数据同步机制RCU初始化 /
/ trace_printk() and trace points may be used after this */
trace_init();
context_tracking_init();
radix_tree_init();
/* init some links before init_ISA_irqs() */
early_irq_init(); //中断初始化,NR_IRQS:16 nr_irqs:16 16
init_IRQ();
/*A9架构相关中断初始化,后面要重点研究这个函数
[ 0.000000] L2C-310 erratum 769419 enabled
[ 0.000000] L2C-310 enabling early BRESP for Cortex-A9
[ 0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[ 0.000000] L2C-310 ID prefetch enabled, offset 16 lines
[ 0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[ 0.000000] L2C-310 cache controller enabled, 16 ways, 1024 kB
[ 0.000000] L2C-310: CACHE_ID 0x410000c7, AUX_CTRL 0x76470001
*/
tick_init();
rcu_init_nohz();
init_timers();
/*
初始化cpu时钟,
打开软中断
*/
hrtimers_init(); //高精度定时器初始化
softirq_init(); //
timekeeping_init();
time_init(); //初始化时钟源
sched_clock_postinit();
perf_event_init();
profile_init();
call_function_init();
WARN(!irqs_disabled(), “Interrupts were enabled early
”);
early_boot_irqs_disabled = false;
local_irq_enable();
/*
打开所有中断 /
kmem_cache_init_late();
//slab内核分配机制初始化
/
HACK ALERT! This is early. We’re enabling the console before
we’ve done PCI setups etc, and console_init() must be aware of
this. But we do want output early, in case something goes wrong. /
console_init();
/
控制台初始化,在没有初始化该函数之前,所有的打印信息均存储在缓冲区,
当完成控制台初始化之后,一次性将缓冲区全部打印。
如何映射到串口设备的
*/
if (panic_later)
panic(“Too many boot %s vars at `%s’”, panic_later,
panic_param);
lockdep_info();
/*
Need to run this when irqs are enabled, because it wants
to self-test [hard/soft]-irqs on/off lock inversion bugs