Linux boot process (version 2), version 2
Linux boot process
Firmware
Press the first start step of the power supply: Start the firmware → POST power-on self-check
Check the hardware loading status, such as the keyboard and memory.
It has nothing to do with the operating system. However, firmware varies with different hardware platforms;
When you add a new hard disk, the first step is to first enter the firmware mode and check whether the firmware has identified this hard disk!
The most important function of firmware is to read MBR->...
UDF
Read MBR [master boot record, master boot record]
[MBR is located in the disk's 0 cylinder, 0 head, 1 sector]
The purpose of this step is to read data from MBR [three types of data are saved in MBR]:
1. Boot Loader: self-initiated program. In Linux, It is GRUB.
2. Partition table: disk Partition table
3. Magic Number: indicates the ending sign.
Brief Analysis on/etc/grub. conf:
Kernel/vmlinuz-2.6.32-358.el6.i686 ro root = UUID = 6e428aef... used to specify the location of the kernel
2: motherboard ID
6: minor version number. If the odd number is the test version, the even number is the official version.
32: Last Version
From this we can see: GRUB's most important role-> loading the kernel!
Appendix-about kernel:
1. It is an executable file, not a pile of files.
2. z-indicates a compressed file, so it will be decompressed continuously at startup.
Load the kernel
During this period, the kernel only performs two tasks:
1. Driver hardware
2. Start the process init:
After init is started, read the configuration file inittab and execute the default running level to continue the boot.
In UNIX/Linux systems, the first process that can exist in init is always 1. [generally, the PID is randomly allocated, but init is special. You can run the following command: ps-el | more view] in Linux, init is essentially the parent process of all processes. Although the init PID is invariably 1, it must also be responsible for a more advanced function: the Kernel scheduler (Kernel scheduler) with a PID of 0 to obtain the CPU time.
The kernel scheduler is responsible for allocating system time and switching between processes.
Init reads the configuration file/etc/inittab
Linux running level,
0-halt: Shutdown
1-single user mode, no graphic interface
[Repair mode, similar to Windows security mode]
2-multi-user mode, but there is no graphical interface. 2 and 3 are the most widely used Linux servers.
3-like 2, NFS is added
4-unused, but can be customized by the user
5-default running level: x11 indicates a graphical multi-user environment.
6-Restart
Run-level switch:
1. view the current runlevel
N indicates that the running level has not been switched.
S indicates the running level before switching
Number indicates the current running level
2. Switch the running level
Init [0123456Ss]
Or telinit [0123456Ss]
Appendix-synchronous software and hardware clock: [the two time periods should be consistent]
Hwclock display hardware clock
Hwclock -- help: Describes the synchronization clock options in detail.
Change Time:
-S | -- hctosys set the system time from the hardware clock
-W | -- systohc set the hardware clock to the current system time
-- Set the rtc to the time given with -- date
E. g.
Date MMDDhhmm
Hwclock -- set -- date = "9/23/14 16:31:05"
Linux boot program Problems
In linux, I remember that it seems to require a dedicated disk format, which is different from the disk format in windows. In windows, the disk format is FAT or NTSF. If you want to use linux, you can install a virtual machine in windows,
In this way, windows can also be used normally, and linux won't be delayed. I feel better when I first learned the computer.
What should I do with linux boot programs?
Fix grub and place it on the linux installation disk.
Input
# Linux rescue press ENTER
# Chroot/mnt/sysimage press ENTER
# Grub-install/dev/hda press ENTER
# Reboot press ENTER restart takes effect