Need basics of booting process

Rigved Rakshit r.phate at gmail.com
Mon Jul 11 03:28:41 EDT 2011


>
> I want to know the basics linux booting process. I googled for this but i
> didn't find the detailed things anywhere. I want to know the boot process
> including the hardware work flow. Can anyone give me the detailed tutorial
> to learn about this.
>
>  First, when you power up the system the bios goes through a POST, which is
> power-on self test. This just checks that hardware is working, etc. Then it
> looks for a boot sektor, which must be 512 bytes long and end with a magic
> number, and loads the kernel. From there, you can look at the head.s
> assembly, and I think someone posted a tutorial here a while back--maybe
> they'll post that again.
>


   1. The POST (Power-On-Self-Test) is done. POST checks all the processors
   that are connected, the amount of RAM available, disks that are connected,
   network cards available etc.
   2. Then the BIOS (Basic Input/Output Services) program is loaded. The
   BIOS searches for IDE, SCSI, PATA drives. Then it searches for active
   (bootable) partition(s). Using this knowledge, it checks the information in
   the Master Boot Record (MBR) of the drive (that has the active
   partition(s)). Then, it loads the bootloader (mostly GRUB - Grand Unified
   Bootloader) from the MBR.
   3. Grub knows how to read all kinds of partitions. So, it can boot from
   any file system.
      1. It checks and loads the settings in /boot/grub/grub.conf. This file
      contains path for root = (hd0,0), kernel = vmlinuz, initrd = initrd.img
      (cpio archive).
      2. The Linux kernel is loaded into the RAM. It knows how to unpack the
      cpio archive which was specified by initrd parameter in grub.conf. The
      kernel loads this unpacked initial RAM disk and root file system (also
      called initramfs) into the RAM. Then it starts executing the
/etc/init file
      present in this initramfs.
         1. initrd: It contains the initial RAM disk and the initial root
         file system. These are loaded into the RAM before the actual root file
         system from the hard disk is loaded.
         2. ntldr: In case another bootloader is required to be loaded, then
         the 'chainloader+1' command tells grub to load the bootloader
mentioned.
         ntldr is the Windows bootloader. In Windows, all drives are loaded in
         user-space.
         4. init starts populating /dev with the devices that are connected.
   init inserts kernel modules (.ko files) to detect the connected hardware.
      1. init loads the hard disk. Then, init "switches root" to the root
      file system in the hard disk. Finally, before terminating, this
init file of
      the initramfs passes control to the init file in the hard disk.
      2. init loads the partitions which are mentioned in /etc/fstab.
      3. Then, all the files up to and including the required "init level"
      are executed.
         1. These include rc.sysinit, rc.local (directory) and rcX.d
         (directory - where X refers to a whole number).
         2. If you check the /etc/rc0.d directory, you will find symlinks
         starting with either a 'K' or a 'S'. This is followed by a
number. This
         convention is followed purposely. All symlinks with a
starting K are 'kill'
         commands. All symlinks with a starting S are start commands. All the
         symlinks are followed in lexicographic order. So, all the
kill commands are
         executed first (K00*, K01* etc.), followed by the start
commands (S00*, S01*
         etc.).
         3. So, if you want to boot to init level 1, then all the commands
         in /etc/rc1.d directory are executed. If you want a Graphical
Environment
         (i.e., init level 5), then all commands from rc1.d up to
rc5.d are executed.
         4. init level 0 is for shutdown and init level 6 is for restart (i
         think; not sure about init level 6).

This is a brief introduction to the boot process. Modern OSs require much
more than these basic things. Also, this boot process refers to the SysVInit
model. Then is another model used by Upstart, which Ubuntu uses. Watch this
video to learn more about Upstart:
http://www.youtube.com/watch?v=ssnZBQqnze8

Hope this helps!

Rigved Rakshit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110711/13c26b8d/attachment-0001.html 


More information about the Kernelnewbies mailing list