zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    列举 spring 支持的事务管理类型?
    memcached 能够更有效地使用内存吗?
    Redis 集群方案什么情况下会导致整个集群不可用?
    详细描述一下 Elasticsearch 更新和删除文档的过程?
    Redis 常见性能问题和解决方案?
    如果有大量的 key 需要设置同一时间过期,一般需要注意什么?
    synchronized 和 ReentrantLock 的区别?
    Redis 支持的 Java 客户端都有哪些?官方推荐用哪个?
    memcached 最大的优势是什么?
    memcached 是原子的吗?
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/4824774.html
Copyright © 2011-2022 走看看