|Guide reading||The final phase of kernel startup starts three processes|
Process 0: Process 0 is actually the idle process just mentioned, called idle process, that is, dead cycle.
Process 1: The kernel_init function is process 1, which is called init process.
Process 2: The kthreadd function is process 2, which is the daemon of the Linux kernel. This process is used to ensure that the Linux kernel itself works properly.
In embedded operating systems, it is common to specify / linuxrc as an init process
(1)/linuxrcIt’s application layer, and has nothing to do with the kernel source code.
(2)/linuxrcIt is executable under the current kernel system of the development board. Therefore, under the Linux system of ARM SoC, this application program is compiled and linked with arm-linux-gcc; if it is under the Linux system of PC, then this program is compiled and connected with gcc.
(3)/linuxrcIf it is a static compilation connection, it can run directly; if it is a dynamic compilation connection, we must provide him with the necessary library files to run. But because our / linuxrc program is executed by direct calls from the kernel, the user has no chance to export the path of the library file.In fact, this / linuxrc can’t be dynamically connected. It’s usually static.
(1)After a series of self-running configurations, the operating system will eventually give the user an operating interface (perhaps CmdLine or GUI), which is brought out by / linuxrc.
(2)User interface and many other things are not responsible in / linuxrc program. User interface has its own special application program, but the application of user interface is directly or indirectly invoked and executed by / linuxrc. User interface programs and other applications are processes 2, 3, 4…. This is what we call process 1 (init process, or / linuxrc) the ancestor of all other application processes.
(1)It’s like a house can’t live directly after it’s built, and it has to be decorated; the operating system can’t be used directly after it’s started, so it needs to be configured.
(2)The configuration of the application layer after the operation system starts (commonly called runtime configuration, etc) is to make our operation system more convenient to use, more suitable for my personal hobbies or practicality.
(1)busyboxIt is a project written in C language. It contains many. C files and. h files. This project can be configured and compiled into applications that can run under various platforms. If we use arm-linux-gcc to compile busybox, we will get one that can be used in our development board.Applications running on the Linux kernel.
(2)busyboxThis program was developed to build rootfs in embedded environment, that is to say, it is an init process application specially developed.
(3)busyboxA complete set of shell command assemblies is provided for the current system. Such as vi, cd, mkdir, ls and so on. Vi, cd, ls and so on are individual responses in desktop Linux distributions (such as ubuntu, redhat, centOS, etc.).Use the program. But in embedded linux, in order to save time, we assemble all the commonly used shell commands such as vi, CD and so on to form a shell command package called busybox.
2、devDevice files in the directory. In linux, everything is a file, so a hardware device is also virtualized into a device file to access. In Linux system, / dev / xxx means a hardware device. When we want to operate this hardware, we open the device file.Then read/write/ioctl operates the device, and close closes the device.
The / dev directory is also essential in minimal rootfs, where one or two device files are required by rootfs.
3、sysAnd the proc directory. In the smallest rootfs, it is also not omitted, but these two can be created as long as the empty folder, there is nothing inside, and there is no need for anything. These two directories are also driver-related. Belongs to the virtual file system in linux.
4、usrIt is the place where all the files of the users of the system are stored, which will be automatically generated when busybox is installed in the future.
5、etcThe directory is a key and important one. All the files in the directory are run-time configuration files. All configuration files in the / etc directory will be directly or indirectly invoked and executed by / linuxrc to complete the runtime configuration of the operating system. Etc directory is the key to making rootfsSo the next course will be devoted to this etc directory.
6、libThe directory is also a key one in rootfs, which can not be omitted. The lib directory contains dynamic and static link library files in the current operating system. We are mainly for the dynamic link libraries.
This paper refers to:https://www.linuxprobe.com/processof-linuxrootfsand-linuxrc.html