1.BIOS (Basic Input Out System)
The first step of the BIOS is the
power-on self test (POST).
The second step is to locate boot
device which is both active and bootable .
If all goes well, the BIOS reads the
MBR of the boot device(HDD) and loads the program into memory.
2. MBR (Master Boot Record)
The MBR is 512 bytes of the boot
device.
446 bytes contain Boot loader (GRUB for
Linux).
64 bytes contains partition table,
2 bytes for error check.
3. GRUB (GRand Unified Bootloader)
The
purpose of a bootloader is to load the operating system.
GRUB
works in stages called Stage1, and Stage 2.
- The stage1 code of GRUB is written within the 512 bytes of the MBR.Its sole job is to locate the second stage boot loader .
- This stage presents users with a Graphical screen showing different OS.
- From this screen user can select which OS to boot,if no selection made the boot loader loads the default OS
The
configuration file for the above screen is written in the
/boot/grub/grub.conf
Once
user has determined which kernel to boot.It locates the
corresponding kernel binary in the
/boot/
directory ie: /boot/vmlinuz-<kernel-version>
Then
the bootloader load
initramfs
images into memory.The
initramfs
is used by the kernel to load drivers and modules necessary to boot
the system.
Once
the kernel and the
initramfs
image(s) are loaded into memory, the boot loader hands control of the
boot process to the kernel.
4. Kernel
Kernel image is not an executable file, but a compressed image. Typically this is a bzImage or zImage.During the boot of the kernel, the initial-RAM disk (
initrd
)
also loads into memory.This initrd
serves as a temporary root file system in RAM and allows the kernel
to access disks and the file systems on those disks.Then the kernel initializes and configures the computer's memory and configures the various hardware attached to the system, including all processors, I/O subsystems, and storage devices .
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.
The
kernel then creates a root device, mounts the root partition
read-only, and frees any unused memory. At this point, the kernel is
loaded into memory and operational.
kernel
starts the first user-space application which is in /sbin/init
5. INIT - initialization
rc.sysinit
reads the /etc/sysconfig/clock
,/etc/rc.serial
file. 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.init
command then runs the /etc/inittab
script .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.SysV runlevels define how the system is started and what services are available in the running system.
Run Level 0 Halt Run Level 1 Single user mode Run Level 2 Multiuser but without NFS Run Level 3 Full multiuser mode (text mode login) Run Level 4 unused / User-definable Run Level 5 X11 (graphical login ) Run Level 6 reboot
/etc/inittab
in the line initdefault
As per default runlevel settings, system will reads and execute the programs from
following directories.
- Run Level 0 – /etc/rc.d/rc0.d/
- Run Level 1 – /etc/rc.d/rc1.d/
- Run Level 2 – /etc/rc.d/rc2.d/
- Run Level 3 – /etc/rc.d/rc3.d/
- Run Level 4 – /etc/rc.d/rc4.d/
- Run Level 5 – /etc/rc.d/rc5.d/
- Run Level 6 – /etc/rc.d/rc6.d/
Then
/etc/inittab
script forks an /sbin/mingetty
process for each virtual console (login prompt) allocated to the
runlevel.
Runlevel
2 through 5 have all six virtual consoles
Runlevel 1 (single user mode) has one,
Runlevels 0 and 6 have none.
Runlevel 1 (single user mode) has one,
Runlevels 0 and 6 have none.
This
prints the login prompt, accepts the user's username and password,
and initiates the login process.
No comments:
Post a Comment