of RAM installed, the geometry of your hard drives, and the type of floppy disk
installed, are stored in the CMOS chip. The BIOS uses the data in the CMOS chip
to address these devices.
Bootloader Phase
The bootloader is software that the BIOS can load from the
MBR of the hard that will allow the CPU to access the disk and load the
operating system into RAM. The do this, the bootloader is configured with the
location of the operating system files on the hard disk drive.
After loading the bootloader software into memory, the BIOS
turns control of the ystem over to the bootloader.
With later Linux kernels, the bootloader may also create a
temporary, virtual file system in your system RAM called a ramdisk. This file
system is called initrd image.
The term “initrd” stands for initial ramdisk.
This image contains a basic file system that can be used to
complete a variety of startup taks. The reason the initrd iamge is used is
because Linux systems can use a wide variety of devices for the root (/) file
system.
Kernal Phase
After the kernel loads, several key things happen, including
the following:
- The
kernel initializes the basic hardware in your system using the various
settings in your BIOS and your CMOS chips. - The
kernel searches for and uses the initrd file system to run the linuxrc
program to set up the system. - When
linuxrc has finished executing, the initrd file system is dismounted and
the ramdisk is destroyed. - The
kernel probes for new hardware and loads the appropriate driver modules. - The
real root (/) file is mounted. - The
kernel loads the init process.
Lilo Bootloader
- Most
current Linux distributions use the GRUB bootloader instead of LILO by default.*
The bootloader configuration file for LILO is found in
/etc/lilo.conf
The following are options in the configuration file:
|
Section |
Option |
Description |
|
Global Options |
menu -scheme |
Describes the colors used in the LILO boot menu. The Text_color:highlight_color:border_color:title_color You use 2 values for each section. The first is the |
|
|
Timeout |
Sets the timeout period in 1/10th seconds |
|
|
Lba32 |
Tells lilo to ignore the hard drive’s physical geometry |
|
|
Change-rules |
Defines boot-time changes to partition type numbers. |
|
|
Reset |
Specifies that all default change-rules are removed. |
|
|
Read-only |
Specifies that the rool (/) file system be mounted |
|
|
Prompt |
Specifies that the boot: prompt be displayed. |
|
|
Default |
Specifies the default image that will be loaded if the |
|
|
Message |
Specifies the location of the image file that LILO will |
|
|
Boot |
Specifies the device that contains the boot sector. |
|
Image Options |
Image |
Specifies the path to the boot image of a Linux kernel. |
|
|
Label |
Specifies a name for the image. |
|
|
Append |
Appends the specified options to the parameters that are |
|
|
Vga |
Specifies the VGA text mode that should be used while the |
|
|
Initrd |
Specifies the initial ramdisk image to be loaded with the |
|
|
Root |
Specifies the device that should be mounted as root. |
You must type lilo in
the command prompt after making changes.
Grub Bootloader (
Grand Unified Bootloader)
Grub is separated in chunks called stages. These include the
following:
- Stage
1 – This stage of GRUB is usually stored in the MBR. Its only real job is
to point to the location of Stage 2. - Stage
2 – This stage of GRUB is stored in a disk partition. When loaded by Stage
1, Stage 2 presents a graphical menu on the screen that allows the user to
select the kernel image that should be loaded. Like LILO, you can
configure GRUB with a default image and a timeout value. If the user
doesn’t select an option within the timeout period, the system will
automatically boot the default kernel image.
Like LILO, it’s also
possible to install Stage 1 in the boot partition. In addition, there may
actually be a GRUB stage 1.5 on some deployments. Stage 1 can either load Stage
2 directly, or it may point to stage 1.5, which resides in the first 30kb after
the MBR of the hard disk. Stage 1.5 then loads Stage 2.
To initially install grub you would enter grub-install device. The device would
be the device whose MBR you want to install stage 1 into. Example: grub-install
/dev/had
Grub references disks differently then LILO. The following
is GRUB:
Hddrive_number,partition_number
GRUB Configuration File Option:
|
Section |
Option |
Description |
|
Global |
Color |
Specifies the colors to be used in the GRUB menu. |
|
|
Default |
Specifies the menu item that will be booted automatically |
|
|
Timeout |
Specifies the number of seconds to wait until the default |
|
|
Gfxmenu |
Specifies the location of the image file that will be used |
|
Title |
Title |
Specifies the title of the menu item in the GRUB boot |
|
|
Root |
Specifies the location of the partition that is to be |
|
|
Kernel |
Specifies the location of the Linux kernel. |
|
|
Initrd |
Specifies the initrd image that should be used by GRUB to |
Runlevels
|
Runlevel |
Description |
|
0 |
Halts the system |
|
1 |
Runs Linux in single-user mode. The command-line interface |
|
2 |
Runs Linux in multi-user mode with networking disabled. |
|
3 |
Runs Linux in multi-user mode with networking enabled. The |
|
4 |
Unused |
|
5 |
Runs Linux in multi-user mode with networking enabled. The |
|
6 |
Reboot |
The syntax for
commands within the inittab file is identifier:runlevel:action:command. The wait action specified in these commands tells the init process to
wait until the scripts for the specified runlevel have finished running before
moving on.
[ init completes the following tasks as it initializes a
BSD-type system ]
- Runs
the /etc/init.d/boot script to prepare the system. - Processes
/etc/inittab to determine the appropriate runlevel and scripts. - Runs
the scripts in the appropriate runlevel directory in /etc/init.d. - Runs
the /etc/init.d/boot.local script.
[ init completes the following taks on a V-type system ]
- Runs
the /etc/rc.d/sysinit script to prepare the system - Processes
/etc/inittab to determine the appropriate runlevel and scripts. - Runs
the scripts in the appropriate runlevel directory in /etc/rc.d/. - Runs
the /etc/rc.d/rc.local script.
Important Files in
/etc/init.d
|
File |
Init Style |
Function |
|
Rc |
BSD and System V |
This script is used to switch between runlevels while the |
|
Halt |
BSD |
This script can stop or reboot your system. It is run if |
|
Boot |
BSD |
This script is run by init when the system first starts. |
|
Boot.local |
BSD |
This script is also run by init at startup. It contains |
|
Rc.sysinit |
System V |
This script’s function is similar to the boot script on a |
|
Rc.local |
System V |
This script’s function is similar to that of the |
You can change runlevels by typing init runlevel example: init 3
If you look inside an
rcx.d directory within your distribution’s init directory, you will see two
scripts for each system process. One starts with an “S” and one starts with a
“K”. The scripts that start with S are used to start a process while the
scripts that start with “K” are used to kill a process. These are the scripts
employed when switching between runlevels on the fly as just described.
chkconfig -
updates and queries runlevel information for system services
SYNOPSIS
chkconfig
–list [name]
chkconfig –add
name
chkconfig –
chkconfig
[--level levels] name <on|off|reset>
chkconfig
[--level levels] name