Linux boot loader


Linux boot loader

As you my probably know the CPU processes information that is stored in RAM. This means that upon booting up the System, you will need a software that loads the kernel from the hard drive into the RAM. The software that executes this operation is called a boot loader. Linux has two boot loaders available: GRUB and LILO. Because these tools offer extra options (selecting between multiple OS, booting into single user (similar to safe mode in Windows), etc.) they are also known as boot managers. With these in mind we can say that GRUB is both a boot loader and a boot manager for Linux.

 

In Linux distributions, boot managers can be installed in one of the following locations:
  • MBR – the boot manager will be located in the first sector of the hard-drive which means that it will be executed just after the BIOS initialization. With GRUB you can also create multi-boot Systems so there is no need for extra software to boot other Operating Systems like Windows.
  • First sector of root partition – boot manager will be installed in the first section of the Linux partition. Placing boot manger in this location will make it “hidden” when booting up the system. You will either need to use a third party software to locate the Linux boot loader or set the Linux partition as active (the active partition is the one hosting the Operating System and it’s searched by default on boot)
In /boot/grub/menu.lst you will find the GRUB configuration file. Any changes made to this file will change the GRUB’s behavior upon reboot (GRUB reads the configuration file at every reboot). The conf file actually contains a set of GRUB commands which instructs the software what behavior to adopt. You can also execute these commands from the GRUB console.
I will explain some of the most common GRUB commands:
– the timeout command specifies the number of seconds that GRUB menu is displayed to the user before the default OS is booted.
– the default command configures what Operating System will boot by default.
makeactive sets a partition as active
rootnoverify(hd0,0) tells GRUB to load the OS from the specified partition (hard disk 0, partition 0) without trying to recognize the Operating System
chainloader +1 – this command is used to tell GRUB to execute the code located in the first section of the partition. This command is used when the boot loader of a OS is located in the first sector of a partition.
kernel /path_to_kernel_file root=/dev/hda0 [options] – locates the Operating System kernel on the specified partition.
initrd /boot/file – loads a file from hard drive into RAM. The file is used to boot the kernel as is also known as initial RAM disk.
We’ve covered the main aspects of the GRUB boot loader. There are many things that we can further discuss about this topic but, it’s premature to talk about them right now. When we will get acquitted with Linux we will see how to modify and configure the GRUB config file. Hope you’ve understood the basics of Linux boot manager, for any misunderstandings fell free to access my comments section. Wish you all the best and stay tuned for the following articles from IT training day.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s