O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


 
Buy the book!
Linux Desktop Hacks
By Nicholas Petreley, Jono Bacon
March 2005
More Info

HACK
#8
Jazz Up Your Debian System Boot
Boot Debian with an optional graphics screen and progress bar, and spiff up your text consoles by running them in graphics mode
[Discuss (2) | Link to this hack]

Here's how to add a graphical boot splash to your Debian distribution, the only popular Linux distribution that lacks a built-in boot splash. Windows and Mac OS X have a graphical boot process, as do all the most popular versions of Linux, including Fedora Core (Red Hat), SUSE, and Mandrake. Debian lacks one. (OK, to be perfectly fair, so does Slackware, but currently there's no simple solution for bringing a graphical boot screen to Slackware.) Here's how to bring your Debian system up-to-date with the rest.

You must use a 2.6 version of the Linux kernel for the boot splash to work. If you are using a 2.4 or earlier version of the Linux kernel and are not willing to upgrade to a 2.6 version, you cannot use this hack. This hack also assumes you know how to configure, build, and install a new Linux kernel, and that you already have chosen a version of the 2.6 Linux kernel source code and have that source code on your hard drive. [Hack #88] provides instructions on how to build and install a Linux kernel if you have never done so. Once you know how to build and install a Linux kernel, you will need to build your kernel with support for frame-buffer graphics, frame-buffer graphics-based consoles, and graphical boot splash screens to make this hack work.

The boot splash portion of this hack gives you a choice of booting in silent mode or verbose mode. Silent mode displays a graphical background (such as a picture of Tux, the official Linux penguin), and a progress bar to give you a rough idea of where you are during the boot process. You can press F2 at any time to switch to verbose mode, where you see exactly what is happening at boot time. When the boot process is finished, all your virtual consoles work in frame-buffer graphics mode.

Whether you boot to a console or to a graphical login manager, you always have a number of virtual text consoles available to you. You can switch between them by pressing Ctrl-Alt-F1 to get to the first virtual console, Ctrl-Alt-F2 to get to the second, and so on. The difference between a frame-buffer console and a normal console is that the frame-buffer console works in graphics mode, which allows you to display more text on the screen (using smaller fonts), yet keep the text very sharp and readable. The consoles are still primarily for text-based use, but because they are running in graphics mode, you can also have a graphical background behind the text.

At the time of this writing, two substantially different types of patch sets to the Linux kernel are available for boot splash support. The patch set you need for this particular hack is the one that works now, but it is slowly being phased out in favor of an approach that requires far fewer patches to the kernel. This latter approach isn't quite ready for Debian yet. Keep your eye on the web site http://alioth.debian.org/. I have been working with other Debian developers to create a more modern boot splash package, and it should eventually show up on that site.

For now, however, you need to work with what's out there. Even so, it's difficult if not impossible to find kernels prepatched or precompiled with the kind of frame-buffer boot splash support you need for this older approach to boot splash. So, you have to patch and compile your own Linux kernel to make this work. You can download a patch from http://www.bootsplash.de/files.

Log in as root and change to the directory /usr/src:

$ su -
Password: 
# cd /usr/src

Choose the patch that matches the 2.6 kernel you are using, and download that patch to the directory /usr/src. For this example, let's assume you are using the Linux kernel 2.6.8.1, so download the file bootsplash-3.1.4-sp3-2.6.8.1.diff.

It's always good practice to do a dry run with the patch process just to make sure the patch will apply cleanly:

# cd /usr/src/linux-2.6.8.1
# cat ../bootsplash-3.1.4-sp3-2.6.8.1.diff | patch -p1 --dry-run
patching file drivers/char/keyboard.c
patching file drivers/char/n_tty.c
patching file drivers/char/vt.c
patching file drivers/video/Kconfig
patching file drivers/video/Makefile
patching file drivers/video/bootsplash/Kconfig
patching file drivers/video/bootsplash/Makefile
patching file drivers/video/bootsplash/bootsplash.c
patching file drivers/video/bootsplash/bootsplash.h
patching file drivers/video/bootsplash/decode-jpg.c
patching file drivers/video/bootsplash/decode-jpg.h
patching file drivers/video/bootsplash/render.c
patching file drivers/video/console/fbcon.c
patching file drivers/video/console/fbcon.h
patching file include/linux/console_struct.h
patching file include/linux/fb.h
patching file kernel/panic.c

It looks like there are no errors. Do it again for real by running the patch command, without the -dry-run option:

# cat ../bootsplash-3.1.4-sp3-2.6.8.1.diff | patch -p1
patching file drivers/char/keyboard.c
patching file drivers/char/n_tty.c
patching file drivers/char/vt.c
patching file drivers/video/Kconfig
patching file drivers/video/Makefile
patching file drivers/video/bootsplash/Kconfig
patching file drivers/video/bootsplash/Makefile
etc...

Now it's time to configure the kernel. Because this hack assumes you have already configured and compiled this kernel without the boot splash feature, all you need to do is configure the boot splash feature and the other kernel features on which boot splash depends.

make menuconfig

When you use make menuconfig to configure your kernel, you have to follow the menu options. Here are the menu steps you should follow to set up your kernel to support boot splash and the frame buffer:

  1. Select Device Drivers→Graphics support→Support for frame buffer devices.

  2. Select the "VESA VGA graphics support" option and press Y.

  3. Select "Video mode selection support" and press Y (you should see the selection show [*]).

  4. Select "Console display driver support" and press Enter.

  5. Select "Video mode selection support" and press Y, after which you should see [*].

  6. Select "Framebuffer Console support" and press Y, after which you should see <*>.

  7. Exit from this menu. Now select Bootsplash Configuration, and when you see the only selection, "Bootup splash screen," press Y (you should see the selection show [*]).

WARNING

You might see a frame-buffer driver specifically written for your video card and be tempted to use it instead of the VESA VGA driver. This can lead to serious problems if you also use an accelerated graphics driver for your video card. For example, never select "nVidia riva" frame-buffer support if you plan to use the third-party NVIDIA accelerated graphics drivers. These two drivers do not play well together, and you're sure to have video crashes.

If your system uses an initial RAM disk (initrd), now create that initial RAM disk as you normally would. Make a note of the name of the initrd file you create. You'll need it later. It's easiest to remember it if you put the kernel version in the name, such as initrd.img-2.6.8.1. For example, create the initrd file with a command such as this (assuming your root partition is /dev/hda1):

# mkinitrd -o initrd.img-2.6.8.1 -r /dev/hda1 2.6.8.1

Install Boot Splash and the Boot Splash init Scripts

Now that your kernel has support for frame buffers, frame-buffer consoles, and boot splash, you must install the boot splash utilities and boot splash startup scripts.

Use your favorite editor to modify your /etc/apt/sources.list file to include the following line:

deb http://www.bootsplash.de/files/debian unstable main

Then update the package database and install the necessary files:

# apt-get update
# apt-get install sysv-rc-bootsplash
# apt-get install bootsplash bootsplash-theme-newlinux

TIP

If you are running a Debian-based distribution instead of true-blue Debian, you will probably have problems installing these packages. You must convert your Debian-based distribution into a true Debian system for these instructions to work. This process isn't difficult, but it is different for each Debian-based product, and an explanation of the necessary steps is beyond the scope of this book.

When Debian installs the bootsplash package, the installation dialog presents a list of existing initrd images it finds, and it asks you to make a choice about your initrd file. If you created an initrd file called initrd.img-2.6.8.1, as in the previous example, select that file from the list. In this case, the installation program will append the boot splash information to your existing initrd file.

If you do not have or need an initrd file for this kernel, select none from the list. In this latter case, the configuration program creates an initrd file for you called initrd.splash.

Set Up Your Bootloader

Most people use either LILO or GRUB as their bootloaders, so let's take a look at both. But first, you must decide what screen resolution and color depth you want for your frame-buffer consoles. The bootloader uses a command something like the following:

vga=791

The decimal number 791 sets the console to 1024x768 with 64,000 colors. This is usually the safest number to use (not all video cards support all combinations of resolutions and color depths). You can experiment with others. Table 1 shows you which numbers represent the various resolutions and color depths.

Table 1. Frame-buffer decimal codes

Color depth

640x480

800x600

1024x768

1280x1024

8-bit

769

771

773

775

15-bit

784

787

790

793

16-bit

785

788

791

794

24-bit

786

789

792

795

The LILO bootloader is controlled by the settings in the /etc/lilo.conf file. These settings determine which operating system or kernel version your machine boots with, and which configuration options are passed to Linux at boot time.

Here is a sample entry in the /etc/lilo.conf file that supports the boot splash and frame-buffer console. Notice the line that sets the vga mode to the decimal number 791. This number specifically refers to the frame-buffer console resolution 1024x768 at 16-bit (64,000 colors) color depth (see ). The line append="splash=silent" tells the boot splash sequence not to show all the steps Linux takes during boot time. Instead, you will see a progress bar. If you would rather see all the boot information, change that line to append="splash=verbose". If you choose "splash=silent", you can still press the F2 key during the boot process to switch to verbose mode. However, once you press F2 to switch to verbose mode, you cannot switch back to silent mode.

If you have an initrd image, such as initrd.img-2.6.8.1, set up your LILO entry like this (substitute your kernel version where appropriate):

image=/boot/vmlinuz-2.6.8.1
  label=Linux
  root=/dev/hda1
  initrd=/boot/initrd.img-2.6.8.1
  append="splash=silent"
  vga=791

If you do not have an initrd image and you selected none during boot splash configuration, set up your LILO entry more like this (substitute your kernel version where appropriate):

image=/boot/vmlinuz-2.6.8.1
  label=Linux
  root=/dev/hda1
  initrd=/boot/initrd.splash
  append="splash=silent"
  vga=791

Whenever you modify your /etc/lilo.conf file, you must run the command lilo for the changes to take effect.

WARNING

Always include a known working boot configuration in your lilo.conf file in case the new one does not work. That way you can reboot and choose the working selection to make changes to fix any problems you find.

If you use GRUB as your bootloader, you should have a directory called /boot/grub on your system. This directory contains the files GRUB needs to work, such as the GRUB configuration file. The grub.conf file is the one that determines which operating systems or Linux versions you can choose, and this is the file you will need to modify to enable the boot splash.

Here is a sample entry in the grub.conf file, assuming you have an initrd file and you chose it during boot splash configuration:

title Debian Splash
 root (hd0,0)
 kernel /boot/vmlinuz-2.6.8-1 ro root=/dev/hda1 vga=791 splash="silent"
 initrd /boot/initrd.img-2.6.8-1

Here is a sample entry in the grub.conf file, assuming you chose none during boot splash configuration:

title Debian Splash
 root (hd0,0)
 kernel /boot/vmlinuz-2.6.8-1 ro root=/dev/hda1 vga=791 splash="silent"
 initrd /boot/initrd.splash

Unlike with LILO, changes in grub.conf automatically take effect.

WARNING

Always include a known working boot configuration in your grub.conf file in case the new one does not work. That way you can reboot and choose the working selection to make changes to fix any problems. GRUB also gives you the opportunity to boot to a working kernel even if there is no definition for it in the grub.conf file. Read the info file on GRUB for instructions for performing special operations such as this.


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.