The following is a high-level overview of how a machine boots from the moment you turn on the power to the login screen being presented to you.
- BIOS is the first thing to run. It:
- Launches the POST test.
- Initialises the CPU, RAM, storage devices, peripherals.
- BIOS pulls some config data from the CMOS. The boot order is part of that config, which determines what device to boot. This is often your hard drive, but could also be a USB or other media.
- Depending on whether your partitioning scheme is MBR or GPT, BIOS will transfer execution to the boot loader code stored on disk.
- The boot loader puts the operating system’s kernel code into memory. The boot loader transfer execution to the kernel.
- If multiple operating systems are installed in separate disk partitions, the boot loader presents a menu letting the user pick which one to boot into.
- The kernel runs initialisation steps:
- Mounting the root filesystem.
- Starts user space processes.
- Starts the login greeter.
- … and so on.
(source)