Linux Booting Process
chandrashekarbs.1985@gmail.com
BIOS
MBR
Bootloader
Kernel
Init
Runlevel
6 Stages of Booting
BIOS(Basic Input/Output System)
Integrity checks.
Searches, loads and executes the boot loader.
Looks for boot loader in cd-rom, or hard
drive(Depending on the BIOS settings).
Once the boot loader program is detected and
loaded into the memory, BIOS gives the control to
MBR bootloader.
BIOS loads and executes the MBR boot loader.
MBR(Master Boot Record)
Located in 1st sector of the bootable disk
512 bytes in size (Bootloader info + Partition table info+ validation check).Loads and Executes
Bootloader
Bootloader (GRUB)
Grand Unified Bootloader.
Displays a splash screen.Loads kernel image specified in
grub configuration file.
Grub configuration file is /boot/grub/grub.conf sample
grub.conf of my CentOS.
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5PAE)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-194.el5PAE ro
root=LABEL=/
initrd /boot/initrd-2.6.18-194.el5PAE.img
Kernel
Decompressing the kernel image done by
<kernel_source>/arch/i386/boot/compressed/head
.S
Initialise segment values (%ds = %es = %fs =
%gs = __KERNEL_DS = 0x18).
Minimum memory management:Initialise page
tables and enable paging.
Copy kernel commandline params(2k).
Call start_kernel()
Kernel (Continued...)
Call mem_init():calculates max_mapnr, totalram_pages
and high_memory and prints out the "Memory: ..." line.
kmem_cache_sizes_init(), finish slab allocator
initialisation.Initialise data structures used by procfs.
fork_init()
Create various slab caches needed for VFS, VM, buffer
cache, etc.
If quota support is compiled into the kernel, create and
initialise a special slab cache for it.
Perform arch-specific "check for bugs"
Kernel (Continued...)
Create a kernel thread init() which execs
execute_command if supplied via "init=" boot parameter
or exec /sbin/init, /etc/init, /bin/init, /bin/sh.
Go into the idle loop, this is an idle thread with pid=0
Init
Looks at the /etc/inittab file to decide the Linux
run level.
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
Typically you would set the default run level to
either 3 or 5.
Runlevel
Depending on default init level setting, the system will
execute the programs from one of the following directories.
Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
.
.
.
Run level 6 – /etc/rc.d/rc6.d/
Under the /etc/rc.d/rc*.d/ directories, 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.
Contact details:
chandrashekarbs.1985@gmail.com
OR
http://in.linkedin.com/in/chandrashekarbs2acceleration2d

Linux boot process

  • 1.
  • 2.
  • 3.
    BIOS(Basic Input/Output System) Integritychecks. Searches, loads and executes the boot loader. Looks for boot loader in cd-rom, or hard drive(Depending on the BIOS settings). Once the boot loader program is detected and loaded into the memory, BIOS gives the control to MBR bootloader. BIOS loads and executes the MBR boot loader.
  • 4.
    MBR(Master Boot Record) Locatedin 1st sector of the bootable disk 512 bytes in size (Bootloader info + Partition table info+ validation check).Loads and Executes Bootloader
  • 5.
    Bootloader (GRUB) Grand UnifiedBootloader. Displays a splash screen.Loads kernel image specified in grub configuration file. Grub configuration file is /boot/grub/grub.conf sample grub.conf of my CentOS. #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-194.el5PAE) root (hd0,0) kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/ initrd /boot/initrd-2.6.18-194.el5PAE.img
  • 6.
    Kernel Decompressing the kernelimage done by <kernel_source>/arch/i386/boot/compressed/head .S Initialise segment values (%ds = %es = %fs = %gs = __KERNEL_DS = 0x18). Minimum memory management:Initialise page tables and enable paging. Copy kernel commandline params(2k). Call start_kernel()
  • 7.
    Kernel (Continued...) Call mem_init():calculatesmax_mapnr, totalram_pages and high_memory and prints out the "Memory: ..." line. kmem_cache_sizes_init(), finish slab allocator initialisation.Initialise data structures used by procfs. fork_init() Create various slab caches needed for VFS, VM, buffer cache, etc. If quota support is compiled into the kernel, create and initialise a special slab cache for it. Perform arch-specific "check for bugs"
  • 8.
    Kernel (Continued...) Create akernel thread init() which execs execute_command if supplied via "init=" boot parameter or exec /sbin/init, /etc/init, /bin/init, /bin/sh. Go into the idle loop, this is an idle thread with pid=0
  • 9.
    Init Looks at the/etc/inittab file to decide the Linux run level. 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 Typically you would set the default run level to either 3 or 5.
  • 10.
    Runlevel Depending on defaultinit level setting, the system will execute the programs from one of the following directories. Run level 0 – /etc/rc.d/rc0.d/ Run level 1 – /etc/rc.d/rc1.d/ . . . Run level 6 – /etc/rc.d/rc6.d/ Under the /etc/rc.d/rc*.d/ directories, 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.
  • 11.