During Linux Startup, the first file system must be mounted. If the system cannot mount the root file system from a specified device, the system will exit the startup due to an error. You can then automatically or manually Mount other file systems. Therefore, different file systems can exist in a system at the same time. Different file system types have different characteristics, so there are different application scenarios based on the hardware characteristics and system requirements of storage devices. In Embedded Linux applications, the main storage device is Ram (DRAM,
SDRAM and Rom (usually flash memory). Common file system types based on storage devices include jffs2, yaffs, cramfs, romfs, ramdisk, ramfs/tmpfs.
1. Flash-based file system: Generally, when writing content to flash, you must first erase the corresponding storage range (erasure and writing are separate ), this erasure is performed in blocks. Therefore, you must design a file system that meets application requirements based on flash hardware features. Traditional file systems such as ext2 have many drawbacks when used as Flash file systems. In Embedded Linux, MTD (memory technology device, storage technology device) provides a unified abstract interface between the underlying hardware (flash memory) and the upper layer (File System, that is, the Flash file system is based on the MTD driver layer, the main advantage of using the MTD driver is that it has better support, management and sector-based erasure, read/write operation interfaces for flash. Formats:
(1) jffs (Journalling flash filesystem) is a file system first developed for Embedded Systems by Swedish axis communications based on the Linux kernel. Jffs2 is a flash file system developed by RedHat Based on jffs. It is mainly used for nor-type flash memory and based on MTD driver layer.
(2) yaffs/yaffs2 (yet another flash File System) is a log file system designed for embedded systems to use nand flash memory. Compared with jffs2, jffs2 reduces some features (for example, data compression is not supported), so the speed is faster, the mounting time is short, and the memory usage is small.
(3) other file systems: fat/FAT32 can also be used for extended memory (SD cards for actual embedded systems, such as PDAs, smartphone, and digital cameras ), this is mainly for better compatibility with the most popular Windows desktop operating systems. Ext2 can also be used as an embedded Linux File System, but using it in flash memory has many drawbacks.
2. Ram-based file systems:
(1) ramdisk uses some fixed-size memory as a partition. It is not an actual file system, but a mechanism to load the actual file system into the memory, and can be used as the root file system. By placing some frequently accessed files (such as the read-only root file system) in the memory through ramdisk, the system performance can be significantly improved.
(2) ramfs/tmpfs, ramfs is a memory-based file system developed by Linus Torvalds. It works on the Virtual File System (VFS) layer and cannot be formatted. Multiple file systems can be created, you can specify the maximum memory size that can be used during creation.
3. Network File System (NFS): NFS is a technology developed and developed by Sun to share files through networks between different machines and operating systems. In the development and debugging phase of an embedded Linux system, you can use this technology to establish an NFS-based root file system on the host and mount it to an embedded device, so that you can easily modify the content of the root file system.
4, ubi File System: Before linux-2.6.27, talking about flash file system, we often think of those file systems as shown in 1. After the linux-2.6.27, the kernel added a new type of FLASH file system ubi (unsorted block images ).
Currently, flash management methods include:
(1) MTD + FTL/nftl (flash Conversion Layer/NAND Flash Conversion Layer) + traditional file systems, such as fat and ext2. FTL/nftl is a unique feature of flash. It implements log management, bad block management, profit and loss balancing, and other technologies through software.
(2) Hardware Translation Layer + traditional file system solution. This method is used by many storage card products, such as SD card and USB flash disk.
(3) Use MTD + flash dedicated file systems, such as jffs1/2 and yaffs1/2. They greatly improve flash management capabilities and are widely used.
Set the ubifs file system as the parameter for starting the root file system:
# Setenv bootargs console = ttys2, 115200n8 ubi. MTD = 4 root = ubi0: rootfs rootfstype = ubifs
# Saveenv
Http://www.embedu.org/Column/Column102.htm ()