Finally began to read the core of the kernel Guide (core guidance)

Source: Internet
Author: User

Start reading the 2.6.17-1.

Contrast this 0.95 look, changed a lot, the light start part of the poor n far.

To protect the mode, some deep understanding, previously did not understand, why use OD when so many news, those cattle people are how to know.

It turns out that the bottom of each system boot is so simple = The following is the detailed process after Linux startup:

Part I: Core guidance (core guidance)

You can start booting your Linux system with a boot program such as Lilo or grub, and when the bootstrapper completes the boot task, Linux takes control of the CPU from them, and then the CPU starts to execute the core image code of Linux and starts the Linux boot process. Here are a few assembler programs to boot Linux, this step into the Linux source tree in the "Arch/i386/boot" under the several files: Bootsect. S, Setup. S, video. S and so on.

Which bootsect. S is the assembly source that generates the boot sector and jumps directly to setup after it completes the loading action. The program entrance of S. Setup. The main function of S is to copy the system parameters (including memory, disk, etc. from the BIOS) to special memory so that these parameters can be read by code in protected mode later. In addition, Setup. s also includes code in the VIDEO.S to detect and set the display and display modes. Finally, Setup. s converts the system to protection mode and jumps to 0x100000.

So 0x100000 what code is stored in this memory address. And where does this code come from?
0x100000 This memory address is the extracted kernel, because Red Hat provides the kernel contains a number of drivers and features and appears to be relatively large, so in the kernel compiled using the "Makebzimage" way to generate a compressed kernel, the kernel is often named Vmlinuz, In the initial boot process of Linux, it is through the head in "arch/i386/boot/compressed/". S uses the Decompress_kernel () function defined in MISC.C to extract the kernel vmlinuz to 0x100000.

When the CPU jumps to 0x100000, the Arch/i386/kernel/head is executed. S "In the startup_32, it is also the entrance of Vmlinux, and then jump to Start_kernel (). Start_kernel () is the function defined in "INIT/MAIN.C", and a series of initialization functions are called in Start_kernel () to complete the setting of the kernel itself. In the Start_kernel () function, a lot of work is done to build the basic Linux core environment. If Start_kernel () is successfully executed, the basic Linux core environment is already in place.

At the end of Start_kernel (), by calling the Init () function, the system creates the first core thread and initiates the init process. The core thread init () is primarily to perform some peripheral initialization work, including calling Do_basic_setup () to complete the loading and initialization of peripherals and their drivers. and completes the file system initialization and the root file system installation.

When the Do_basic_setup () function returns init (), Init () opens the/dev/console device again, redirecting three standard input and output files stdin, stdout and stderr to the console, and finally, Searches the init program in the file system (or the program specified by the init= command-line argument) and loads the EXECUTE INIT program using the EXECVE () system call. By the end of this init () function, the boot part of the kernel is over,

Below also has the good content Oh, hehe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.