loading...

Discussion on: Explain the Boot Sequence Like I'm 5

Collapse
mdabek profile image
Marek Dabek

On modern platforms this is far more complicated, since there are multiple hardware components with firmware on them. The OS booting sequence is also nowhere near it was 20 years ago.

If you want to consider the completely off, you need to unplug the power cord from your PC (and yet there is a small battery there) - this is called the G3 state. Then, when you plug the power cord again (this is G2 or S5 state) some of the HW is starting. This HW may be waiting for a specific input, like your Etherenet controller may be waiting for "magic packet", which will wake up the platform. But Ethernet controller itself may not wake up the platform, it will signal bus controller to which it is connected. The bus controller should eventually signal the correct piece of hardware, which can initiate the power up sequence, usually this is Power Management Unit/Controller. Now the platform starts its transition from S5 to S0 power state.

The BIOS itself may be pre-loaded by the external HW/FW component which will verify its digital signature. The modern BIOS architecture, UEFI, defines a pre-initializer, which takes the necessary steps to allow loading the rest of the BIOS. Then, the Driver Execution Environment is prepared, which allows to load additional hardware/software drivers. If you have any kind of drive encryption present, this may also be done in UEFI BIOS.

The OS also uses pre-loading, which initializes HW for the full OS load (e.g. re-initializes CPU, loads basic drivers for the HDD controller, etc.). The pre-loader may also check if the OS image is valid. Once the kernel is booted there may be basic services starting, non-critical drivers load etc.

It is really difficult to give an answer which covers all the possible aspects of the booting sequence. Lots of features used during boot is designed for security reasons, and are there to prevent loading malware infected OS components. Also the boot sequence is platform and OS specific.