Figure 34-8: Sound window

Figure 34-8: Sound window

• Kernel Hacking The Kernel Hacking window lists features of interest to programmers who want to modify the kernel code. You can have the kernel include debugging information.

Once you set your options, save your configuration. You can also make a backup copy by clicking Save To File.

Now that the configuration is ready, you can compile your kernel. You first need to generate a dependency tree to determine what part of the source code to compile, based on your configuration. Use the following command:

make dep

You also have to clean up any object and dependency files that may remain from a previous compilation. Use the following command to remove such files:

make clean

You can use several options to compile the kernel (See Table 34-1 later in this chapter). The bzImage option simply generates a kernel file called bzImage and places it in the arch directory. For Intel systems, you find bzlmage in the i386/boot subdirectory, arch/i386/boot. For a Red Hat kernel source, this would be in /usr/src/linux-2.4 /arch/i386/boot. For a kernel archive source, this would be in /usr/src/linux/arch /i386/boot.

make bzImage

The install option generates both the kernel files and installs them on your system, as vmlinuz.

make install

The zlilo option installs the kernel file as well, but also runs lilo to update LILO. The zlilo option is designed for use with systems that run LILO. If you are booting Linux from DOS using loadlin, you will need to copy the bzImage file to the loadlin directory on the DOS partition where you are starting Linux from.

To install a kernel bzImage file manually, copy the bzImage file to the directory where the kernel resides and give it the name used on your distribution, such as vmlinuz for Red Hat. Remember to first back up the old kernel file. On Red Hat, vmlinuz is a symbolic link to an actual kernel file that will have the term "vmlinuz" with the version name. So, to manually install a bzImage file on Red Hat, you copy it to the /boot directory with the name vmlinuz and the attached version number such as vmlinuz-2.4.7-10. You then create a symbolic link from /boot/vmlinuz to /boot/vmlinuz-2.4.7-10.

make bzImage cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.7-10 ln -s /boot/vmlinuz /boot/vmlinuz-2.4.7-10

The bzImage option and those options that begin with the letter b, like bzlilo, create a compressed kernel image. This kernel image may not work on older systems. If not, try using the zImage option to create a kernel file called zImage. Then install the zImage file manually. Bear in mind that support for zImage will be phased out eventually.

make zImage

The bzlilo option both installs the kernel file on your system and runs LILO. You should use this option if you receive an error saying your kernel is too large. The following command compiles the kernel, installs it on your system, and runs LILO for you. To install and update LILO, use the following:

make zlilo

If you receive an error saying the kernel is too large, try using a b version of the option, such as bzlilo, to further reduce its size.

make bzlilo

If you want to create a boot disk with the new kernel, use the bzdisk option. This option will install the kernel on a floppy disk placed in your floppy drive. The kernel will reside on the floppy disk, and to use that kernel you boot your system from the floppy (the kernel is not installed on your root partition as it is with the install option).

make bzdisk

The previous options will create the kernel, but not the modules—those features of the kernel to be compiled into separate modules. To compile your modules, use the make command with the modules argument.

make modules

To install your modules, use the make command with the modules_install option. This installs the modules in the /lib/modules/version-num directory, where version-num is the version number of the kernel. Making a backup copy of the old modules before you install the new ones may be advisable.

make modules install

The commands for a simple compilation and installation are shown here:

make dep make clean make bzImage make modules make modules install make install

If you want, you could enter these all on one line, separating the commands with semicolons, as shown here:

make dep; make clean; make bzImage; make modules make modules install; make install

The following commands show a basic compilation and a manual installation. First, all previous binary files are removed with the clean option. Then the kernel is created using the bzImage option. This creates a kernel program called bzImage located in the arch/i386/boot directory. Then copy this kernel file to the /boot directory and give it the name vmlinuz-version, where version is the kernel version. Then create a symbolic link called /boot/vmlinuz to the kernel vmlinuz-version file. Then create the modules and install the modules:

make dep make clean make bzImage make modules make modules install cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.7-10 ln -s /boot/vmlinuz /boot/vmlinux-2.4.7-10

Instead of installing the kernel on your system, you can simply place it on a boot disk and boot your system from that disk. In that case, you just have to create a boot disk using the bzdisk option. Be sure a formatted floppy disk is in the floppy drive. You will still have to create and install your modules. Be sure that the bzImage file is small enough to fit on a floppy disk. If not, you will have to reconfigure your kernel, compiling as many features as possible as modules instead of as part of the kernel.

make clean make bzImage make bzdisk make modules make modules install

Tip If you are experimenting with your kernel configurations, it may be safer to put a new kernel version on a boot disk, rather than installing on your system. If something goes wrong, you can always boot up normally with your original kernel still on your system.

If you are using a boot loader like GRUB or LILO, you can configure your system to enable you to start any of your installed kernels. As seen in the "Precautionary Steps" section, you can create an added entry in the boot loader configuration file for your old kernel. As you install new kernel versions, you could simply add more entries, enabling you to use any of the previous kernels. For example, you could install a developmental version of the kernel, along with a current stable version, while keeping your old version. In the image line for each entry, you would specify the filename of the kernel. Whenever you install the kernel on Red Hat using the RPM kernel package, the /boot/vmlinuz link is automatically changed to the new kernel. You can still create another boot loader entry for your older kernel. In the next example, the grub.conf file contains entries for two Linux kernels, one for the kernel installed with 7.2, 2.4.7-10, and one for a more recent kernel, 2.4.12. With GRUB, you only have to add a new entry for the new kernel. If you are using LILO, just add a new image segment for the new kernel in the /etc/lilo.conf file. Be sure to execute the lilo command to update LILO.

Table 34-1: Kernel Compile Options Used as Arguments to the make Command in


Configuration Tools



Line-based interface for kernel configuration.


Screen-based interface for kernel configuration.


X Window System interface for kernel configuration.

Maintenance Options

Was this article helpful?

0 0

Post a comment