Table of Contents
Booting a Linux system is a complex procedure. Many different components are
involved and need to interact flawlessly. This chapter provides a basic
explanation of the underlying principles and the components
involved. The concept of runlevels and SUSE's system
sysconfig are also discussed in this
The Linux boot process consists of several stages each represented by another component. The following list briefly summarizes the boot process and features all the major components involved.
After the computer has been turned on, the BIOS initializes the screen and keyboard and tests the main memory. Up to this stage, the machine does not access any mass storage media. Subsequently, the information about the current date, time, and the most important peripherals are loaded from the CMOS values (CMOS Setup). When the first hard disk and its geometry are recognized, the system control passes from the BIOS to the boot loader.
The first physical 512-byte data sector of the first hard disk is loaded into the main memory and the boot loader that resides at the beginning of this sector takes over. The commands executed by the boot loader determine the remaining part of the boot process. Therefore, the first 512 bytes on the first hard disk are referred to as the Master Boot Record (MBR). The boat loader then passes control to the actual operating system, in this case, the Linux kernel. More information about GRUB, the Linux boot loader, can be found in Chapter 8, The Boot Loader.
Kernel and initrd
To pass system control, the boot loader loads both the kernel and an initial RAM disk (initrd) into memory. The Linux kernel contains an option of having small file systems loaded to a RAM disk and running programs before the actual root file system is mounted. The kernel then decompresses the initrd and mounts it as a temporary root file system. The contents of initrd is a minimal Linux system that contains an executable called linuxrc. This executable is executed before the real root file system is mounted. If possible, the kernel frees the memory occupied by initrd and starts init after linuxrc terminates successfully. More information about initrd can be found in Section 7.1.1, “initrd”.
This program performs all actions needed to mount the proper root file system, like providing kernel functionality for the needed file system and device drivers for mass storage controllers. As soon as the actual root file system has been successfully mounted, linuxrc stops and the kernel starts the init program. More information about linuxrc is provided in Section 7.1.2, “linuxrc”.
init handles the actual booting of the system through several different levels providing different functionality. init is described in Section 7.2, “The init Program”.
initrd is a small (typically compressed) file system that the kernel can load to a RAM disk then mount as temporary root file system. It provides a minimal Linux environment that enables the execution of programs before the actual root file system is mounted. This minimal Linux environment is loaded into memory by BIOS routines and does not have specific hardware requirements other than sufficient memory. The initrd always has to provide an executable named linuxrc that needs to exit without error.
Before the actual root file system can be mounted and the actual operating system can be started, the kernel needs the corresponding drivers to access the device on which the root file system is located. These drivers may include special drivers for a certain kind of hard drives or even network drivers to access a network file system (see Managing Network Configuration). The kernel must also contain the code needed to read the file system of the initrd. The needed modules for the root file system may be loaded by linuxrc.
initrd with the script
SUSE LINUX, the modules to load are specified by the variable
After installation, this variable is automatically set to the
correct value (the installation linuxrc saves which modules were loaded).
The modules are loaded in exactly the order in which they appear in
INITRD_MODULES. This is especially
important if several
SCSI drivers are used, because otherwise the names of the hard disks would
change. Strictly speaking, it would be sufficient just to load those
drivers needed to access the root file system. However, all SCSI drivers
needed for installation are loaded by means of initrd
because later loading could be problematic.
The boot loader loads initrd in the same way as the kernel. It is not necessary to reinstall GRUB after updating the initrd, because GRUB searches the directory for the right file when booting.
The main purpose of linuxrc is to prepare the mounting of and access to the real root file system. Depending on your actual system configuration, linuxrc is responsible for the following tasks.
Depending on your hardware configuration, special drivers may be needed to access the hardware components of your computer (the most important component being your hard drive). To access the final root file system, the kernel needs to load the proper file system drivers.
If you configured your system to hold the root file system under RAID or LVM, linuxrc sets up LVM or RAID to enable access to the root file sytem later. Information about RAID can be found in Section 3.8, “Soft RAID Configuration”. Information about LVM can be found in Section 3.7, “LVM Configuration”.
If you configured your system to use a network-mounted root file system (mounted via NFS), linuxrc must make sure that the proper network drivers are loaded and that they are set up to allow access to the root file system.
When linuxrc is called during the initial boot as part of the installation process, its tasks differ from those mentioned earlier:
As you start the installation process, your machine loads an installation kernel and a special initrd with the YaST installer from the installation medium. The YaST installer, which is run in a RAM file system, needs to have information about the actual location of the installation medium to access it and install the operating system.
As mentioned in Section 7.1.1, “initrd”, the boot
process starts with a minimum set of drivers that can be used with most
hardware configurations. linuxrc starts an initial hardware scanning
process that determines the set of drivers suitable for your hardware
configuration. These values are later written to
/etc/sysconfig/kernel to enable any subsequent boot
process to use a custom initrd. During the installation process, linuxrc
loads this set of modules.
As soon as the hardware has been properly recognized and the appropriate drivers have been loaded, linuxrc starts the installation system, which contains the actual YaST installer, or the rescue system.
Finally, linuxrc starts YaST, which starts package installation and system configuration.