• 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.

  • 相关阅读:
    c# 4.0新功能--隐式类型
    常用的sql语句记录
    算法学习-回文数判断
    算法学习-两数之和
    RSA加密(前端js)和MD5加密(后台)同时使用实例
    layer父页获取弹出层输入框里面的值
    关于checkbox的全选和反选实例
    jQuery实用小技巧-获取选中的的下拉框和返回头部滑动动画
    jQuery实用小技巧--输入框文字获取和失去焦点
    得到网站下的文件虚拟路径的方法
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/4824774.html
Copyright © 2020-2023  润新知