Boot Process

From Braindump
Jump to navigation Jump to search

https://www.alanfoster.me/posts/writing-a-bootloader/

Kernel-bootmap.jpg
Error creating thumbnail: File missing

https://m2m-tele.com/blog/2021/10/24/u-boot-initialization-sequence/

u-boot-steps
Error creating thumbnail: File missing
Error creating thumbnail: File missing
Error creating thumbnail: File missing

http://www.linuxjournal.com/article/2239

https://youtu.be/3brOzLJmeek?si=i_lZ_9cVAoYZnhrX

bootprocess
start() arch/i386/boot/head.S
start_32() arch/i386/boot/compress/head.S
decompress_kernel() arch/i386/boot/compress/misc.c
startup_32() arch/i386/kernel/head.S
start_kernel() init/main.c
cpu_idle() init/main.c

https://tldp.org/LDP/LG/issue70/ghosh.html

1. Moves itself from address 0x00007c00 to address 0x00090000.
2. Using address 0x00003ff4, sets up the "Real Mode" stack.
3. Sets up the disk parameter table. This is used by BIOS to handle the hard disk device driver.
4. Displays the message "Loading Linux" by invoking a BIOS procedure.
5. Then, invokes a BIOS procedure to load the setup( ) code of the Kernel Image. It puts this into RAM starting from address 0x00090200.
6. Invokes a BIOS procedure finally. This procedure loads the rest of the Kernel image and puts the image in RAM starting from either address 0x00010000 (called "low address" for small Kernel Images compiled with "make zImage") or address 0x00100000 (called "high address" for big Kernel Images compiled with "make bzImage").
7. Then, it finally jumps to the setup( ) code.
1. First, total amount of physical RAM available to the system is detected. It invokes a BIOS procedure for detecting the RAM.
2. Sets the Keyboard repeat delay and rate.
3. The Video adapter card is detected.
4. The Disk Controller is reinitialized and hard disk parameters are determined.
5. Checks for an IBM Micro Channel bus (MCA).
6. Checks for a PS/2 pointing device (bus mouse).
7. Checks for Advanced Power Management (APM) BIOS support.
8. Now checks the position of the Kernel Image loaded in RAM. If loaded "low" in RAM (when using zImage, at physical address 0x00010000) it is moved to "high" in RAM (at physical address 0x00001000). But, if the Kernel image is a "bzImage" loaded in "high" of RAM already, then it's NOT moved anywhere.
9. Sets up the Interrupt Descriptor Table (IDT) and a Global Descriptor Table (GDT).
10. If floating point unit (fpu) is present, it's now reset at this step.
11. PIC (Programmable Interrupt Controller) is reprogrammed at this step.
12. The CPU is switched from "Real mode" to "Protected mode" by setting the PE bit in the cr0 status register.
13. Jumps to the stratup_32( ) assembly language function.
1. The paging_init( ) function is executed that initializes the Page Tables.
2. The mem_init( ) function is executed that initializes the Page Descriptors.
3. The trap_init( ) and init_IRQ( ) functions are executed that initializes the IDT for the final time.
4. The kmem_cache_init( ) and kmem_cache_sizes_init ( ) functions are executed that initializes the Slab Allocator.
5. The time_init( ) function is executed that initializes the System Date & Time.
6. The Kernel thread for process 1 is created by invoking the kernel_thread( ) function. This in turn creates the other kernel threads and executes /sbin/init program.

https://opensource.com/article/17/2/linux-boot-and-startup