Linux系统内存文件,linux支持的内存根文件系统

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值