本文主要探讨210根文件系统相关知识。
根文件系统
         存储设备(flash等)是分块(扇区),访问存储设备是按块号 (扇区号)来访问,文件系统(软件)对存储设备扇区进行管理,将对扇区的访问变成对目录和文件名的访问
         根文件系统init进程的应用程序和其他应用程序,提供根目录、etc、bin等目录以及shell命令
         根文件系统=inuxrc+VFS+...
linuxrc(进程1)
         linuxrc是可执行应用程序,属于应用层通常为静态连接
         linuxrc提供交互界面且被其他应用程序是直接或间接调用
         linuxrc(busybox)负责系统启动后的配置
         busybox构建rootfs用于产生init进程应用程序,提供shell命令程
VFS
         VFS是虚拟文件系统(FAT、NTFS、ext2、ext3、jffs2、yaffs2、ubi)用于管理块设备,通过文件系统将对扇区的访问变成对目录和文件名的访问且提供访问和操作文件的API,且同一API可适用于对不同格式的文件的操作
         sys,proc实时产生系统运行过程的信息文件以及dev下的设备文件,当系统检测到外部设备接入时,dev下产生对应设备文件,设备取消时设备文件消失都与VFS机制有关
buildroot
         依赖(g++ bison flex texinfo git hgsubversion whois)
         buildroot包含交叉编译工具链制作及rootfs配置编译
         编译后生成rootfs.tar(buildroot/output/images/)
         解压到release目录下使用
demo:
ext3根文件系统制作
mkdir make_rootfs cd make_rootfsdd if=/dev/zero of=rootfs.ext2 bs=1024 count=2048losetup  /dev/loop1 rootfs.ext2mke2fs -m 0 /dev/loop1 2048mount -t ext2 /dev/loop1 ../rootfs/cd ../rootfstouch linuxrccd ..umount /dev/loop1losetup -d /dev/loop1搭建nfs
apt-get install nfs-kernel-server -yapt-get install nfs-common -yvim /etc/exports/root/rootfs *(rw,sync,no_root_squash,no_subtree_check)exportfs -r/etc/init.d/nfs-kernel-server restart/etc/init.d/rpcbind restart检测挂载路径和内容showmount localhost -emount -t nfs -o nolock localhost:/root/rootfs /mnt
        配置内核支持nfs启动
make distcleanmake x210ii_qt_defconfigmake menuconfigmake -j8cp -r arch/arm/boot/zImage ~/tftp/Networking support Networking options TCP/IP networking[*]IP: kernel level autoconfiguration[*] IP: DHCP support[*] IP: BOOTP supportFile systems  --->  Network File Systems  ---><*> NFS client support [*] NFS client support for NFS version 3                                  [*] NFS client support for the NFSv3 ACL protocol extension [*] NFS client support for NFS version 4 (EXPERIMENTAL) [*] NFS client support for NFSv4.1 (DEVELOPER ONLY) [*] Root file system on NFS 
uboot配置nfs启动参数
set bootargs root=/dev/nfs nfsroot=192.168.100.100:/root/rootfs ip=192.168.100.27:192.168.100.100:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC2,115200 set bootcmd 'tftp 30800000 zImage;bootm 30800000'save reset结果显示:
vfs挂载成功,但linuxrc异常
