- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
Building and Installing the Kernel
Configuration creates one precious file, /usr/src/linux/.config. This file contains the list of #defines for selected options; once you have a working configuration, you will want to keep a backup copy in a safe place.
You can now apply your updated configuration to build the new kernel, create the modules, and install the works. It's also now time to give your wrists a break and return to the command line to put it all together.
Before building the new kernel, you must regenerate all dependency files to account for any changes in include or module options. Until CML2 becomes the standard, this step is needed whenever the kernel configuration is changed. The make dep clean command will rebuild these dependency files and remove any stray generated files.
Building the Kernel
As with everything else about Linux, building the kernel offers many choices. All the build options are outlined in linux/Documentation/kbuild/commands.txt; the most common cases are building just the kernel file, building only the modules, building both, and doing an install of the kernel and/or the modules after the build.
For example, you may need to build a kernel file for some other computer (such as a laptop) or to be installed by hand under some very logical new name. Building this image could be done with
make bzImage && cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-scsi
The first command compiles and compresses the kernel (for a "large kernel" image, leaving the result in arch/$(ARCH)/boot; the image is then copied manually to the /boot directory. This new image will not be installed until it is registered with a boot loader such as lilo (see Manually Installing a New Kernel). To automatically install a kernel image, use the command
make bzlilo
This will create the same compressed image and copy the file to $INSTALL_PATH/vmlinuz, then run the lilo command; make bzlilo assumes your /etc/lilo.conf expects this filename in this location.
The most common and convenient command for creating a new kernel is
make dep clean zlilo modules modules_install
This one command line will do the following:
- Perform the dependency file generation.
- Clean the sources.
- Create a compressed kernel image.
- Move $(INSTALL_PATH)/vmlinuz to $(INSTALL_PATH)/vmlinuz.old, copy the new zImage kernel file to $(INSTALL_PATH)vmlinuz, and run lilo to install the new images.
- Build all modules and install these under $(INSTALL_MOD_PATH)/lib/modules/2.2.5.
Putting all these commands on one line will ensure that if any stage of this build fails, subsequent stages will not be started. The whole process can also be scheduled to run in an xterm window or alt-console, can be run during off-peak hours as an at job, or can be used as an excuse to play some serious Nethack or XPilot.
Manually Installing a New Kernel
The new kernel file is always found in /usr/src/linux/arch/$(ARCH)/boot/zImage and must be installed using the lilo boot loader or some other Linux loader before it can be used.
For example, to emulate the Red Hat /boot path scheme, you would need to copy the new zImage to /boot/vmlinuz (save the old one first!) and modify /etc/lilo.conf to include the backup version. Alternatively, to accommodate stubborn plug-and-play devices, you may need to copy this new kernel to your Windows 95 partition for use by the Linux loadlin.exe boot loader.
One frequent requirement is to create boot floppies. A boot floppy is nothing more than a kernel copied directly to a floppy disk and set to mount the root filesystem from the hard drive.
While it is far more mnemonic to create a boot floppy using the command
make zdisk
this is equivalent to using dd to copy the file directly to the raw sectors of the floppy disk device:
dd if=arch/i386/zImage of=/dev/fd0
Troubleshooting the New Kernel
/proc is your friend. The pseudo-files in the /proc directory hold a wealth of diagnostic information and a simple means to set runtime parameters.
System Information Files
The most frequently useful /proc diagnostic files are as follows:
-
/proc/cpuinfo lists the processor type, number of ports, and other essential information about the computer hardware:
$cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 5 model : 8 model name : AMD-K6(tm) 3D processor stepping : 12 cpu MHz : 350.804507 fdiv_bug : no hlt_bug : no sep_bug : no f00f_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr mce cx8 sep pge mmx 3dnow bogomips : 699.60
-
/proc/interrupts maps IRQ lines to devices:
$ cat /proc/interrupts CPU0 0: 30200579 XT-PIC timer 1: 251230 XT-PIC keyboard 2: 0 XT-PIC cascade 4: 996021 XT-PIC serial 5: 1 XT-PIC soundblaster 7: 2 XT-PIC parport1 8: 1 XT-PIC rtc 11: 3984 XT-PIC MSS audio codec 12: 973494 XT-PIC eth0 13: 1 XT-PIC fpu 14: 4253923 XT-PIC ide0 15: 4713361 XT-PIC ide1 NMI: 0
-
/proc/sound reports the current sound system configuration and the installed services:
$ cat /proc/sound OSS/Free:3.8s2++-971130 Load type: Driver compiled into kernel Kernel: Linux maya.dyndns.org 2.2.5 #2 Thu Apr 15 18:34:07 EDT 1999 i586 Config options: 0 Installed drivers: Type 10: MS Sound System Type 27: Compaq Deskpro XL Type 1: OPL-2/OPL-3 FM Type 26: MPU-401 (UART) Type 2: Sound Blaster Type 29: Sound Blaster PnP Type 7: SB MPU-401 Type 36: SoftOSS Virtual Wave Table Card config: SoftOSS Virtual Wave Table Compaq Deskpro XL at 0x530 irq 11 drq 0,0 Sound Blaster at 0x220 irq 5 drq 1,5 (SB MPU-401 at 0x330 irq 5 drq 0) OPL-2/OPL-3 FM at 0x388 drq 0 Audio devices: 0: MSS audio codec (SoundPro CMI 8330) 1: Sound Blaster 16 (4.13) (DUPLEX) Synth devices: 0: SoftOSS 1: Yamaha OPL3 Midi devices: Timers: 0: System clock 1: SoftOSS Mixers: 0: MSS audio codec (SoundPro CMI 8330) 1: Sound Blaster
-
/proc/parport contains directories for each parallel port and reports on the devices attached to each port:
$ cat /proc/parport/0/hardware base: 0x378 irq: none dma: none modes: SPP,ECP,ECPEPP,ECPPS2
Setting Kernel Parameters and Options
Kernel and other low-level runtime parameters can be set through the /proc/sys pseudo-files. For example, to set the maximum number of file handles to a higher value, you can include a line in the boot scripts that echoes the new number directly into /proc/fs/file-max.
Recovering from Faulty Kernels | Next Section

Account Sign In
View your cart