Originally Published: Tuesday, 4 September 2001 Author: Siddharth Khosla
Published to: learn_articles_firststep/General Page: 2/2 - [Printable]

The Linux Boot Process on the i386

Take another look at exactly what happens to your system during the boot process. Understanding the boot process is critical to understanding good useage and administration practices.

INIT  << Page 2 of 2  

INIT

The grandparent of all processes, init, can be said to be the root of the tree of processes which are run during Linux booting. Init runs a number of files during boot up. Some of the files it runs and their utility are given below :

/etc/rc.d/rc.sysinit

This is the first file that init runs. It is responsible for system initialization processes like setting paths, swapping memory, checking file systems. It also starts up getty processes like those required to log in , ftp daemons, httpdaemons, mail daemons, NFS etc. The init configuration files are found in the /etc/rc.d directory and the files there include :



1.init.d
2.rc0.d
3.rc1.d
4.rc2.d
5.rc3.d
6.rc4.d
7.rc5.d
8.rc6.d

The init.d directory contains the scripts to run at various runlevels. The rc.d directories contain the configurations for various runlevels. The implementation of rc.serial may also take place here if there is a need of a serial port. After the successful implementation of these files the /etc/inittab is implemented.

/etc/inittab

This file describes the way the system should be setup at different runlevels. It also specifies the default runlevels. The question that may come to your mind now might be,"what the heck is a runlevel?"

Linux has in all six runlevels which are various kinds of modes the OS works in. Each runlevel has a different kind of mode which ends its booting sequence depending upon the preference of the user. The various runlevels are given below and would clear any doubt you have about them:


Runlevel Mode
0 Halt
1 Single User
2 Multi User w/o Networking
3 Full multi user mode
4 Free / not used
5 Full multi user (X Based GUI)
6 Reboot

The etc/inittab file has a line towards the top that looks something like:

id::initdefault here is the default runlevel

Changing Runlevels

Whenever runlevel changes the etc/rc.d/rc starts and stops the services for the particular set of runlevels. The same file also sets the source function library which tells the kernel how to start /Kill for various processes.

The etc/rc.d/rc also starts the default system processes and checks for the default rc directory for that particular runlevel. This can be ascertained by the numbers on the directories in etc/rc.d etc/rc.d/rc<n>.d where <n> is the runlevel.

There are a number of scripts that are started at different runlevels. You can have a list of these scripts if you check out the contents of the corresponding rc.d directory for that runlevel. the contents of this directory are not files but links to the required scripts in the /etc/rc.d/init.d directory. When these scripts are run the boot process is almost complete. As soon as the runlevel scripts are run the /etc/inittab starts the getty process which then shows the virtual console or the login prompt.

References

Http://www.redhat.com Red Hat Linux Unleashed - Techmedia The official Red Hat reference guide.

This file may be mirrored along with the site by obtaining permission from the author. The electronic version of the paper is available free; you can print and distribute it without making any changes and as long as this page is included.

Corrections would greatly appreciated; please send them to sid@sidkhosla.com/ob_stinatesid@hotmail.com Siddharth Khosla B. Tech (CSE) Punjabi University Patiala India. http://www.sidkhosla.com/papersഊ

Dedicated to: My Family and Friends.ഊ





INIT  << Page 2 of 2