Linux0.11 only supports the X86 architecture. Its kernel boot launcher is in the folder BOOT, there are three assembly code files. According to the startup process, it is:
(1) Bootsect.s. Boot is the meaning of boot boot, SECT, Sector, is the meaning of the sector, and the two will start the guiding sector together. this is
Disk bootstrap.
(2) Setup.s
(3) HEAD.S
The first two assembler uses the compilation language syntax of approximate Intel, the third use
GNU's AT & T syntax. The corresponding compiler must be compiled.
After the system is powered on, the Intel's CPU automatically enters the real mode, CS: IP = ffff: 0000, that is, the CPU always performs the code at 0xFFFF0 at the time of power-on or reset. This address is the address in the ROM-BIOS by default. In the embedded system, it is stored in the first-class bootloader execution code. The operation it complete is to perform system self-test, starting to initialize the interrupt vector table at the physical address 0x00000. Finally, the first sector (0 track, 0 head, guiding sector) of the startup disk is loaded at the physical address 0x07C00, and the code is jumped here to start the code. The role of this code is to move yourself to the physical address 0x90000, because the code of the first sector has a total of 512KB = 0x0200, so the replication of the past is 0x90000-0x901FF. Then, read the 2k-sector of the second sector in the startup device to the physical address 0x90200, the other parts of the kernel (SYSTEM module) are read into the physical address 0x10000 Place. Because the length of the SYSTEM module does not exceed the 0x80000 byte size, the bootsect and setup modules starting at 0x90000 are not overwritten. After the load is completed, the control is turned to setup.s.
Setup.s first sets some hardware devices, then move the kernel file from 0x10000 to 0x00000. The system is transferred to the protection mode, performs the code at 0x00000. The head of the kernel file is the code written in assembly language, namely Head.s.
Head.s will put the IDT (Interrupt Vector Table), GDT (Global Segment Descript Table), the first address of the LDT (partial segment descriptor table) into the corresponding register, initialize the processor and coprocessor, set up Page, finally call the main () program in init / main.c.
This process is consistent with the functionality to complete with the BootLoader in the embedded system. When transplanting U-boot on the AT91RM9200, there are three files toad.bin, boot.bin, u-boot.bin. They are in common to jump from the power-up start position (hardware setting) to the first-class bootloader of the ROM, after processing, jump to the second-level Bootloader. Complete the boot, you can start the kernel and mount the file system. The following work is to analyze the work completed by three assemblers and have a further understanding of the entire startup process. I will also study the BootLoader section of the AT91RM9200 in the future, and strive to write a relatively simple bootloader.