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.
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 188.8.131.52, so download the file bootsplash-3.1.4-sp3-184.108.40.206.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-220.127.116.11 # cat ../bootsplash-3.1.4-sp3-18.104.22.168.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-22.214.171.124.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.
1.9.1. 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:
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-126.96.36.199. For example, create the initrd file with a command such as this (assuming your root partition is /dev/hda1):
# mkinitrd -o initrd.img-188.8.131.52 -r /dev/hda1 184.108.40.206
1.9.2. Install Boot Splash and the Boot Splash init 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
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-220.127.116.11, 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.
1.9.3. 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:
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-1 shows you which numbers represent the various resolutions and color depths.
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 Table 1-1). 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-18.104.22.168, set up your LILO entry like this (substitute your kernel version where appropriate):
image=/boot/vmlinuz-22.214.171.124 label=Linux root=/dev/hda1 initrd=/boot/initrd.img-126.96.36.199 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-188.8.131.52 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.
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.
Once you have your Linux kernel compiled to support frame-buffer consoles and you have set up your bootloader properly, it is time to reboot. If everything goes according to plan, you should see Tux, the Linux penguin, and a progress bar that fills as the boot sequence proceeds. When your system has finished booting, it will take you either to the first text console or the graphical login manager, depending on how you have your system configured. When you shut down the machine, you should also see the splash screen and the progress bar. In either case, you can press F2 to switch from silent mode to verbose mode. You cannot switch back, however. Once you are in verbose mode, you stay in verbose mode for the duration of that boot or shutdown sequence.
1.9.5. Graphical Consoles
If you normally boot into a text console, you should notice that you now have a graphical background picture of Tux, the official Linux penguin. If you boot to a graphical login manager, press Ctrl-Alt-F1 to get to the first console to see this new feature.
You can control how many consoles display this background by editing the file /etc/default/bootsplash. Edit the following line to include whichever consoles you want to display the background:
BOOTSPLASH_TTYS="1 2 3 4 5"