码迷,mamicode.com
首页 > 系统相关 > 详细

linux支持的内存根文件系统

时间:2015-09-21 01:16:31      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:

linux支持两种内存根文件系统:ramdisk和initramfs。

----------------------------------------------------------------------------------------------------

Document/early-userspace/README

128 The kernel has currently 3 ways to mount the root filesystem:
129
130 a) all required device and filesystem drivers compiled into the kernel, no
131    initrd.  init/main.c:init() will call prepare_namespace() to mount the
132    final root filesystem, based on the root= option and optional init= to run
133    some other init binary than listed at the end of init/main.c:init().
134
135 b) some device and filesystem drivers built as modules and stored in an
136    initrd.  The initrd must contain a binary ‘/linuxrc‘ which is supposed to
137    load these driver modules.  It is also possible to mount the final root
138    filesystem via linuxrc and use the pivot_root syscall.  The initrd is
139    mounted and executed via prepare_namespace().
140
141 c) using initramfs.  The call to prepare_namespace() must be skipped.
142    This means that a binary must do all the work.  Said binary can be stored
143    into initramfs either via modifying usr/gen_init_cpio.c or via the new
144    initrd format, an cpio archive.  It must be called "/init".  This binary
145    is responsible to do all the things prepare_namespace() would do.
146
147    To maintain backwards compatibility, the /init binary will only run if it
148    comes via an initramfs cpio archive.  If this is not the case,
149    init/main.c:init() will run prepare_namespace() to mount the final root
150    and exec one of the predefined init binaries.
------------------------------------------------------------------------------------------------

initramfs

initramfs可以直接嵌入linux内核中,同内核一起编译。它可以为压缩文件,也可为普通非压缩文件系统。

其位置通过CONFIG_INITRAMFS_SOURCE指定。

注:若指定了CONFIG_INITRAMFS_SOURCE,则系统不会再响应ramdisk,jffs2等根文件系统,

       不响应CONFIG_CMDLINE,即使INITRAMFS_SOURCE指定的目录为空或非正确的文件系统。

initramfs文件系统启动时,会在根文件系统中执行第一个init程序,对uboot中穿过来的

init=/linuxrc不予理睬。

注:不管linuxrc,还是init,都是符号链接,指向/bin/busybox.

 

linux支持的内存根文件系统

标签:

原文地址:http://www.cnblogs.com/embedded-linux/p/4824774.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!