Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux operating system boot process analysis     - How SSHfs mount a remote file system on Linux (Linux)

- Windows 7 hard disk to install Ubuntu 14.10 (Linux)

- Shell Programming Regular Expressions (Programming)

- Python implementation restart the router (Programming)

- Ubuntu 14.04 LTS compiler installation R Source Code (Linux)

- Common Linux system performance monitoring command (Linux)

- The development environment to build Nodejs under Ubuntu 14.04 (Linux)

- Linux system started to learn: Teaches you install Ubuntu 15.04 on VirtualBox (Linux)

- IP configuration under Linux (Linux)

- RHEL7 Apache MPM configuration (Server)

- Configuring ftp server and nfs server under Linux (Server)

- OpenSSL: implementation creates a private CA, certificate signing request Explanation (Server)

- Nginx1.8 version upgrade method AMH4.2 Free manually compile (Server)

- Vagrant Getting Start (Linux)

- MySQL concat function is SQL injection (Linux)

- Ubuntu Eclipse configuration Gtk + 2.0 libraries (Linux)

- Ubuntu 15.04 installed JDK and configured as the default JDK (Linux)

- Linux instructions and examples GPG encryption and decryption (Linux)

- Iptables use examples (Linux)

- Using Java to build micro-services (Server)

 
         
  Linux operating system boot process analysis
     
  Add Date : 2018-11-21      
         
         
         
  Start the BIOS program

When the power button is pressed, BIOS (Basic nput Output System) will be run by the flash memory on the motherboard. BIOS program will decompress themselves to the system memory, and then read the CMOS (Complementary Metal Oxide Semiconductor) the storage of information (such as system time, boot device order, etc.) to configure the system. At the same time self-test (POST: Power-On Self Test). Hardware detection system if there are problems, then self-checking, BIOS loads the MBR first boot device (Master Boot Record: master boot sector) in the boot loader program.

It should be noted that is, BIOS bootloader is loaded by hardware interrupt INT 13 functions to be loaded. That is, after the BIOS to read the disk, INT 13 through this channel to read the first sector of the disk in the boot loader program!

Start Bootloader program

The following Linux Bootloader There are many, such as early default LILO, as well as the current mainstream grub. Below the current Linux system above mainstream grub bootloader mainly done to explain what happened?

It will automatically read the configuration file /boot/grub/grub.conf Grub boot, and then execute the command grub! Figure 2.1 is a configuration file grub.conf CentOS6.5 above! Grub command is part of the red box, it is mainly divided into three parts

        1. Set boot hard disk partition (root command), passed to the command parameter is the partition, this command will be to analyze and mount the partition, and then read out in one of the / boot folder following. For example, as shown in Figure 2.2, after executing the command, the boot can read the contents of a folder below!


2. Select boot kernel file and set the kernel parameters (kernel command)

3. Load the initrd file, set the virtual file system. (Initrd command)

Of particular note is the initrd file, this is actually a virtual file system (Initial RAM Disk). In the Linux system, some disk driver does not build in the kernel, but is packaged into modules stored in the / lib / modules directory, and when you need to load the kernel boot disk drivers. But the / lib / modules has not been mounted, then it produces a contradiction! To resolve this conflict, it gave rise to the concept of the virtual file system. We can say initrd file is loaded into memory (for fear of affecting the file system on the disk, then the root directory is mounted read-only way to mount), a virtual file system root out, and then read virtual root file system disk driver, and then re-mount the real root directory.


Loading system kernel and hardware drivers

 After the program finishes running Grub above three commands, kernel file (vmlinuz - $ (uname -r)) will be extracted to the memory into running! At this time, the kernel will detect it again myself come from a new hardware and load the driver! After the check is complete, the kernel will call the Init procedure, a process to create the first system!

Init process for system initialization

 After Init program starts, it will be the first to read the / etc / inittab file for this operating system Run Level (run level). What is the level of running it, Linux system the following depending on whether the network and to the X Window

Run system is divided into seven levels.


This is the description of the mode in which the Linux / etc / inittab file.

0 represents the off mode, Mode 1 represents single-user mode (maintenance mode), Mode 2 represents a multi-user from the command line, but not the network. Mode 3 represents a network comprising multi-user command line mode. Mode 4 is reserved for the system function. Mode 5 represents a graphical interface mode. Mode 6 represents the state of the system is restarted.

Corresponding to each run level, / etc directory are set different directories

Run a system level, or to run the appropriate directory (/ etc / rc [runlevel] .d) within the script file. Here that rc represents the run command, the command starts to run when, on behalf of the .d directory, the directory represents the meaning!

Inittab a file system can be set start level, there are some other features

This is CentOS6.5 above inittab for a description of other configurations.

In short, Init program after obtaining over operation of the system level, we will continue to perform the following functions:

Initializing the system (/etc/init/rcS.conf execute this script file or to run some custom level program run by /etc/init/rc.conf)

Load System Services item (running / etc / rc [runlevel] .d / in the script file)

Set Ctrl + Alt + Del key features

Mingetty six runs to set the appropriate terminals

Run the terminal and accept user login

When the contents of the system initialization is complete, the system will call mingetty function to set up the terminal, and waits for user login! It is this specific process, init process to fork a child process and the child process to exec a getty program. Getty will attempt to open a terminal, if the open is successful, it will display the word on the screen to login, when a user types a user name after the task getty program is complete! It then calls the way to exec login procedure. Login program to read user name and password, and then read the shadow file to verify the user's password is correct. If the password is incorrect, the login by calling exit 1 to exit, then the init process fork again to repeat the above steps.

If the password verification is successful, then the login program will set some operating system environments (such as setting the working directory, set the uid and gid, user name, etc.). After setting up these systems environments, login procedure will be invoked by the shell program exec, shell program execution and read some of the startup script (such as / etc / bashrc, etc.). After reading finish these startup scripts, shell prompt, print out, and then waits for the user to type commands! At this point we will start a normal system!
     
         
         
         
  More:      
 
- Ubuntu install image browser and manager Phototonic 1.6.17 (Linux)
- Android Custom View password box example (Programming)
- MySQL fuzzy query: LIKE and REGEXP pattern mode (Database)
- Introduction to Linux Shell (Programming)
- To_explore Linux system boot process (Linux)
- How to force Linux users to change the initial password the first time you log in (Linux)
- Embedded Linux to solve the problem in the time zone (Linux)
- GEC2440 easiest a kernel compile Linux2.6.30.4 (Programming)
- Oracle View index and use indexes Precautions (Database)
- Lazarus IDE Start Basics Tutorial (Linux)
- To get Java class / jar package path (Programming)
- Android design patterns - state mode (Programming)
- Comparison of C # and Java (Programming)
- Learning C ++ Standard Template Library and data structures (Programming)
- Nginx version of helloworld (Server)
- CV: Linux command displays the progress of the run command (Linux)
- Iptables on the request URL for IP access control (Linux)
- Using Vagrant to build multi-platform environment (Server)
- Upgrade Goldengate 11.1.1.1.2 to 11.2.1.0.1 (Database)
- Ubuntu Learning Advanced article - to teach you to further enhance system security (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.