Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux operating system boot process analysis     - C # compiler to achieve functional use in the runtime (Programming)

- The default permissions for files and directories under Linux computing (Linux)

- Nagios plugin installation tutorial of Nrpe (Linux)

- mysqldump issue a note (Database)

- The traffic monitoring system: cacti (Linux)

- Row-level security and application-level solutions for the new features of PostgreSQL9.5 (Database)

- Build Python3.4 + PyQt5.3.2 + Eric 6.0 development platform Ubuntu 14.04 (Server)

- RHEL 7.1 compile and install Ganglia 3.7.1 (Server)

- The principle Httpclient4.4 (execution request) (Programming)

- How to add a new hard disk without restarting the CentOS 7 / RHEL 7 virtual machine (Linux)

- Linux kernel panic (because glibc result) Repair (Linux)

- Java interface (Programming)

- Teach you how to synchronize Microsoft OneDrive in Linux (Linux)

- Java implementation chain store binary tree (Programming)

- How to implement Linux host Telnet SSH password Free (Server)

- Oracle table space is too large processing time (Database)

- How to use Linux iptables tool for network sharing (Linux)

- MySQL common functions summary (Database)

- VirtualBox CentOS is configured as a local disk mirroring software source (Linux)

- Linux, C programming language library file handling and preparation of Makefile (Programming)

  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!
- Ubucompilator-Ubuntu, Debian, Linux Mint created deb package of graphical tools (Linux)
- MongoDB slice simple example (Database)
- Getting Started Linux Shell Scripting (Programming)
- EXP-00091: Exporting questionable statistics Processing Method (Database)
- Eight kinds of techniques to solve hard problems Linux (Linux)
- Zabbix monitoring tool deployment under Ubuntu server (Server)
- Oracle 12C with multi-column index (Database)
- Storm how to ensure that at least once semantics (Programming)
- EChart simple and practical control on chart (Programming)
- PLSQL often lose resolution process automatically disconnect the connection (Database)
- Linux use additional rights (Linux)
- Linux signal and orphans, and zombie process (Programming)
- Memcached source installation and configuration under CentOS 6.6 (Server)
- Linux - EXT2 file system is described in detail (Linux)
- How to use Linux iptables tool for network sharing (Linux)
- Ubuntu install Eclipse can not find JAVA_HOME problem (Linux)
- Linux System Getting Started Learning: The Linux command line burn ISO or NRG image to DVD (Linux)
- RegExp object implements regular match --JavaScript (Programming)
- CentOS replaces update source and Linux kernel compilation summary (Linux)
- Five strokes to find out the IP address you want to know (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.