Before the Linux operating system is started, the first is hardware power-on, bios, and then the main boot loader.
We start from power-on until the INIT process.
Start Part 1: power-on from the system to enter the Linux operating system.
Part 2: Initialize the Linux operating system to start the INIT process.
Part 1:
1. After the system is powered on, the command is obtained from 0 xFFFF and fff0. In 0 xFFFF, The fff0 address is a jump command through which the CPU jumps to the BIOS (in ROM) to start running the BIOS program.
2. biOS programs are divided into two parts: one is mainly for self-check, which is called post (power on self test). This part is mainly for checking hardware, including graphics card, memory and system bus, the device enumeration process of PCI is completed here. For example, if you do not have a keyboard, the system will check it and prompt you.
2.1 part of it is: Read the "Boot block ". The boot sequence set through BIOS ("boot sequence" is clearly understood, that is, where to start, usually hard disk boot, boot from the CD when installing the system), from the hard disk in turn, boot block ". This boot block is 512 bytes of the first sector. Generally, the boot block is read from the hard disk and saved to ram. At this time, the CPU jumps from the BIOS to the Main Boot Loader.
3. Main Boot Loader:
The main bootstrap loader is to find and load the next bootstrap loader (Phase 2 ). This function is implemented by searching for an active partition in a partition table. When an active partition is found, it scans other partitions in the partition table to ensure that they are not active. After the verification is complete, read the Boot Record of the active partition from the device to Ram and execute it.
4. Next Boot Loader:
The next Boot Loader (the second phase of the boot loader) can be more vividly called the kernel loader. In this phase, the task is to load the Linux kernel and the optional initial RAM disk.
In an X86 PC environment, the boot loader in the first and second phases is called Linux Loader (lilo) or grand uniied bootloader (grub ).
5. Start the operating system. (Or Windows)
The first part of the startup is completed and the operating system starts to run. Note that the above process uses the real address mode.
Take hard drive as an Example
1. boot
2. the BIOS power on self test -- Post memory address is 0 FFFF: 0000
3. Read the first sector of the hard disk (0-headed 0-way [cylindrical] 1-sector, that is, Boot Sector) into the memory address 0000: 7c00.
4. Check if (Word) 0000: 7dfe is equal to 0xaa55. If not, try other startup media again.
If no other boot media exists, the system displays "no rom basic" and then crashes.
5. Jump to 0000: 7c00 and execute the program in MBR.
6. MBR first copies itself to 0000: 0600, and then continues to execute.
7. Search for active partitions in the primary partition table. If no active partition is found or more than one active partition exists, stop again.
8. Read the first sector of the active partition into the memory address 0000: 7c00.
9. Check (Word) 0000: 7dfe whether it is equal to 0xaa55. If it is not equal, "missing Operating System" is displayed and then stop, or try to start a floppy disk.
10. Jump to 0000: 7c00 and continue executing the Startup Program for the specific system.
11. Start the system...
In the above steps, steps 2, 3, and 4 are completed by the BIOS boot program. 6, 7, 8, 9, and 10 are completed by the MBR boot program.
More details:
Http://www.ibm.com/developerworks/cn/linux/l-linuxboot/