Monday, January 7, 2013

Create a new LILO boot image

Creating a new LILO boot image is more than easy. Just pickup your favorite image and resize it to 640x480 px. You can use Gimp for resizing images. I like to use the command line what I'll show here. The point is that you get a image with a size of 640x480 and max. 256 colors (8 bit). The only intention to change my LILO screen is my HTPC (running XBMC) because I have found a really nice image for it.
What ever, just take a look at your image with file:

$ file xbmc.png
xbmc.png: PNG image data, 1600 x 900, 16-bit/color RGBA, non-interlaced

According to the above information the image has a size of 1600x900 px and a color depth of 16 bit. The first thing you need to do is to resize the image to 640x480 px:

$ convert -strip -resize 640x480\! xbmc.png xbmc_640x480.ppm

The above command will resize the image to 640x480 px ignoring the aspect ratio. The -strip option will remove any comments in the image. At least the new image will be saved as xbmc_640x480.ppm.
If the image you want to use has more than 256 (8 bit) colors than  run pmnquant first and reduce the numbers of colors:

$ pnmquant 256 xbmc_640x480.ppm > xbmc_640x480x8.ppm
pnmcolormap: making histogram...
pnmcolormap: Scanning image 0
pnmcolormap: 26441 colors so far
pnmcolormap: 26441 colors found
pnmcolormap: choosing 256 colors...
pnmremap: 256 colors found in colormap

Now open a terminal and convert the ppm image into a bmp image:

$ ppmtobmp -bpp=8 xbmc_640x480x8.ppm > lilo.bmp
ppmtobmp: analyzing colors...
ppmtobmp: 256 colors found
ppmtobmp: Writing 8 bits per pixel with a color palette

If you get an error like this:

$ ppmtobmp -bpp=8 xbmc_640x480.ppm > lilo.bmp
ppmtobmp: analyzing colors...
ppmtobmp: More than 256 colors found
ppmtobmp: There are too many colors in the image to represent in the number of bits per pixel you requested: 8.  You may use Pnmquant to reduce the number of colors in the image.

Then you haven't run pmnquant (see above to reduce the numbers of colors in the image).
As root copy the bmp image to /boot:

# cp /path/to/image/lilo.bmp /boot

Configure lilo.conf and set the new image:

# vi /etc/lilo.conf
  bitmap = /boot/lilo.bmp

Reinstall lilo:

# lilo
Adding Linux  *


# shutdown -r now

Finally enjoy your new LILO boot image.

Updated 08-31-2013: added a more detailed description how to convert images

No comments:

Post a Comment