Bootloader startup process

Source: Internet
Author: User

1. function

Embedded system of the boot loader, the system after the operation of the first stage of the program. After the initialization of the system, it copies the Linux kernel from nonvolatile memory (usually flash) into RAM and then jumps to the first instruction of the kernel to continue execution to start the Linux kernel.

2. function

The actual application of the bootloader according to the requirements of the different functions can be designed very complex, in addition to complete the basic initialization system and call the Linux kernel and other basic tasks, but also can execute a lot of user input commands, such as setting the Linux boot parameters, to the flash partition and so on In order to achieve the purpose of booting the Linux kernel, all bootloader have the following features:

(1) Initializing RAM

Because the Linux kernel typically runs in RAM, bootloader must set and initialize RAM before calling the Linux kernel to prepare for the call to the Linux kernel. The task of initializing RAM includes setting the CPU's control register parameters so that the RAM can be used properly and the RAM size is detected.

(2) Initialization of the serial port

Initializing a serial port as the debug port during execution

(3) Detection processor type

Before calling the Linux kernel, you must detect the processor type of the system and save it to a constant to provide to the Linux kernel. The Linux kernel invokes the appropriate initialization program during startup based on the processor type.

(4) Set Linux boot parameters

There are two main ways to pass the start-up parameters: the struct param_struct and the struct tag (tagged list), which are two kinds of structure transfer. Struct Param_struct is an older method of parameter passing, used more in kernels prior to version 2.4, and the Linux kernel basically takes a tag list from the 2.4 version. However, in order to maintain compatibility with previous versions, it still supports the struct param_struct parameter passing method, except that it will be converted to a tag list mode during kernel boot. The way to mark a list is to compare the new method of parameter passing, starting with Atag_core and ending with Atag_none. Add other lists as needed in the middle. The Linux kernel will initiate the initialization process according to the startup parameters.

(5) Calling the Linux kernel image

The last thing bootloader do is call the Linux kernel. Before jumping to the Linux kernel, the CPU registers must meet the following criteria: R0=0,r1= processor type, r2= tag list in RAM address.

Bootloader startup process

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.