[Linux/OS Internals] The Booting Process : What happens when you start the computer ?
BIOS(Basic Input/Output System) is responsible for performing initial system integrity checks when it boots up. Steps involved are as below -
- The BIOS initializes the hardware/plugin-play devices and does system inventory device detection with a a Power-on self test (POST). It loads OS’s Master Boot Record (MBR)
- MBR is the first sector from a HDD/USB; Any code can be put into MBR!
- Loads 512 bytes from MBR into memory
- BIOS runs the OS Boot Loader , which it got from MBR and it executes the first instruction from MBR.
- OS Loader may use 2 stage loading because, 512 bytes are too small to fit even a loader itself
Stage (1): Loads the Stage (2) loader
Stage (2): Loader loads the actual OS
- Boot loaders are OS/device specific; Boot Loader loads the OS into memory and OS starts running !
- OS performs its own initialization ; Remember w.r.t Linux, init process is the first process that gets started, init starts and stops essential service process on the system.
- Initializes memory, devices, libraries, device drivers
- sets up OS libraries
- OS starts up a login shell ( GUI or non-GUI) and displays a login prompt !