Tuesday, June 14, 2011

Boot Process Linux Sort

In sort boot process of linux OS ....

power on --> BIOS load into RAM --> BIOS moto is to load OS --> for that he perform POST inventry and calls CMOS to know boot order

---> after getting boot order BIOS load it whatever it finds in first sector of hdd into RAM this is what we called MBR

M ----------------------------- B ----------------------------------- R
<----------------------------- 512 bytes --------------------------->
+--------------BS------------+ +--------PT--------+ +----MN----+
                    446                              64                      2          
M ------------------------------ B ----------------------------------- R

--> Exaine PT of MBR to know where is active partition (AP) -> Then BIOS load whatever it finds on BS of AP
--> BIOS then load 1SBL(1st satge boot loader) which were put there by anocanda during install time.
--> 1SBL gives CHS # of the /boot/boot.map to BIOS to load 2SBL(2st satge boot loader)
--> 2SBL examine the binary format of grub.conf and follows all instructions given there.
--> with the help of BIOS 2SBL loads Linux kernel vmlinuz-2.4.20-8 into the RAM
--> 2SBL uncompress kernal vmlinuz and filled it into ram waht we see in /proc dirr...
--> Now Linux Kernel is into RAM which is much powerfull than 2SBL and takes total control from it.
--> With the help of BIOS Kernal uncompresses the /boot/initrd-2.4.20-8.img to find filesystem driver.
-> Now HDd driver available and Kernel is into RAM
-> Now Kernel Load /sbin/init  program into RAM.
-> /sbin/init* examines /etc/inittab  and
                        1> run level (0-6 what ever is is defined) and run an script name
                        2> /etc/rc.d/rc.sysinit in a subshell of inittab shell
                        which calls /etc/sysconfig/network to load networking
                        and start various functions defined in /etc/init.d/functions
                        and Mounts all local filesystems from /etc/fstab and updates /etc/mtab
                        and now function of ec.sysinit ends
                        Short summary of what rc.sysinit does
                             ===================================== in sort waht done by rc.sysinit
                             hostname
                             system logs
                              date and time
                             keyboard
                             system font
                             swap partitions
                             usb
                             file system checks
                             mount the filesystems read/write
                        =====================================

                        3> /etc/rc.d/rc      { as a subshell }
                           /etc/rc.d/rc3.d/K*
                           /etc/rc.d/rc3.d/S* -->   start & stop of services
                           /etc/rc.d/rc.local  -->

--> shell inittab is active and by defaults there are 6 mingettys out of which all entered into sleep state     
--- except 1
---> this mingetty then executes the /bin/login process and is then it put into sleep state by init
---> and we get promped for username & password
--> * /bin/login execs /usr/bin/passwd which challenges for passwd from
    us which then does authentication and authorization using PAM
---> after Right username and password
---> mingetty then goes into zombie state and is killed by init
---> defined shell loads and we get our shell based command prompt:#$