When I am studying the system architecture, I had a small doubt about how the Boot sequence works and what are the steps involved,So I read in detail about the Boot sequence,but It varies among the systems,Usually They are divided in to the following steps
1.Hardware Boot:When we Power on the system the control goes to the Program stored in ROM(Usually PROM:Programmable Read only Memory) which is BIOS in PC'S, It does self-test of Machine and access Non-volatile Memory to read further. This Memory is Battery Backed CMOS Memory and also called NVRAM(Non Volatile Random Access Memory). The parameters stored in NVRAM vary between systems. The Boot Programe Know what is boot device (or) How to probe boot devices, Now the control Accesses boot device and loads OS loader which is at fixed position on boot device and control transfers to it.[Booting from Network is Different].
2.OS Loader: This is in the first sector of Boot device(known as MBR:Master Boot Record), In Most systems(Even on Non -PC's), There is some limitations to size and complexity of this loader. The PC MBR(512 Bytes) size makes it impossible to sqeeze a full OS Loader in it. So most OS's make primary loader call and from it calls secondary OS loader which is in disk partition.
In Linux: OS loader is normally lilo or grub, Both of them may be secondary loaders(DOS as primary(MBR)) or as two part loader where they provide special MBR containing bootstrap code to load second part of loader from Root system. Most of the Os loaders allow interactive use to enable specification of alternative kernel and to pass optional parameters to the kernel. From the core the main job of OS loader is to locate kernel on the disk ->load it-->Run it.
3.Kernel Startup: When the kernel is loaded --> Initialises the devices(via drivers)--> starts swapper-->Mounts root file system[/] which is the kernel process.
Only then the kernel creates the first (user land) process[numbered 1]. This process executes program /sbin/init, passing any parameters that werent handeled by kernel already.
4.Init and Inittab:When Init starts It reads /etc/inittab for further instructions.This file defines what should be run in different run levels.Admin can change the current runlevel via init and query the current runlevel.Inittab only bootstraps set of scripts that actually start/stop individual services.
5.Boot scripts:For major linux distributions and HPUX,SOLARIS e.t.c the each managed services(NFS,mail,cron e.t.c) the startup script is located in /etc/init.d directory. Each of theese scripts accepts single argument with
'start'--causing to start the service
'stop'--causing to stop the service
optional--'restart','status'.
-->What are sequencing directories and why do we need them?
To make specific scripts start/stop at specific runlevels and in specific order.There are sequencing directories in /etc/rc[0-6s].d, In each of theese directories there are links to the scripts in the init.d directory.
A primary script (usually /etc/rc) is called from inittab and calls service scripts via the links in the sequencing directories, All links with names that begin with 's'->start, 'k'->stop argument, and each have the order number to start or stop in the same runlevel.[Ex:link /etc/rc2.d/s80sendmail starts send mail service on runlevel2 this happens after rc2.d/s12syslog and before rc2.d/s90 xfs]
Boot Configuration:To change the parameters without editing bootscripts we can edit configuration files located in /etc/sysconfig
source:--If u are using linux type man boot in bash
No comments:
Post a Comment