什么是根文件系统

下面是从Undertanding   the   linux   kernel   3rd摘录的
12.4.   Filesystem   Handling
Like   every   traditional   Unix   system,   Linux   makes   use   of   a   system 's   root   filesystem   :   it   is   the   filesystem   that   is   directly   mounted   by   the   kernel   during   the   booting   phase   and   that   holds   the   system   initialization   scripts   and   the   most   essential   system   programs.

Other   filesystems   can   be   mountedeither   by   the   initialization   scripts   or   directly   by   the   userson   directories   of   already   mounted   filesystems.   Being   a   tree   of   directories,   every   filesystem   has   its   own   root   directory.   The   directory   on   which   a   filesystem   is   mounted   is   called   the   mount   point.   A   mounted   filesystem   is   a   child   of   the   mounted   filesystem   to   which   the   mount   point   directory   belongs.   For   instance,   the   /proc   virtual   filesystem   is   a   child   of   the   system 's   root   filesystem   (and   the   system 's   root   filesystem   is   the   parent   of   /proc).   The   root   directory   of   a   mounted   filesystem   hides   the   content   of   the   mount   point   directory   of   the   parent   filesystem,   as   well   as   the   whole   subtree   of   the   parent   filesystem   below   the   mount   point.


简单的来说,我认为根文件系统就是一种目录结构,那么根文件系统和普通的文件系统有什么区别呢?我认为根文件系统就是要包括Linux启动时所 必须的目录和关键性的文件,例如Linux启动时都需要有init目录下的相关文件,在Linux挂载分区时Linux一定会找/etc/fstab这个 挂载文件等,根文件系统中还包括了许多的应用程序bin目录等,任何包括这些Linux系统启动所必须的文件都可以成为根文件系统。

    Linux支持多种文件系统类型,在嵌入式上常用的有:ROMFS,JFFS2,NFS,CRAMFS,YAFFS等等。在Linux系统中是通过mount命令来挂载不同的文件系统。
在ARM Linux中常用的文件系统的配置:
RAM Disk Driver + EXT2;
MTD Driver + JFFS2/YAFFS;
NFS;
uclinux中常见的文件系统配置为:
Blkmem Driver + ROMFS(支持 Nor Flash);
RAM Disk Driver + ROMFS(不支持FLASH);
MTD Driver + JFFS2/YAFFS(支持多种flash);
   建立根文件系统的步骤:
1.创建根文件系统目录。
2.创建各种必要的系统文件目录。
3.创建设备文件。
4.建立启动相关的配置文件。
5.编译安装库文件glibc/uclibc。
6.编译busybox,安装系统软件和应用。
这里重点要建立启动相关的配置文件(Linux-2.6):
创建/etc/inittab
::sysinit:/etc/init.d/rcS
::respawn:/sbin/getty 115200 s3c2410_serial0
::restart:/sbin/init
::shutdown:/bin/umount -a -r
创建/etc/init.d文件
#!/bin/sh
mount -a
/etc/init.d/udev  start
mkdir  /dev/pts
mount -t devpts devpts /dev/pts
hwclock --hctosys
ifup eth0
ifup lo
/etc/init.d/sshd start
thttpd -C /etc/thttpd.conf
建立开发板上的文件系统配置文件/etc/fstab
proc       /proc      proc      defaults    0    0
sys        /sys       sysfs     defaults    0    0
原文地址:https://www.cnblogs.com/hnrainll/p/2076541.html