April 22, 2019

How Linux Boots


  • May 29, 1999
  • By James Andrews
When you turn on your computer, it will take a few seconds or even a few minutes to begin normal operations. The operating system loads up dozens of programs to check and setup before the user takes control. We will look at how this works under Linux, below.
The Boot Loader
The first event after the bios has checked the hardware in a basic way, is the first real program loaded off the hard disk. If you are booting a linux based system, this is usually a boot loader like grub or lilo. We will just look at lilo in this article.
The Kernel and Kernel Devices
In the normal course of events, lilo just loads the kernel. The kernel is, in a real sense, linux itself. It provides all the core services to the rest of the system and it is always running. Next some speed tests are performed on the machine and the kernel starts to load up device drivers. A device driver in Linux is the way that the user interacts with any kind of hardware. An example is the Ethernet card driver, that lets Linux talk to your Ethernet hardware. There are usually device drivers available for all hardware. There are two main exceptions. First, new revisions of some cards or board use different chipsets than old ones. The new software to control them has still to be written and tested by the Linux community. Secondly, there can be problems with device drivers when the manufacturers refuse to release details about how their hardware works. In the normal course of events, the kernel will detect the hardware and load all appropriate device drivers.
inittab and Running Services at Startup
The Apple fans reading this are probably thinking, "Device drivers are like the stuff in the Systems Extension Folder, so next is something like running the System Startup programs"--but Linux is a little more complex. There are, in effect, a series of startup folders. The basic idea is that the most basic services are set up first, and then more complex ones follow. For instance, consider Internet services. First the Ethernet is configured with the machine's address via the driver that was loaded earlier. Following this, the rest of the basic setup occurs. For an Ethernet card, this will include setting the IP address via the ifconfig command. At the next stage of system startup, a WWW server that uses the Internet address set up in the previous stage will run. With complex software, the order is important. Linux makes it clear what system features are loaded first, making it easier for the Linux professional to solve system problems.
Tools for Configuring inittab
There is a master control file for the order in which the different system startup folders are executed. This is called /etc/inittab. We use tools like chkconfig for seeing what services are enabled at which level in the inittab file. You can simply look at it with an ordinary editor.

If you are running a window manager, there is a special run level for starting X windows, used to run all the necessary support programs . Window managers have system-wide and per-user startup scripts that can be customized.

Most Popular LinuxPlanet Stories