I need to be able to explain the Linux boot process at work, so I’m going to outline it here. After the BIOS checks your hardware and lists bootable devices in the system, here’s what’s loaded:
- Boot Loader: Presents you with a list of operating systems or kernel configurations to load. (Example: Master Boot Record + GRUB)
- Kernel: The selected kernel, if compressed, decompresses itself.
start_kernel()is called, which sets up interrupts, memory management, and device drivers. Then the idle process and scheduler are started.
- Init: Establishes and operates the user environment. A series of scripts or config files are executed by systemd or upstart. User space services are started. For example, networking, a web server, and database services are started in this phase.
That’s the core of it. A few notes:
- You may not actually need a boot loader if you have a UEFI system where the Linux kernel payload can be executed directly.
- After init is complete, if you prefer to run in graphical mode, a display and login manager are started, and the session manager starts a session after you login.
- On shutdown, init is called to terminate user space services. It then makes a system call to the kernel to shut the system down.
If you want to learn more about how Linux boots, I recommend Yogesh Babar’s book Hands-on Booting, which goes into the process in depth, along with troubleshooting steps for when it fails to boot. You can also check out the Wikipedia entries linked above.