Basic Introduction to linux-detailed introduction to linux Startup
Linux System Startup Process1. BIOS (self-check)
2. MBR: Boot Code (Disk partitioning mechanism, Boot Code, now the hard disk or device)
3. Run the Bootstrap program-GRUB
4. Load the kernel (kernel, at this time the underlying operating system has been started)
5. Execute Init (first process, pid = 1)
6. runlevel
1 BIOSBIOS (basic input output system) is called a basic input output system, which is generally stored in the BIOS chip on the motherboard.
When the computer is started, the first operation is the BIOS. the BIOS is responsible for checking the hardware and finding the enable device.
Enable devices to be defined in BIOS settings, such as USB, CDROM, and HD.
2 MBRBIOS find the device that can be started and then execute its Boot Code
The pilot Code is the first 446 bytes of MBR
3 GRUBGrub is the mainstream boot program used in linux.
It can be used to guide almost all operating systems
Grub-related files are stored in the/boot/grub directory.
Grub configuration file/boot/grub. cfg (ubuntu14.04)
For example, you can see: timeout = 10, which is the loading timeout time.
4. The kernelMBR Boot Code will be responsible for finding and loading the kernel.
The Linux kernel is stored in/boot/vmlinuz -----
The package file of the kernel module is usually loaded:/boot/initrd ....
In linux, Some uncommon drivers are compiled into modules to ensure the streamlining of kernel. These modules are dynamically loaded as needed and packaged and saved as an initramfs file.
Initramfs is an optimized and alternative version of initrd, which saves more space and is more flexible than initrd.
Command dmesg to view the kernel output information at this startup
5. initinit is the first process running in linux.
Use the top command to see
1 root 20 0 4524 2532 S 1424 0.0. 66 init
The process whose PID = 1 is named init
The process id pid is arranged according to the system startup sequence, indicating that init is the first startup process in the operating system and remains critical until init is the parent process of all processes.
Call/etc/rc. d/rc. sysinit to initialize the system, mount the file system, and start the corresponding services according to the running level,I recommend that you know the functions of init. d and init files in Linux?.
Linux running level:
0 Shutdown
1 single user mode
2. Multi-user mode without network
3 Multi-User Mode
4 unused
5x11 graphical mode
6. Restart
The most commonly used linux runtime levels are 3 and 5. The difference between them is whether there is a graphical interface.
You can use the/etc/inittab configuration file to modify the default running level.
The startup service corresponding to each level is saved in/etc/rc. d/rc [0123456]. d.
The runlevel command displays the current and previous running levels.
The init command can be used to change the current running level.
A single user can change the ROOT password to the kernel to pass parameter 1 or the single user can enter the single user mode.
Do not start any service in single-user mode
Login in single-user mode directly in mode without a password
You can use passwd root to change the password of the root user.
GRUB encryption: Add the following parameters to the startup configuration of grub. conf to encrypt grub:
Password -- md5 % **********
The encrypted password can be generated through the grub-md5-crypt