[Beijing Xunwei] i.MX6ULL Terminator Linux file system development root file system introduction

1 Root file system

The root file system is the first file system that is mounted when the kernel starts. The kernel code image file is stored in the root file system, and the system boot program will install some basic initialization scripts and services from the root file system after it is mounted. Wait to be loaded into memory to run.
To elaborate, the root file system is first a file system, which has the function of storing data files in a common file system, but compared to a common file system, its special feature is that it is when the kernel is started. The first file system mounted (mount), the image file of the kernel code is saved in the root file system, and the system boot program will install some initialization scripts (such as rcS, inittab) and services after the root file system is mounted. Load it into memory to run. We have to understand that the file system and the kernel are two completely independent parts. In short: a set of linux system, only the kernel itself cannot work, it must be rootfs (configuration files in the etc directory, shell commands in directories such as /bin, /sbin, and library files in the /lib directory, etc. ) Only work together.

2 Root file system directory

We use the command "cd /" to enter the root directory as shown in Figure 2.1:
Insert picture description here

Figure 2.1

Then use the command "ls" to view the directory composition under linux:
Insert picture description here

Figure 2.2

Let's briefly explain these commonly used directories:
1.
The /bin directory stores basic commands that all users can use. These commands can be used before mounting other file systems, so the /bin directory must be connected to the root file system In the same partition. Commonly used commands in the /bin directory are: cat, chgrp, chmod, cp, ls, sh, kill, mount, umount, mkdir, mknod, test, etc. When we use Busybox to make the root file system, we will place it in the generated bin directory , You can see some executable files, that is, some commands available.
2./sbin directory
This directory stores system commands, that is, commands that only administrators can use. System commands can also be stored in the /usr/sbin, /usr/local/sbin directories, and the /sbin directory is basic System commands, which are used to start the system, repair the system, etc., are similar to the /bin directory. You can use /sbin before mounting other file systems, so the /sbin directory must be in the same partition as the root file system. Commonly used commands in the /sbin directory are shutdown, reboot, fdisk, fsck, etc. The system commands installed by local users are placed in the /usr/local/sbin directory.
3./dev directory
This directory stores device files. Device files are unique file types in Linux. Under Linux systems, various devices are accessed as files, that is, to operate a specific device file by reading and writing. hardware. For example, serial port 0 can be operated through the "dev/ttymxc0" file, and the second partition of the MTD device can be accessed through "/dev/mtdblock1".
4.
The /etc directory contains various configuration files. For Linux systems on a PC, there are many files and directories in the /etc directory. These directory files are optional and depend on the applications in the system. Programs, depending on whether these programs require configuration files. In embedded systems, these contents can be greatly reduced.
5./lib directory
This directory stores shared libraries and loadable (drivers). The shared libraries are used to start the system. Run executable programs in the root file system, such as the programs in the /bin /sbin directory.
6./home directory The
user directory, it is optional. For every ordinary user, there is a subdirectory named after the user in the /home directory, which stores user-related configuration files.
7./root directory The
root user's directory, corresponding to this, the ordinary user's directory is a certain subdirectory under /home.
8.
The content of the /usr directory /usr directory can be stored in another partition, and then mounted to the /usr directory in the root file system after the system is started. Stored inside are shared, read-only programs and data, which indicates that the contents of the /usr directory can be shared among multiple hosts, and these are mainly in line with FHS standards. The files in /usr should be read-only, other host-related, variable files should be stored in other directories, such as /var. The /usr directory can be reduced in embedded.
9./var directory
Contrary to the /usr directory, the /var directory stores variable data, such as the spool directory (mail, news), log files, and temporary files.
10. /proc directory
This is an empty directory, often used as the mount point of the proc file system. The proc file system is a virtual file system. It has no actual storage devices. The directories and files in it are all temporarily generated by the kernel. To indicate the operating status of the system, and to operate the file control system.
11./mnt directory
The mount point used to temporarily mount a certain file system. It is usually an empty directory. You can also create an empty subdirectory in it, such as /mnt/cdram /mnt/hda1. Used to temporarily mount CDs and hard drives.
12./tmp directory
It is used to store temporary files, usually an empty directory. Some programs that need to generate temporary files use the /tmp directory, so the /tmp directory must exist and be accessible.

Insert picture description here

Guess you like

Origin blog.csdn.net/BeiJingXunWei/article/details/113102959