Add

Friday, 18 October 2013

Customizing GRub Bootloader Options (default, title, splash image, timeout) in grub.conf

Customizing GRUB for Booting up with OWN Choice

L
et’s continue with customizing bootloader options (default, title, splash image, timeout) according to your wish!! It’s possible with little knowledge of Grub options
Ex : For changing default background you should know splash image requirements:


i)                      640x480 (Resolution) and 14 colors


Prepare a suitable image. The image must be 640x480 pixels and have a maximum of 14 colors, because the VGA mode used during boot has a resolution of 640x480 pixels with 16 colors and 2 colors are reserved for text (white and black). If you're using the Gimp graphics editor, simply ensure that your image is 640x480 pixels (the titlebar of the image window displays the image size) and then select the menu option Image>Mode>Indexed, entering 14 as the "Maximum number of colors"

 
ii)                  xpm.gz file type.  


Save the image to your /boot/grub directory with an extension of .xpm.gz


a)        Creating splash image.


# convert dark_sun.jpg -resize 640x480 -colors 14 -depth 16 -normalize -verbose dark_sun.xpm

# gzip dark_sun.xpm

# ls -als | grep dark_sun
 76 -rw-rw-r--  1 ashowry ashowry  70445 2013-09-16 16:04 dark_sun.jpg
348 -rw-rw-r--  1 ashowry ashowry 47340 2013-09-16 16:06 dark_sun.xpm.gz



Tips: Choose an image with a small number of colors to avoid excessive dithering when converting to indexed format. Grub displays text in white with a black drop-shadow, so it should be visible against any color background -- but it it's best to avoid white or really light colors for maximum readability.


Warning – Test your changes in Virtual machine, before proceed to live system, I bet you may not be using same Linux flavor (CentOS/Fedora are my Fav.) process would be same, but files may differ and you may have to take help from Google will get a loads of results.
You will have to reboot your Linux system after changing configurations. Isn’t it fun to see picture of ours/dears favorite photo, your company logo, or even a cartoon when you press power button,  



Edit your /boot/grub/grub.conf file



CHANGE THE DEFAULT ( always wondered why its Linux loading even when XP installed first in system)


#default=0 à default 3


CHANGE THE SPLASHIMAGE- splashimage entry points to our new image file. This path will be relative to the start of the /boot partition, so /boot/grub/dark_sun.xpm.gz would be written as (hdX,Y)/grub/dark_sun.xpm.gz (where X is the BIOS/Grub disk number and Y is the BIOS/Grub partition number).


Copying the newly created image to the proper location so Grub can find it:


# cp –v  ~/dark_sun.xpm.gz  /boot/grub/

# splashimage=(hd0,1)/grub/dark_sun.xpm.gz

 
We'll be changing the line that starts with "splashimage" to reflect the name of our new image:


RENAMING YOUR MENU ITEMS
After the word "title" we are free to rename this line to whatever we'd like the option to read at boot time, such as the following examples:


# title CentOS 5.2 x86_64 2.6.18-92.el5 à title CENT-OS 5.2 Release



CHANGE THE TIMEOUT (the waiting time before default=n is processed)
This value is in seconds, we can change it to however many seconds we'd like grub to countdown before booting thedefault choice in the menu.


# timeout=33  à  timeout=60



ADDING ANOTHER OPERATING SYSTEM TO THE MENU:
Typically, you'd want to install Windows or your other operating system first before installing Fedora. If you should have a "meltdown" and need to reinstall Windows or your other operating system, you may need to re-install Grub and verify these settings to make sure everything boots properly.
In this example we've added Windows XP and renamed the title above to reflect that ServicePack 3 was installed as well.


title Windows XP SP3
        rootnoverify (hd0,0)
        chainloader +1



Sample custom grub.conf will finally look like.



# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/sda3
#          initrd /initrd-version.img

#boot=/dev/sda
default=3
timeout=60
splashimage=(hd0,1)/grub/dark_sun.xpm.gz
hiddenmenu

title CentOS 5.2 x86_64 2.6.18-92.1.22.el5
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/
        initrd /initrd-2.6.18-92.1.22.el5.img

title CentOS 5.2 x86_64 2.6.18-92.el5
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/ vga=791
        initrd /initrd-2.6.18-92.el5.img

title Windows XP SP3
        rootnoverify (hd0,0)
        chainloader +1





No comments:

Post a Comment