1.
When a PC is booted it starts running a BIOS program which is a memory resident
program on an EEPROM integrated circuit.
BIOS –
Basic Input Output
of the System
EEPROM -
Electrically
Erasable Programmable Read-Only
Memory
2.
The BIOS program will eventually try to read the first sector on a booting
media such as a hard disk, CD-ROM or floppy drive.
3.
The boot sector contains a small program that the BIOS will load and attempt to
pass run control to.
4.
Boot sector which is also called the MBR.
Ø
a primary partition (/dev/hda1-4) marked
bootable
Ø
load and execute first 512 bytes of this
partition
MBR- Master Boot
Record
5.
This program will attempt to read the operating system from the disk and run it.
6.
GRUB is the program that Red hat Enterprise Linux systems typically use to give
users a choice of operating systems to run.
NOTE:
Two Types of Boot Loader
1. GRUB (Grand Unified Boot
Loader)
2. LILO (Linux Loader)
GRUB
a. Understands
file systems
b. Configuration file in /boot/grub/grub.conf
#cat /boot/grub/grub.conf
default=0
timeout=5
splashimage=(hd0,6)/grub/splash.xpm.gz
hiddenmenu
password --md5
$1$oQc8qUM2$rn9WTkN4AUoP1FP5LCaQR0
title Red Hat Enterprise Linux Server
(2.6.18-8.el5)
root (hd0,6)
kernel /vmlinuz-2.6.18-8.el5 ro
root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-8.el5.img
title Windows XP
rootnoverify (hd0,0)
chainloader +1
LILO
a. Does not understand file systems.
b. Configuration file in /etc/lilo.conf
7.
If the user chooses to boot Linux, GRUB will attempt to load the Linux kernel causing
the following basic events to happen:
8.
GRUB will have a timeout period for the user to press the TAB key.
9.
If the user does not press the TAB key before the timeout occurs, GRUB will run
the default operating system selected when it was installed.
10.
If the user presses the TAB key, GRUB will present the user with a choice of operating
systems or kernel to boot, based upon the title and images as set up in the /boot/grub/grub.conf file.
11.
Once the boot loader has determined which kernel to boot, it locates the corresponding
kernel binary in the /boot directory.
12.
The boot loader then places one or more appropriate initramfs images into memory.
Next, the kernel decompresses these images from memory to /boot/, a RAM-based
virtual file system, via cpio.
Note:
The initramfs
is used by the kernel to load drivers and modules necessary to
boot the system. This is particularly important if SCSI hard drives are present
or if the systems use the ext3 file
system.
13.
Once the kernel and the initramfs image(s)
are loaded into memory, the boot loader hands control of the boot process to
the kernel.
The Kernel
a. When the kernel is loaded, it immediately
initializes and configures the computer's memory and configures the various
hardware attached to the system, including processors, I/O subsystems, and
storage devices.
b. It then looks for the compressed initramfs image(s) in a
predetermined location in memory, decompresses it directly to /sysroot/, and loads all necessary
drivers.
c. Next, it initializes virtual devices
related to the file system, such as LVM or software RAID, before completing the
initramfs processes
and freeing up all the memory the disk image once occupied.
d. The kernel then creates a root device, mounts
the root partition readonly, and frees any unused memory.
NOTE:
At
this point, the kernel is loaded into memory and operational.
However,
since there are no user applications that allow meaningful input to the system,
not much can be done with the system.
14.
To set up the user environment, the kernel executes the /sbin/init program.
The /sbin/init Program
a.
The /sbin/init program
(also called init) coordinates the rest of the boot process and configures the
environment for the user.
b.
When the init command
starts, it becomes the parent or grandparent of all of the processes that start
up automatically on the system.
c.
First, it runs the /etc/rc.d/rc.sysinit
script, which sets the environment path, starts swap, checks the
file systems, and executes all other steps required for system initialization.
e.g.:
Most
systems use a clock, so rc.sysinit reads
the /etc/sysconfig/clock configuration
file to initialize the hardware clock.
d.
The init command
then runs the /etc/inittab script,
which describes how the system should be set up in a certain runlevel.
#cat /etc/inittab
NOTE:
Runlevels
are a state, or mode, defined by the services listed in the SysV /etc/rc.d/rc<x>.d/ directory, where <x> is the
number of the runlevel.
e.
Next, the init command
sets the source function library, /etc/rc.d/init.d/functions,
for the system, which configures how to start,
kill, and
determine the PID of a
program.
f.
The init program
starts all of the background processes by looking in the appropriate rc directory for the runlevel
specified as the default in /etc/inittab.
NOTE:
The
rc directories
are numbered to correspond to the runlevel they represent.
e.g.:
/etc/rc.d/rc5.d/ is the directory
for runlevel 5.
g.
When booting to runlevel <x>, the init program looks in
the /etc/rc.d/rc<x>.d/ directory to determine which processes to start
and stop.
h.
None of the scripts that actually start and stop the services
are located in the /etc/rc.d/rc<x>.d/ directory.
Rather, all of the files in /etc/rc.d/rc<x>.d/
are symbolic links pointing to scripts located in the /etc/rc.d/init.d/ directory.
NOTE:
i.
Symbolic links are used in each of the rc directories so that the
runlevels can be reconfigured by creating, modifying, and deleting the symbolic
links without affecting the actual scripts they reference.
ii.
The name of each symbolic link begins with either a K or an S. The K
links are processes that are killed
on that runlevel, while those beginning with an S are started.
iii.
The init command first stops all of the K symbolic links in the
directory by issuing the /etc/rc.d/init.d/
<command> stop command, where <command> is the process
to be killed. It then starts all of the S
symbolic links by issuing /etc/rc.d/init.d/<command> start.
iv.
Each of the symbolic links is numbered to dictate start order. The order in
which the services are started or stopped can be altered by changing this number.
The lower the number, the earlier it is started. Symbolic links with the same
number are started alphabetically.
i.
After the init command has progressed through the appropriate rc directory for the runlevel,
the /etc/inittab script
forks an /sbin/mingetty process
for each virtual console (login prompt) allocated
to the runlevel.
e.g.:
Runlevels
2 through 5 have all six virtual consoles, while runlevel 1 (single user mode)
has one, and runlevels 0 and 6 have none.
j.
The /sbin/mingetty process
opens communication pathways to tty devices,
sets their modes, prints the login prompt, accepts the user's username and password, and initiates the
login process.
k.
In runlevel 5, the /etc/inittab
runs a script called /etc/X11/prefdm.
The prefdm script executes the preferred X display manager — gdm, kdm, or xdm, depending on the contents of
the /etc/sysconfig/desktop file.
15.
Once finished, the system operates on runlevel <x> and displays a login
screen.
Running Additional Programs at Boot Time
1.
The /etc/rc.d/rc.local script
is executed by the init command at boot time or when changing runlevels. Adding
commands to the bottom of this script is an easy way to perform necessary tasks
like starting special services or initialize devices without writing complex
initialization scripts in the /etc/rc.d/init.d/
directory and creating symbolic links.
2.
The /etc/rc.serial script
is used if serial ports must be setup at boot time. This script runs setserial commands to
configure the system's serial ports.
0 comments:
Post a Comment