In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what is the relationship between the Linux kernel and the root file system", the content is simple and clear, and I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "what is the relationship between the Linux kernel and the root file system".
The relationship between the Linux kernel and the root file system begins by digressing: for Linux beginners, this is a very tangled issue, but it is also a critical issue!
In a word: "although the kernel is the core of Linux, files are the main tools used by users to interact with the operating system. This is especially true for Linux, because in the UNIX tradition, it uses the file Imando O mechanism to manage hardware devices and data files."
one。 What is a file system?
The file system refers to the physical space where the file exists, and each partition in the linux system is a file system with its own directory hierarchy.
The file in the Linux file system is a collection of data. The file system contains not only the data in the file, but also the structure of the file system. All the files, directories, soft connections and file protection information seen by Linux users and programs are stored in it. This mechanism facilitates the interaction between the user and the operating system.
Each actual file system is separated from the operating system and system services, and they communicate through an interface layer: virtual file system or VFS. VFS enables Linux to support multiple different file systems, each representing a common interface for VFS. Because the software translates all the details of the Linux file system, other parts of the Linux core and programs running in the system will see a unified file system. Linux's virtual file system allows users to transparently mount many different file systems at the same time.
In Linux file system, EXT2 file system, virtual file system and / proc file system are three representative file systems.
two。 What is the root file system
First of all, the root file system is a kind of file system, which not only has the function of storing data files as the ordinary file system, but what makes it special compared with the ordinary file system is that it is the first file system mounted (mount) when the kernel is started, and the image file of the kernel code is saved in the root file system. The system boot launcher loads some initialization scripts (such as rcS,inittab) and services into memory to run after the root file system is mounted. We need to understand that the file system and the kernel are two completely separate parts. When the kernel transplanted in the embedded system is downloaded to the development board, there is no way to really start the Linux operating system, and there will be an error that the file system cannot be loaded.
So when exactly is the root file system mounted during system startup? Mount / dev/ram0 first, and then execute / linuxrc. When it's done. Switch to the root directory, and then mount the specific root file system. After the root file system is executed, that is, at the end of the Start_kernel () function, the process that executes init, the first user process. Perform various initialization operations on the system.
The reason why the root file system adds a "root" in front of it means that it is the "root" of loading other file systems. since it is a root, there is no way for other file systems to load without this root. It contains the files necessary for the system to boot and mount other file systems. The root file system includes directories and key files necessary for Linux startup, for example, Linux startup requires relevant files under the init directory, when Linux mounts partitions, Linux will definitely find / etc/fstab this mount file, etc., the root file system also includes many application bin directories, etc., any files including these necessary files for Linux system startup can become the root file system. When Linux starts, the first thing that must be mounted is the root file system; if the system cannot mount the root file system from the specified device, the system will make an error and exit boot. Other file systems can be mounted automatically or manually after success. Therefore, different file systems can exist in a system at the same time. The process of associating a file system with a storage device in Linux is called mount. Use the mount command to attach a file system to the current file system hierarchy (root). When performing a mount, provide the file system type, file system, and a mount point. After the root file system is mounted to the root directory "/", there are various directories of the root file system under the root directory, files: / bin / sbin / mnt, etc., and then attach other partitions to the / mnt directory, and / mnt directory will have all the directories and files of this partition.
three。 What is the kernel?
The core of Linux is like the human heart, soul and command center. The kernel is the core of an operating system, which is responsible for managing the system's processes, memory, device drivers, files and network systems, and determines the performance and stability of the system. The kernel performs the lowest-level tasks in an exclusive way to ensure the normal operation of the system. Coordinate multiple concurrent processes, manage the memory used by processes, so that they do not conflict with each other, meet the requests of processes to access disk, and so on.
The operating system is a low-level supporting software used to deal with hardware and provide a limited set of services for user programs. A computer system is a symbiosis of hardware and software, which are interdependent and inseparable. The hardware of a computer consists of peripherals, processors, memory, hard drives, and other electronic devices that make up the engine of the computer. But without software to operate and control it, you can't work on your own. The software that does this control is called the operating system, which is called the "kernel" or "core" in Linux terminology. The main modules (or components) of the Linux kernel are divided into the following parts: storage management, CPU and process management, file system, device management and driver, network communication, and system initialization (boot), system calls, etc.
four。 The relationship between kernel and file system
Technically, Linux is a kernel. "kernel" refers to a system software that provides hardware abstraction layer, disk and file system control, multitasking, and so on. A kernel is not a complete operating system. A complete operating system based on the Linux kernel is called the Linux operating system, or GNU/Linux.
The file system is part of kernel. The file system realizes the interaction between storage media and other resources on the system. The fs directory in kernel tree is all about the file system, which can be said to be a large subsystem of kernel.
The embedded system allocates the area where the kernel and root file system are stored in flash. Bootloader loads the kernel, starts the kernel, loads the file system, and enters the Linux system.
The whole embedded system can be divided into three parts: 1.uboot 2.kernel 3. File system. Among them, VFS is used in kernel to support various file systems, such as yaffs,ext3,cramfs and so on. Yaffs/yaffs2 is a log file system designed for embedded systems to use NAND flash memory. In the kernel, VFS is used to shield different interfaces of various file systems, and VFS is used to provide a unified interface to kernel. For example, open is used when opening a file, and write is used when writing, regardless of what kind of file system it is, and how the file system writes data to physical media. The configuration in kernel only allows VFS to support this interface.
These are all the contents of the article "what is the relationship between the Linux kernel and the root file system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.