Linux内核初始化流程笔记
分类: LINUX
作者:gfree.wind@http://www.doczj.com/doc/fc580419c1c708a1294a4409.html
博客:http://www.doczj.com/doc/fc580419c1c708a1294a4409.html http://www.doczj.com/doc/fc580419c1c708a1294a4409.html
本文的copyleft归gfree.wind@http://www.doczj.com/doc/fc580419c1c708a1294a4409.html所有,使用GPL发布,可以自由拷贝,转载。但转载请保持文档的完整性,注明原作者及原链接,严禁用于任何商业用途。
=============================================================================== =======================
如前文http://http://www.doczj.com/doc/fc580419c1c708a1294a4409.html/space.php?uid=23629988&do=blog&id=3129477的流程,bootloader将kerenel加载到内存中。
全部引导过程是四步
1:boot PROM phase
2:boot Programs phase
3:kernel initialization phase
4:init phase
system初始化,检测内存和cpu,检查设备和创建设备树,设置console
kernel初始化过程
kernel self -initialization 内核自检
loading of kernel modules 载入内核模块
reading of the kernel configuration file in /etc/system 读内核配置文件
staring of the /sbin/init process 运行/sbin/init进程
bootblk是用于装载第二个引导程序ufsboot的主引导程序
bootblk是被PROM的boot设备的引导扇区装载的
ufsboot程序是用了装载两部分核心genunix和unix的
installboot是用来在磁盘分区上安装bootblk的
genunix is the platform-independent generic kernel file ,while unix is the platform-specific kernel component.
整个的引导过程:
PROM from the boot sector of the boot device-->bookblk-->ufsboot-->genunix(是一个独立平台的普通内核文件) and unix(是一个特殊平台内核文件)-->其它
这里加载的kernel镜像,并不是真正的可执行文件,而是一个压缩的镜像文件。主要有两种类型zImage和bzImage(即为Big zImage)。其中zImage小于512KB,而bzImage可以为一个大的压缩镜像文件。zImage可以用于在没有bootloader的情况下,直接启动kernel。而目前一般都是使用bzImage。以我目前的Fedora13为例,执行file /boot/vmlinuz-2.6.33.3-85.fc13.i686.PAE
1./boot/vmlinuz-
2.6.3
3.3-85.fc13.i686.PAE: Linux kernel x86 boot executable bzImage,
version 2.6.33.3-85.fc13.i686.PAE (mock, RO-rootFS, root_dev 0x902, swap_dev 0x3,
Normal VGA