Tuesday, 28 August 2007

Grub Background Image HOWTO

While answering this thread http://www.orkut.com/CommMsgs.aspx?cmm=141&tid=2551314922226675249 on Linux Community on Orkut, I said that it is possible to have the sexy boot screen like Fedora, RedHat and Debian on the Ubuntu and related ..buntu systems. I even pointed how, but had not tried myself although I was confident that it will work. So I set off to actually try it out.

Your Recipe:
A linux machine with Ubuntu/kubuntu/edubuntu/xubuntu installed
a 15 colour image to be used as background, Canvas size 640x480. Must be in xpm format

The preparation:
OK. the first question you will ask me is where to get a 15 colour image in xpm format from? My answer is simple. Google it or make it. I have tried both. But I will explain the making one.

I used a photograph I had taken from my friend's N95 of the London Underground. It definitely was not 15 colour and particularly not 640x480. Click to see the original image. You may save it if you like. So the task was to convert it to the required format. I played with few commands like cjpeg, djpeg, etc till i found convert. After going through its options this is what i used:
shashank@shashank-laptop:~$ convert /media/hda3/Shashank\ pictures/09052007088.jpg -colors 15 -resize 640x480 underground.xpm

The command is pretty self explanatory. with the exact required options; -colors and -resize

The final product wasn't pretty impressive, but would suit my requirements. What else would you expect converting a 32bit image to a 15colour one. Can't upload the image so you have to experiment with the original image and the command to see what I got.

now gzip the image:
shashank@shashank-laptop:~$ gzip underground.xpm

move or copy the xpm.gz file to /boot/grub/ folder. You need to be root to do this, so use sudo

Modifying the grub:

Now we need to modify the grub configuration file. This is /boot/grub/menu.lst on the Ubuntu. Use your favourite editor. I love vi, some love nano, for others gedit. remember to be root or sudo your command
shashank@shashank-laptop:~$ sudo vi /boot/grub/menu.lst

Now add this below the timeout line:

My Boot and / same the same partition and it is the second primary partition on my laptop. The first Primary partition is used by the laptops recovery utility which I have left as it is, just in case. You may need to figure out what you have to use in place of (hd0,1) according to your partitoning scheme.

Finally save exit and reboot to view the effect. Cheers.