A Linux startup process analysis
1 Current major Linux distributions in the mainstream boot loader using the software for grub
2 in simple terms, the process of booting the system is as follows:
1. Load the BIOS hardware information and self test, and according to the setup to get the first bootable device
2. The boot loader that reads and executes the MBR in the first boot device is the general grub
3. Loading kernel,kernel based on boot loader will start to detect hardware and load drivers
4. After the hardware driver succeeds, kernel will actively invoke the INIT process, and Init will obtain run-level information
5. Init prepares the environment for software execution and each service, and finally waits for the user's login
The 3 boot loader, called the Boot Loader, is in the first sector of the boot device, which is what we've always said MBR
4 Why do we recommend installing Windows and installing Linux first?
The reason is that Linux has control-forwarding capabilities, and Windows is not, because Windows will only load its own when the boot loader is loaded (rogue, industry cancer)
5 if my MBR uses Linux grub, then we have three menus.
1. The first menu is a kernel file that directly points to Linux to load the kernel directly to start Linux
2. The second menu is the boot loader control to Windows, which loads the Windows kernel to start Windows
3. Using the boot loader in Linux boot sector, you will jump out of another grub menu
6 after the kernel loaded finished hardware detection and driver loading, at this time our kernel will be the initiative to call the first process is/sbin/init
7 Run Level
0: Direct shutdown of the system
1: Single user maintenance mode, used in the system when the problem of maintenance
2: Similar to run Level 3, but no NFS service
3: Pure text mode with full network function
4: System retention function
5: Similar to run Level 3, but loaded with X window
6: Reboot
8 Init's configuration file is/etc/inittab
9 If the user has the work to do when the system starts, can write directly in the/etc/rc.d/rc.local, then the work will be loaded automatically when starting, and do not have to wait for us to login the system to start.
10 use init x to switch to run level x if you are only temporarily changing the running level of the system
Two Boot Loader
1 boot loader is an important tool to load the kernel, without boot loader, the kernel has no way to be loaded by the system.
2 HDD and partition code in GRUB
1 The first hard drive to find is code-named (HD0), and the hard drive has a partition (hd0, 0)
2 inside Grub, it starts with a number of 0 instead of 1, the first hard drive of the first partition of Grub is code-named (hd0, 0), the first hard drive of the first logical partition of GRUB is code-named (hd0, 4)
3 BIOS not able to read large hard drive problem
For example, many friends in the past often found that the system used to start the installation of DVD, you can successfully install Linux, but the first time the screen appears only a black, and appear grub> words, and can not enter the Linux system, this is how it?
1 during installation, the Linux kernel is not a problem because it is started with a DVD or CD, and the kernel loses detection system hardware, so it can identify hard disks that are not recognized by the BIOS
2 But enter the hard disk boot, because the kernel and INITRD files are through the BIOS of the INT3 channel to read, so your kernel and initrd if placed in the BIOS can not judge the sector, of course, can not be loaded, and will only appear grub> waiting for your Processing
Three key contents
1 Linux can not be shut down at will, otherwise prone to file system confusion or other problems can not start
2 start-up process is mainly bios,mbr,loader,kernel+initrd,/sbin/init and other processes
3 Init's configuration file is/etc/initab, this file can set the default RunLevel, System initialization script, different execution level service
4 Grub profile and related file system definition file too many places in/boot/grub directory, configuration file name is Menu.lst
5 to enter the rescue mode, you can enter the rescue mode by adding "single" or "Init=/bin/bash" to the kernel option after the boot menu process.
See more highlights of this column: http://www.bianceng.cn/OS/Linux/