6 July, 2009

Setting a custom image as your Grub splash screen



Ok, if like me you find the default grub splash screen rather boring, lets face it white writing on a black background isn't exactly interesting is it? Well why now change it and have a picture load as the background instead. This took me a bit of time to get right, but here is how you do it:

Firstly you will need to find an image that you want as the background, try not to make it too intricate an image as it will have to be resized and turned into a 14 color version soon.

Once you have a chosen image you will have to resize it, you can do this one of two ways, the first is to use imagemagick which is a command line image manipulation suite, the second way is to use GIMP. If you a a more complicated image use GIMP as it does a better job, if it is simple then you can just used imagemagick.

Imagemagick - Resize and change colors:

Firstly you will have to install imagemagick, to do this type the following in the command line terminal that you have open all of the time :-)

sudo apt-get install imagemagick

now that you have installed imagemagick you need to type the following command:

convert -resize 640×480 -colors 14 YOURIMAGE.jpg splashimage.xpm

this has made an image that has being resized to 640x480 and now only contains 14 colors, this is the image and the image quality that will be displayed on the grub boot menu.

GIMP - Resize and change colors:

OK, firstly you need to open the image that you want to resize in GIMP, do this by typing the following command:

gimp YOURIMAGE.jpg

This will open up the image in gimp, with my image it looks like this:



Now that we have opened it we can create a new image, this will be the image that will be the correct size, to do this click:

FILE -> NEW

This will bring up a display like follows:



Make sure that the size of this is entered as 640 wide and 480 high.

This will create the correct size canvas, now we can copy and paste the image from the original into the new canvas and then resize the image. This is done in the usual GIMP way, if you are not sure how to do this paste the image in as you would in any other program, then find the Scale Tool in the toolbar, this will bring up a box that is fairly self explanatory. If you are still struggling then remember that Google is your friend....

Anyway, once you have resized the image align it as you want, as my image was a 16:10 ratio image I had a gap at the top and the bottoms so I just filled it is with black.

After all this is done you will end up with an image like this:



Now that you have done this the last thing to be done prior to saving the image is to make it into a 14 color image, to do this you have to go to:

Image -> Mode -> Indexed



Once you have done that you will have a menu displayed, there are 4 options, we are wanting the first option which is "Generate optimum palette", it is here that we say how many colors we want for the image, this needs to be set to 14.

Once you have done this the menu will look like so:



Once you click convert you will end up with an image that looks like this:



We will now save this as an XPM, to do this just click

File -> Save As

When asked call the image splashimage.xpm and click save.

Thats it you now have the image for the background.

----------------------

ONCE YOU HAVE THE IMAGE

Now that you have an image by one of the above methods we need to set it up so that grub knows about it, so go back to the console.

The first thing that we need to do is gzip the image we have just created, to do this type the following command:

gzip splashimage.xpm

This creates a file called splashimage.xpm.gz

Now we need to put this in the Grub folder on your computer, to do this type the following sequence of commands:

sudo mkdir /boot/grub/images

sudo cp splashimage.xpm.gz /boot/grub/images/


Now we can go to the grub folder, to do this type:

cd /boot/grub/

Now we are going to make a copy of the file menu.lst, the menu.lst file controls GRUB and we want a backup in case anything goes wrong, to do this type the following:

sudo cp menu.lst menu.lst_bak

now that we have done that we can edit the menu.lst file, to do this type the following command:

sudo gedit menu.lst

we need to add a line right at the top of the file like the following:

splashimage (hd0,1)/boot/grub/images/splashimage.xpm.gz

The line above is telling GRUB to use the image and it's location.

Unfortunately because the /boot folder can be on numerous drives we have to make sure we point to the correct one. The above command it pointing to the first HDD in the boot sequence and the second partition, this is what the (hd0,1) is saying.

As the location of your boot may be different we will have to work out where it is, to do this in the terminal type the following command:

mount

this will print out some text like shown below:



There are two things to look for, firstly we need to know if there is a /boot listed anywhere. If it does exist it will we be something like:

/dev/sda4 on /boot ..etc... etc... etc...

If not you need to find the mount of / which in my case is the first line. The important information that you need to know is the /dev/sda3 that begins the line. If you have a /boot then use that line if not use the / line.

As you can see my line is /dev/sda3 as I do not have a /boot

This is important as this tells you where the boot partition is, in my case sda3, this means the third partition on the first HDD. It is the third partition as it ends in 3 and it is the first HDD as it is sda, if it were the second drive it would be sdb etc...

Now that we have the information about where the boot folder is located we need to finish editing the menu.lst file.

As explained the line:

splashimage (hd0,1)/boot/grub/images/splashimage.xpm.gz

is telling GRUB where the file is, the above line is saying that the file is located on the first HDD on the second partition.

Well that may be slightly confusing but GRUB starts counting at 0, that means that hd0 in the above line is the first HDD and the hd0,1 means first HDD second partition.

As my /boot partition is on sda3 which is the first HDD and the third partition the line in my menu.lst is as follows:

splashimage (hd0,2)/boot/grub/images/splashimage.xpm.gz

Well thats it, once you save the file your done. Reboot your computer and enjoy.

DOWNLOADS

Original Desktop(Just in case anyone wants it)
XPM.GZ splash image

NOTE: This was done on Ubuntu 9.04 however should work on most if not all GRUB installations, again I accept no responsibility if this doesn't work and I definitely don't accept responsibility if something breaks :-)

REMEMBER: If something does go wrong you have the backup of the menu.lst file, if the worst should happen you can just insert a live cd and put the original menu.lst file back.


------------------------------------------
NOTE: These articles are tutorials/general ramblings. I do not except responsibility for anything that goes wrong, be it a broken HDD, an entire computer or if you chop off your arms, follow anything I say on this site at your own risk.
------------------------------------------

Comments



Leave a comment

Name:


URL:(optional)


Protection Number (Please insert in box below):2905


Comment:


This website was designed and implemented by myself, all opinions and views expressed are my own unless otherwise specified. Excluding the images contained within the header and any specified elsewhere on the site images are my own.

Copyright Rob Ward
2009 - 2012