Blog Forum Wiki Links Contact Us
 
Translations of this page:

How to create custom startup and shutdown screens

Introduction

The Asus Eee PC has 3 splash screens:

  • the BIOS screen
  • the startup screen
  • the shutdown screen

This article explains how to customize the last two screens (startup and shutdown). There is another article if you want to customize the BIOS screen.

How it works

The startup and shutdown screens are displayed at Linux console framebuffer. The images themselves are called startup.fb and shutdown.fb and are located at /boot. These files are raw 640×480 16bpp RGB (or BGR?) images. This means three things:

  1. It is a lot easier to customize startup/shutdown screens than to customize BIOS screen.
  2. You don't risk bricking your laptop when doing this (but, of course, you must be careful).
  3. To change the startup screen, you need to enter the rescue mode (or debug mode) because you need to modify the /boot directory at the /dev/sda1 partition.

These boot screens are 640×480, but will be automatically expanded to 800×480 (the native screen resolution). This means that you might want to make your own boot image at 800×480 resolution and then resize it to 640×480 before converting it to raw format.

Working with raw images

You will most likely need to follow only one of these subsections.

Opening a raw image with Gimp

If you have a raw image and want to open/edit it in Gimp, follow the instructions in this section.

Gimp version 2.4.2 cannot directly read these images, but it can read raw 24bpp RGB (or BGR?), so I needed to write a quick tool to convert one format to another. Here is the C source code:

/* convert16to24.c */
#include <stdio.h>
 
int main(int argc, char *argv[])
{
	unsigned long int rgb_in, rgb_out;
	unsigned long int red, green, blue;
 
	while( fread(&rgb_in, 2, 1, stdin)==1 )
	{
		red   = (rgb_in >> 11) & 0x1F;
		green = (rgb_in >>  5) & 0x3F;
		blue  = (rgb_in      ) & 0x1F;
 
		/* This should give more accurate results, uncomment this and comment the next portion if you prefer. */
		/*red   = red  *255/31;
		green = green*255/63;
		blue  = blue *255/31;*/
 
		red   = red   << 3;
		green = green << 2;
		blue  = blue  << 3;
 
		/*rgb_out = (red << 16) | (green << 8) | blue;*/
		rgb_out = red | (green << 8) | (blue << 16);
		fwrite(&rgb_out, 3, 1, stdout);
	}
	return 0;
}

You only need gcc to compile this program. Compile it with

gcc convert16to24.c -o convert16to24

To convert a file from 16bpp to 24bpp, run:

./convert16to24 < inputfile > outputfile

After this, open Gimp and go to File → Open. At the Open Image dialog, select All Files at the bottom-right portion. Then locate the converted file, select it, and press the Select File Type expander. Then, locate Raw image data, select it, and press Open. At the following screen, select RGB image type, offset=0, width=640 and height=480. The image preview should now display the image correctly. Finally, press Open.

Saving a raw image with Gimp

If you have an image inside Gimp and want to export to raw format, you may follow these instructions or follow the instructions of the next section.

Gimp 2.4.2 cannot save 16bpp RGB (or BGR?) images directly, so we need to save 24bpp RGB and convert afterwards.

When you are done editing your image, save it with .xcf extension (so you can easily edit it later) or maybe as .png. Make you sure the image is in RGB mode (Image → Mode → RGB) — as Grayscale or Indexed modes won't work. Make you also sure the image has exactly 640×480 pixels.

Then go to File → Save a Copy or File → Save As. At the save dialog, expand the Select File Type and select Raw image data. At the next screen, select the first option: Standard (R,G,B). And that's it.

This image is not ready yet to be used on Eee PC. To convert to the appropriate format, use the following program:

/* convert16to24.c */
#include <stdio.h>
 
int main(int argc, char *argv[])
{
	unsigned long int rgb_in, rgb_out;
	unsigned long int red, green, blue;
 
	while( fread(&rgb_in, 3, 1, stdin)==1 )
	{
		red   = (rgb_in >> 16) & 0xFF;
		green = (rgb_in >>  8) & 0xFF;
		blue  = (rgb_in      ) & 0xFF;
 
		/*red   = red  *31/255;
		green = green*63/255;
		blue  = blue *31/255;*/
 
		red   = red   >> 3;
		green = green >> 2;
		blue  = blue  >> 3;
 
		/*rgb_out = (red << 11) | (green << 5) | blue;*/
		rgb_out = red | (green << 5) | (blue << 11);
		fwrite(&rgb_out, 2, 1, stdout);
	}
	return 0;
}

You only need gcc to compile this program. Compile it with

gcc convert24to16.c -o convert24to16

Finally, to convert the exported raw image from Gimp to the correct format, run:

./convert24to16 < gimpexportedfile > outputfile

Converting a PNG image to raw

If you already have an image in PNG format, or if you can save an image in PNG format, follow these instructions to convert it to raw image.

gfoot user at forum has posted a tool to convert PNG to raw:

#!/usr/bin/python
 
import sys
 
try:
	infile = sys.argv[1]
	outfile = sys.argv[2]
except:
	print "Usage: %s <input> <output>" % ( sys.argv[0], )
	print
	print "    <input>: any existing image file, e.g. a PNG,"
	print "             preferably 640x480"
	print
	print "   <output>: output filename - raw data to dump to"
	print "             /dev/fb/0, assuming you got the image"
	print "             dimensions right"
	print
	sys.exit(1)
 
import Image
im = Image.open( infile )
im2 = im.convert( "RGB" )
data = im2.getdata()
 
fp = open( outfile, "wb" )
for (r,g,b) in data:
	assert r >= 0 and r <= 255
	assert g >= 0 and g <= 255
	assert b >= 0 and b <= 255
	r /= 8
	g /= 4
	b /= 8
	assert r >= 0 and r <= 31
	assert g >= 0 and g <= 63
	assert b >= 0 and b <= 31
	value = r*2048+g*32+b
	assert value >= 0 and value <= 65535
	fp.write( chr(value%256)+chr(value/256) )

Here are the instructions on how to use it:

wget http://www.glost.eclipse.co.uk/gfoot/eee/png2fb
chmod +x png2fb
png2fb inputfile.png outputfile

If the script returns this error: ”ImportError: no module named Image” This means you don't have the Python-imaging package installed. To do so, just type in this command:

sudo apt-get install python-imaging

Putting the files at the correct place

If you just try to overwrite both files, you will find out the shutdown screen has changed, but the startup screen stays the same. This happens because the startup screen is displayed before the user partition (/dev/sda2) is mounted. So, to change both screens you need to enter the rescue mode. Here are the steps:

  • First of all, save your new startup/shutdown files somewhere at your user partition. Saving them at /root/ or /home/user/ is enough. Remember the rescue mode opens a very limited shell and you won't have access to network, and maybe not even external drives.
  • Mount both /mnt-system and /mnt-user (see previous step).
  • Go to the /boot directory:
cd /mnt-system/boot
  • Make a backup of the original files:
mv startup.fb startup.fb.original
mv shutdown.fb shutdown.fb.original
  • Copy the new files (supposing they were left at /root):
cp /mnt-user/root/new-startup-screen startup.fb
cp /mnt-user/root/new-shutdown-screen shutdown.fb
  • Umount the devices and exit the rescue mode:
cd /
umount /mnt-system
umount /mnt-user
exit
  • The changes will be visible immediately after exiting the rescue mode (but there will be some characters over the startup screen — don't worry, this won't happen on next boot).

Improvements to this article

Please feel free to improve this article, to improve the conversion tools and so on.

 
custom_startup_and_shutdown_screens.txt · Last modified: 2008/11/04 08:39 by nootilus
 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki