Article 6 of 15
The Boot Process
Quick review of the individual components that make up the SysVinit system:
- A runlevel describes the overall operating state.
- A service is a function provided by the system.
- A program provides that service.
- An init script contains instructions for managing the program.
- A runlevel’s configuration identifies which init scripts should be used.
Let’s explore how those fit within the overall boot process.
From Power On to the Kernel
When a BcalcOS computer is powered on, the computer’s firmware gets things started.
Depending on the computer, this will be either BIOS or UEFI. The firmware performs some initial hardware setup and looks for something it can boot.
The firmware then starts the bootloader.
BcalcOS uses GRUB as its bootloader. GRUB presents the boot menu and loads the Linux kernel.
The kernel then takes over and begins initializing the operating system.
We have now reached the point where SysVinit’s orchestration work begins.
SysVinit Starts
Once the kernel has initialized the basic parts of the system needed to continue, it starts the first user-space process.
This process is init, and it is assigned process ID 1 (PID 1).
On BcalcOS, init is provided by SysVinit. SysVinit is now responsible for taking the system from its initial state toward the operating state BcalcOS has configured.
System Initialization
BcalcOS’s /etc/inittab tells SysVinit what to do.
Three entries are particularly useful for understanding the process:
id:2:initdefault:
si::sysinit:/etc/init.d/rcS
l2:2:wait:/etc/init.d/rc 2
The first tells SysVinit that runlevel 2 is the default operating state:
id:2:initdefault:
The second tells it to perform system initialization:
si::sysinit:/etc/init.d/rcS
The rcS initialization script performs the early initialization work needed to prepare the system for normal operation.
After that, SysVinit enters the configured runlevel:
l2:2:wait:/etc/init.d/rc 2
In simplified form:
SysVinit
↓
System initialization (rcS)
↓
Runlevel 2
Entering Runlevel 2
Once BcalcOS enters runlevel 2, SysVinit uses the runlevel’s configuration.
That configuration is found in:
/etc/rc2.d/
The entries there are symbolic links to init scripts in /etc/init.d/.
For example:
/etc/rc2.d/S03cron
↓
/etc/init.d/cron
↓
/usr/sbin/cron
The init script provides the instructions for starting the cron program, which then provides scheduled task processing.
The same basic process is used for many other services.
Services Start
As the runlevel configuration is processed, the appropriate services are started.
On a typical BcalcOS system, these include services providing things such as:
- system logging
- networking
- scheduled tasks
- printing
- graphical login
At this point, the system is becoming a usable operating environment.
The exact order in which services are started is important because some services depend on other parts of the system already being available.
The Graphical Login
Among the programs started during this process is SLiM, which provides the graphical login service used by BcalcOS. After the user logs in, the graphical desktop environment is started.
BcalcOS uses Xfce. The result is the familiar BcalcOS desktop.
The Whole Process
Here’s the complete picture at a high level:
Computer powers on
↓
BIOS / UEFI [gets the computer started]
↓
GRUB [loads the kernel]
↓
Linux kernel [starts the user-space environment]
↓
SysVinit (PID 1) [begins bringing system into its configured state]
↓
System initialization (rcS)
↓
Runlevel 2
↓
Runlevel 2 configuration [identifies the init scripts to use]
↓
Init scripts [manage the programs that provide the system's services]
↓
Services start
↓
SLiM graphical login
↓
User logs in
↓
Xfce desktop
SysVinit is One Part of the Process
SysVinit doesn’t directly perform all of these tasks itself.
It is the init system and the first user-space process but it works with many other components.
The firmware, GRUB, Linux kernel, init scripts, services, display manager, and desktop environment all have their own jobs.
SysVinit is the part that coordinates the transition from the kernel’s initial user-space environment to the configured operating state.
Key Takeaway
The BcalcOS boot process is a series of steps, with each component handing off to the next.
For the SysVinit portion, the basic path is:
SysVinit
↓
rcS
↓
Runlevel 2
↓
Init scripts
↓
Services