Lingze's blog Lingze's blog
timeline
about
friends
categories
tags

lingze

bin不是垃圾桶的意思!
timeline
about
friends
categories
tags
  • labbb
  • linux_os
lingze
2021-01-25
目录

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: the system is powered on to start the operation process p2 the kernel's position is memory changes when booting: the kernel's position is memory changes when booting

# bootsect

code move

# setup

get hardware informantion

# head

上次更新: 6/24/2025, 5:07:55 AM
Theme by Vdoing | Copyright © 2019-2025 lingze | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式