第二阶段的初始化 : 系统的 各种资源的初始化
第二阶段的初始化 仅由 主cpu 进行 (cpu0)
cpu1 ... 等 cpu 只负责
1. cpu1 ... 上的 idle 进程的创建 (smp_init -> idle_threads_init -> idle_init 是不是就完成了idle进程的创建)
2. 进入idle
CPU0
start_kernel
...
cpu_startup_entry(CPUHP_ONLINE);
do_idle
- 参考 链接 中的 start_kernel -> rest_init
- 参考 链接 中的 rest_init->cpu_startup_entry
kernel_init 和 kthreadd 的执行 不在 第二阶段内,此时不用分析
分析了 atags
初始化了 内存 (内存虚拟化)
建立了 进程 ,初始化了调度 (进程是对的CPU虚拟化)
建立了 文件系统的根 (文件对存储地址空间的抽象)
vfs_caches_init_early
vfs_caches_init
初始化了 中断(硬件和软件)
CPU1 …
secondary_start_kernel
pr_debug("CPU%u: Booted secondary processor\n", cpu);
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
do_idle
初始化了 cpu1
cpu_init
ipi_setup