initrd, initramfs, which I need and how to use???

来源:互联网 发布:用友软件面试怎么样 编辑:程序博客网 时间:2024/06/09 23:36

initrd, initramfs 是什么?是干吗用的?怎么用呢?

一个一个来解决。

主要目的是让用户可以定制启动过程,把额外的一些模块build-in kernel image里。这样有什么好处呢,kernel image 可以不用包含一些大量的驱动,有些不想公开代码的模块可以话到这个

说起这个话题,要从linux的启动过程说起。

俺们都知道,板子上电后,会先执行bootloader,bootloader准备好环境后,加载kernel,kernel 开始执行。

kernel的执行又分阶段:第一阶段是和体系有关的,一般由汇编写的,代码在arch/xxx/boot;第二阶段是体系无关的,由C写的,代码在init/.

第二阶段是从start_kernel 开始的。而我们要说的initrd或者initramfs就在start_kernel后登场了!!

至于上面说到的,具体的步聚可以参考:

上电 -> bootloader ->  kernel

what bootlader do,:

http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html 

what kernel 1st phase(processor-specific) do :

http://www.chinaunix.net/old_jh/4/1021226.html

http://blog.csdn.net/force_eagle/article/details/2327533

what kernel 2st phase(generic non-processor-specific from start_kernel)

http://www.cnblogs.com/hpunix/articles/2006782.html

refs:

http://lxr.linux.no/linux+v3.11.6/Documentation/filesystems/ramfs-rootfs-initramfs.txt

https://www.kernel.org/doc/Documentation/initrd.txt

linux2.6内核initrd机制解析:

http://womendu.iteye.com/blog/1069948

initrd、rootfs及内核root=参数 :

http://tsecer.blog.163.com/blog/static/15018172011714115345101/

The Kernel Newbie Corner: "initrd" and "initramfs"--What's Up With That?:

https://www.linux.com/learn/linux-training/92607-the-kernel-newbie-corner-qinitrdq-and-qinitramfsq-whats-up-with-that

http://lugatgt.org/content/booting.inittools/downloads/presentation.pdf

https://wiki.gentoo.org/wiki/Initramfs/HOWTO

原创粉丝点击