Linux Bootloader concepts and startup Processes

Source: Internet
Author: User

Bootloader is a small program that starts to run when the system is powered on. The main function is to initialize the hardware device, prepare the software environment, and finally call the operating system kernel.

 

There are many types of Bootloader. The most common X86 systems include LILO, GRUB, and ARM architectures, such as U-boot, VIVI, and other RedBoot/Etherboot.

 

Start the Bootloader command address (the cpu in the ARM structure is generally placed at 0x0000000 address, while the CPU in the MIPS structure is generally placed at 0xBFC00000)

 

Two common operating modes of Bootloader: 1. Start loading mode (no user intervention) 2. Download mode (USER command operation)

 

Typical partition structure in Bootloader:

* The first program after the Bootloader is powered on.

* The Boot parameters partition generally stores configurable parameters, such as IP addresses and serial port baud rates, and the command line parameters to be passed to the kernel.

* Kernel: customized kernel of the embedded board, including kernel startup parameters

* The Root filesystem file system contains linux applications and related libraries.

 

@Two phases of Bootloader

1. Phase 1 (implemented in assembly language, dependent on cpu architecture initialization)

. Hardware initialization (watchdog, RAM initialization, etc)

. Prepare a RAM space for loading the second-stage code of Bootloader

. Copy the second-stage code of Bootloader to the RAM space.

. Set Stack

. Transfer to the entry point of the second-stage code

2. The second stage (usually implemented in C language, which benefits readability and portability)

. Initialize the hardware used in this phase

. Detection System memory ing (memory map)

. Read kernel image and root file system image from Flash to RAM memory

. Set startup parameters for the kernel

 

@ Bootloader: interaction with the kernel

The interaction between Bootloader and kernel is one-way, because they start successively.

The Bootloader transmits parameters to the kernel. Note: After linux2.4.x, the startup parameters are transmitted in the form of a Data Structure: Tag list.

The data structure of the tag is tag, which consists of the tag_header structure and a union. As follows:

 struct tag_header { __u32 size; __u32 tag;};
struct tag_mem32 {__u32size;__u32start;/* physical start address */};
Struct tag {struct tag_header hdr; union {struct tag_corecore; struct tag_mem32mem; // memory tag struct identifier; struct tag_ramdiskramdisk; struct identifier; /** Acorn specific */struct tag_acornacorn;/** DC21285 specific */struct tag_memclkmemclk;} u ;};

 

 

 

 

 

 

 

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.