Booting Process (WIP)
COPYRIGHT NOTICE: text and code copied or derived from git commit message, mailinglist, or codebase are subject to the linux kernel licensing rules
§ after the bootloader (grub)
kernel entry point
calll main
|
|
go to 32 bit
void go_to_protected_mode(void)
{
/* Hook before leaving real mode, also disables interrupts */
realmode_switch_hook();
/* Enable the A20 gate */
if (enable_a20()) {
puts("A20 gate not responding, unable to boot...\n");
die();
}
/* Reset coprocessor (IGNNE#) */
reset_coprocessor();
/* Mask all interrupts in the PIC */
mask_all_interrupts();
/* Actual transition to protected mode... */
setup_idt();
setup_gdt();
protected_mode_jump(boot_params.hdr.code32_start,
(u32)&boot_params + (ds() << 4));
}
32 bit code entry point
https://elixir.bootlin.com/linux/v6.6.67/source/arch/x86/boot/header.S#L275
code32_start: # here loaders can put a different
# start address for 32-bit code.
.long 0x100000 # 0x100000 = default for big kernel
§ readings
- All Stages of Linux Booting Process Explained, nu11secur1ty,
https://github.com/nu11secur1ty/All-Stages-of-Linux-Booting-Process-Architecture - Kernel booting process, 0xAX
https://github.com/0xAX/linux-insides/blob/master/Booting/linux-bootstrap-1.md - the linux/x86 boot protocol, https://www.kernel.org/doc/Documentation/x86/boot.txt