The Linux Boot process works as follows
Power on
BIOS (Basic Input Output System) is a software program comes pre-built in a motherboard chipset.BIOS loads and scans for devices such as Hard Disk, CD-ROM, RAM, etc.
BIOS searches for MBR (Master Boot Record: 1st sector) of the primary hard drive, it scans for 1st stage loader (In our case boot loader is (GRUB LILO) and hands over the responsibility to MBR.
Boot PROM/FLASH/BIOS is proficient of loading the MBR into RAM and executing it.
MBR (Master Boot Record)
512 bytes of space –> MBRMBR contains the information of loader of most operating system e.g UNIX, Linux and WINDOWS
MBR holds the small binary information of 1st stage of loader
MBR consist physical sector of the first disk drive (i.e 512 bytes) and it’s not part of any partition.
Placed on the prime disk drive, in the prime sector of the first cylinder of track is 0 and head is 0 (this whole path is generally booked for boot programs)
MBR involve a mini executable programs and a table specify the primary partitions.
Boot Loader
The boot loader termed from 1st stage loader and loads itself into RAM. All this go on in milliseconds.The default stage 2 boot loader is a GRUB (Grand Unified Boot Loader) or LILO (Linux Loader)
Once GRUB is loaded into RAM, then it’s search for the location of Kernel.
GRUB will scrutinize the map file to find the kernel image, that is located under (/boot) and load it.
GRUB loads the kernel (vmlinuz-version) from /boot partition
Kernel
Mounts the root file system as specified in the “root=” in grub.conf
Kernel executes the /sbin/init program
Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
initrd stands for Initial RAM Disk.
initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.
Init
Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.
Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level
If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.
Runlevel
When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.
Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.
Programs starts with S are used during startup. S for startup.
Programs starts with K are used during shutdown. K for kill.
No comments:
Post a Comment