Detailed analysis: how to create an embedded Linux file system

Source: Internet
Author: User
Article title: detailed explanation: how to create an embedded Linux file system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1. what is a file system)

A directory structure contained within a disk drive or disk area. the total available disk space can be composed of one or more filesystems. A filesystem must be mounted before it can be accessed. to mount a filesystem, you must specify a directory to act as the mount point. once mounted, any access to the mount point directory or its subdirectories will access the separate filesystem.

A file system is a directory structure that includes a disk (including a CD, floppy disk, flash disk, and other storage devices) or a partition. an applicable disk device can contain one or more file systems; to access a file system, you must first mount the file system. to mount the file system, you must specify a mount point.

II. mainly embedded file systems

* In Linux, rootfs is essential. Ramdisk and direct mounting of the root file system on HD (hard disk) are mainly implemented on the PC. in embedded systems, it is generally started from Flash instead of HD, the simplest method is to load rootfs to RAM's RAMDisk. the more complex method is to directly read Cramfs from Flash, and more complicated is to partition on Flash and build file systems such as JFFS2.

* RAMDisk compresses the created rootfs and writes it to Flash. during startup, the Bootloader loads it to RAM, decompress it, and then mounts it /. This method is simple, but the file system in RAM is not compressed, so it needs to occupy a lot of rare resources in embedded systems RAM.

Ramdisk uses memory space to simulate hard disk partitions. ramdisk usually uses the compression of the disk file system and stores it in flash. during system initialization, it is decompressed to SDRAM and mounted to the root file system, in linux, there are two types of ramdisk. one is to format and load ramdisk, which is supported in linux kernel 2.0/2.2. The disadvantage is that the size is fixed; the other is supported by the 2.4 Kernel. it is implemented through ramfs and cannot be formatted, but it is easy to use. its size increases or decreases as needed, ramdisk is a common ramdisk technology in linux.

* Initrd is the RAMDisk format. before kernel 2.4 was image-initrd, Kernel 2.5 introduced cpio-initrd, which greatly simplified the Linux startup process and attached the basic philosophy of Linux: keep it simple, stupid (KISS ). however, cpio-initrd is not widely tested as a new format, and image-initrd is mainly used in embedded Linux.

* Cramfs is a simple file system written by Linus. it can be run directly from Flash without being loaded to RAM, thus saving RAM. However, Cramfs is read-only and inconvenient for directories (such as/etc,/var,/tmp) that need to be modified during runtime. therefore, these directories are generally made into writable fs such as ramfs.

* SquashFS is an enhancement to Cramfs. It breaks through some Cramfs restrictions and also has advantages in Flash and RAM usage. However, according to developers, the performance may be inferior to that of Cramfs. This is also a new method. more tests are required before embedded systems are used.

[1] [2] [3] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.