Windows Boot process

What is involved in Windows Boot Process:

Windows_Booting_Procedure

  • Power is turned on.
  • The first process starting when you turn on your computer is BIOS i.e, Basic Input Output System. BIOS has two functions, to conduct POST and read MBR.
    1. POST – POST stands for Power On Self Test. POST checks all the hardware devices connected to a computer like RAM, hard disk etc and make sure that the system can run smoothly with those hardware devices. If the POST is a failure the system halts with a beep sound.
    2. Now BIOS checks the boot priority. We can set the boot priority as CD drive, hard disk or floppy drive
    3. MBR – The next duty of BIOS is to read the MBR. MBR stands for Master Boot Record and its the first sector on a hard disk. MBR
      contains the partition table and boot loader.
  • Functions of Boot loader
    Now BIOS has passed the control to boot loader and boot loader is a small program which loads kernel to computers memory. Actually there are two stages of boot loaders, stage 1 boot loader and stage 2 boot loader. MBR contains the stage 1 boot loader and stage 1 boot loader is a link to the stage 2 boot loader. The stage 2 boot loader resides in the boot partition and it loads the kernel to memory.
  • Boot files and functions
    There are three boot files in a Windows operating system and they are NTLDR, NTDETECT.COM and Boot.ini. The boot files are found in the active partition of hard disk and its normally C drive in a Windows machine.

    1. NTLDR – NTLDR stands for NT Loader and its the second stage bootloader. The path of NTLDR is C:\Windows\i386\NTLDR.
    2. Boot.ini – Boot.ini contains the configuration files of NTLDR. When the operating system is loaded we cannot pass any arguments to kernel, so those arguments are passed through boot.ini. You can edit boot.ini by opening through notepad. The path of Boot.ini is C:\boot.ini.

    3. NTDETECT.COM – This file detect hardware’s and passes information to NTLDR. Using the collected information the NTLDR creates a hardware key and this key is used to detect hardware’s. A new hardware key is generated after each reboot of the operating system and that’s why system asks to reboot after installation of a new hardware. The hardware keys created by NTLDR can be found in Windows registry at
      HKEY_LOCAL_MACHINE -> HARDWARES.

  • Kernel and its functions
    After executing the functions of boot files the control is passed to Kernel. ntoskrnal.exe is the kernel file in a Windows machine and its path is C:\Windows\system 32\ntoskrnal.exe. Kernel acts as a layer between software and hardware. The library file hal.dll (C;\Windows\system32\hal.dll) helps Kernel to interact with hardware’s. HAL stands for Hardware Abstraction Layer and this hal.dll file is
    machine specific. Now the drivers for hardware’s are loaded from the file C:\Windows\system32\config\system and the Kernel is loaded to primary memory.
  • Services and log in procedure
    When kernel is loaded in the primary memory services for each process is started and the registry entry for those services can be found at HKEY_LOCAL_MACHINE – System – Current control set – Services.
    Winlogon.exe (C:\Windows\system32\winlogon.exe) is the last service started during this process.
    Winlogon.exe starts the log in procedures of windows machine. It first calls the library file msgina.dll (C:\Windows\system32\msgina.dll). MSGINA stands for Microsoft Graphics Identification and Authentication and it provides the log in window. Now msginal.dll passes the control to LSA (Local Security Authority), it verifies the username and password from the SAM file. SAM (Security Accounts Manager) contains the information about all users created in a Windows operating system.
    Now the booting procedure is over and we have reached the desktop of Windows operating system.

Source:

  1. https://kb.acronis.com/sites/default/files/content/2006/01/1934/windows_booting_procedure.pdf
  2. http://www.slideshare.net/dominiquec/understanding-the-boot-process

Linux Boot process

Let’s describe Linux Boot Process:

BIOS Basic INPUT/OUTPUT System.
Executes MBR
MBR Master Boot Record
Executes GRUB
GRUB Grand Unified Bootloader
Executes kernel
KERNEL Kernel
Executes /sbin/init
INIT Init
Executes Run level programs
Run Level Run Level Programs are executed from /etc/rc.d/rc*.d/
  • As power comes up the BIOS is given control
  • BIOS runs self tests, usually including cursory memory tests.
  • The BIOS then loads the first sector of the disk to be used for booting and transfers control to it.
  • The MBR code varies. One version will chain to the code in the first sector of the boot partition (Windows), another will load a bootloader. Windows boot proceeds from code and information in the boot partition.
  • The bootloader chooses kernel location and version
  • The bootloader prepares kernel and initrd image in memory, transfers control to kernel
  • Loading kernel modules
  • Discovering hardware and load additional kernel modules to support it
  • Looking for disks
  • R/O mount of / partition so that it can potentially be checked and repaired
  • init process spawn
  • /etc/inittab read and executing
  • Mounting all FSes from /etc/fstab
  • runlevels running (based on default runlevel in /etc/inittab) or another init method such as systemd or upstart
  • rc.local
  • login prompt

Source:

  1. http://unix.stackexchange.com/questions/27034/discribe-in-details-tha-boot-process-of-any-linux-system
  2. http://www.thegeekstuff.com/2011/02/linux-boot-process/
  3. Watch video here
  4. http://www.slideshare.net/dominiquec/understanding-the-boot-process