source1_boot
# linux kernel source code analysis 1
# boot part
the corresponding file is in the src/boot/
directory,
these are three assembly file,
bootsect.s and setup.s use 16-bit assembly syntax in real mode.
head.s uses 32-bit protected mode assembly syntax.
# pre-knowledge
# bios
what happened after power up ?
bios satrts and runs, and switches to bootseect
when the PC power is turned on, the cup under the 80-x86 architecture, automatically enters real mode, and automatically execute from 0xffff0,
this address is usually the address of rom-bios, bios will perform system decection, and initialize the interrupt vector from physical address 0,
after that, the first sector (boot sector) of the device will be started, read into the memory at 0x7c00, and jump to this place.
so enter the code of the boot part below.
# summary
in fact, what bootloader does is simply move the kernel module, set the hardware informantion and the new interrupt vector, and enter the 32-bit protection mode.
p1 the system is powered on to start the operation process:
p2 the kernel's position is memory changes when booting:
# bootsect
code move
# setup
get hardware informantion