asmlinkage void __init start_kernel(void)

{

char * command_line;

extern const struct kernel_param __start___param[], __stop___param[];

smp_setup_processor_id();//返回启动的CPU的ID号,如为单核则什么也不做

/*

* Need to run as early as possible, to initialize the

* lockdep hash:

*/

lockdep_init();

debug_objects_early_init();

/*

* Set up the the initial canary ASAP:

*/

boot_init_stack_canary();

cgroup_init_early();

local_irq_disable();//关闭当前CPU的中断

early_boot_irqs_disabled = true;

/*

* Interrupts are still disabled. Do necessary setups, then

* enable them

*/

tick_init();

boot_cpu_init();

page_address_init();//初始化页地址,使用链表将其链接起来

printk(KERN_NOTICE "%s", linux_banner);//打印内核版本信息

setup_arch(&command_line);//设置体系结构,由内核根目录的Makefile决定

mm_init_owner(&init_mm, &init_task);

mm_init_cpumask(&init_mm);

setup_command_line(command_line);

setup_nr_cpu_ids();

setup_per_cpu_areas();

smp_prepare_boot_cpu();      /* arch-specific boot-cpu hooks */

build_all_zonelists(NULL);

page_alloc_init();

printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);//打印命令行信息

parse_early_param();//解析内核选项

parse_args("Booting kernel", static_command_line, __start___param,

__stop___param - __start___param,

&unknown_bootoption);

/*

* These use large bootmem allocations and must precede

* kmem_cache_init()

*/

setup_log_buf(0);

pidhash_init();

vfs_caches_init_early();

sort_main_extable();

trap_init();

mm_init();

/*

* 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 (!irqs_disabled()) {//检查中断是否已经打开,如果已经打开,则关闭中断

printk(KERN_WARNING "start_kernel(): bug: interrupts were "

"enabled *very* early, fixing it\n");

local_irq_disable();

}

idr_init_cache();

perf_event_init();

rcu_init();//初始化RCU(Read-Copy Update)机制

radix_tree_init();

/* init some links before init_ISA_irqs() */

early_irq_init();

init_IRQ();//中断向量初始化

prio_tree_init();

init_timers();//初始化定时器相关的数据结构

hrtimers_init();//对高精度时钟进行初始化

softirq_init();//初始化tasklet_softirq和hi_softirq

timekeeping_init();

time_init();//初始化系统时钟源

profile_init();//对内核的profile(一个内核性能调式工具)功能进行初始化

call_function_init();

if (!irqs_disabled())

printk(KERN_CRIT "start_kernel(): bug: interrupts were "

"enabled early\n");

early_boot_irqs_disabled = false;

local_irq_enable();

/* Interrupts are enabled now so all GFP allocations are safe. */

gfp_allowed_mask = __GFP_BITS_MASK;

kmem_cache_init_late();

/*

* 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();// 初始化控制台以显示printk的内容,在此之前调用的printk只是把数据存到缓冲区里

if (panic_later)

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

* too:

*/

locking_selftest();

#ifdef CONFIG_BLK_DEV_INITRD

if (initrd_start && !initrd_below_start_ok &&

page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {

printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "

"disabling it.\n",

page_to_pfn(virt_to_page((void *)initrd_start)),

min_low_pfn);

initrd_start = 0;

}

#endif

page_cgroup_init();

enable_debug_pagealloc();

debug_objects_mem_init();

kmemleak_init();

setup_per_cpu_pageset();

numa_policy_init();

if (late_time_init)

late_time_init();

sched_clock_init();

calibrate_delay();

pidmap_init();

anon_vma_init();

#ifdef CONFIG_X86

if (efi_enabled)

efi_enter_virtual_mode();

#endif

thread_info_cache_init();

cred_init();

fork_init(totalram_pages);

proc_caches_init();

buffer_init();

key_init();

security_init();

dbg_late_init();

vfs_caches_init(totalram_pages);//虚拟文件系统的初始化

signals_init();

/* rootfs populating might need page-writeback */

page_writeback_init();

#ifdef CONFIG_PROC_FS

proc_root_init();

#endif

cgroup_init();

cpuset_init();

taskstats_init_early();

delayacct_init();

check_bugs();

acpi_early_init(); /* before LAPIC and SMP init */

sfi_init_late();

ftrace_init();

/* Do the rest non-__init'ed, we're now alive */

rest_init();

}

archlinux php7 mysql_xboot-x4412ibox项目实战7-Linux内核的引导 - Powered by Discuz!相关推荐

  1. 双核Linux内核的引导

    最后再整一篇多核的引导,称热打铁 Linux内核的引导 引导Linux系统的过程包括很多阶段,这里将以引导ARM Linux为例来进行讲解(见图3.11). 一般的SoC内嵌入了bootrom,上电时 ...

  2. BootLoader简介——linux内核的引导

    1.BootLoader 在CPU上电启动时,一般连内存控制器都没有初始化过,根本无法在主存中运行程序,更不可能处在Linux内核启动环境中,为了初始化CPU及其他外设,使得Linux内核可以在系统主 ...

  3. 和菜鸟一起学linux内核之引导启动篇

    注:以下大部分内容摘自linux内核编程入门篇和linux内核完全注释 对于linux的整个体系结构有了一定的了解,看了每个目录的文件整体概要,那么就 可以开始看内核的源码了,首先那便是引导启动了. ...

  4. 关于RDP协议的分析(一) - Linux论坛 - 计世网论坛 - Powered by Discuz!

    导读: 关于RDP协议的分析(一) 关于RDP协议的分析和研究                                         -------------- leadgenius 写这 ...

  5. linux内核enforcing引导参数

    enforcing参数是在启动内核时传递给selinux的内核参数,它用来决定你系统的内核运行于 强制(enforcing )模式还是自由(permissive) 模式. 在自由模式下SELinux只 ...

  6. linux由哪些部分组成,linux内核处于什么位置?,为你介绍一些Linux操作系统的基础知识(一)...

    今天小编为大家带来的文章是关于Linux操作系统的一些基础知识.喜欢Linux的小伙伴们快来看一看吧. Q1.什么是GNU?Linux与GNU有什么关系? A: 1)GNU是GNU is Not Un ...

  7. Linux内核源码行数,Linux源代码已超过1000万行 价值达5亿美金

    10月23日消息,一项分析发现,在最近发布2.6.27版本Linux内核之后,包括Linux内核文件在内的源代码行数已经超过了1000万行. 不过,这个数字包括空白行.注释和整个内核源代码全年检查的文 ...

  8. Linux内核源码分析方法

    说明:这是一个刚接触内核三个月的同学,通过对一个内核特性的分析,总结出一套分析内核的方法. 一.内核源码之我见 Linux内核代码的庞大令不少人"望而生畏",也正因为如此,使得人们 ...

  9. Linux内核社区迁移到github?

    简介: github是目前最火的开源软件代码托管平台,那么Linux内核社区能否迁移到github上呢?Intel的Daniel Vetter写了一篇关于这个问题的博客,他给出的答案是NO.至于这个答 ...

最新文章

  1. 应用监控CAT之cat-client源码阅读(一)
  2. python基础教程书籍推荐-python入门书籍推荐
  3. 【】python时间处理;PYTHON定时任务合集
  4. Jupyter Notebook 使用小记
  5. mysql集群跨地域同步部署_跨地域冗余 - 跨数据中心部署方案 - 《TiDB v2.1 用户文档》 - 书栈网 · BookStack...
  6. 【剑指offer】面试题30:包含min函数的栈
  7. matlab同步发电机外特性仿真,基于Matlab-Simulink的虚拟同步发电机控制方法的仿真研究...
  8. 十天冲刺开发第一天个人工作总结
  9. Tech.Ed上海会场都结束了!
  10. python贪吃蛇_python实现贪吃蛇
  11. 关于南宁市教育云网站的网课视频链接blob加密破解
  12. hosts文件的作用
  13. 计算机毕设人寿保险项目,2017年中国人寿集团在京各直属单位接收毕业生情况公示...
  14. 计算机功能自定义,设计大师学教学:自定义鼠标右键功能提升CAD绘图效率-鼠标右键菜单设置...
  15. 行走在古道间,看时光深处,
  16. 新加坡企业是怎么做实名认证的?
  17. elasticsearch 实现查询忽略大小写
  18. 手机里的照片导入计算机的方法,如何把iphone照片导入电脑 四种方法分享【图文】...
  19. Python 绘制遥感数字高程影像(DEM)
  20. 百度地图-删除替换标注

热门文章

  1. c++后台开发项目_在京东,我是怎么做项目管理的
  2. 信必优(Symbio)绽放iWorld数字世界博览会
  3. CentOS 7 客户端连接 OpenVP*(账号密码方式)
  4. android版本对so支持,Android so文件兼容之abiFilters的使用
  5. Centos7 使用yum安装tomcat
  6. HTC Desire 22 Pro——Vive Flow VR“完美伴侣”,还送NFT和钱包
  7. 仿射密码(Affine)
  8. Linux上使用nginx将不同域名代理到同一IP的不同端口
  9. 腾讯云cos上传文件功能封装
  10. 第11天 浏览器访问网站的基本流程