< Day Day Up > |
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, given your configuration. Use the following command in /usr/src/linux-2.4:
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 33-1). The bzImage option simply generates a kernel file called bzImage and places it in the arch directory. For Intel and AMD systems, you find bzImage in the i386/boot subdirectory, arch/i386/boot. For a kernel source, this would be in /usr/src/linux-2.4/arch/i386/boot.
make bzImage
The options in Table 33-1 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.
Option |
Description |
---|---|
zImage |
Creates the kernel file called zImage located in the /usr/src/linux/arch or arch/i386/boot directory. |
install |
Creates the kernel and installs it on your system. |
zdisk |
Creates a kernel file and installs it on a floppy disk (creates a boot disk). |
bzImage |
Creates the compressed kernel file and calls it bzImage. |
bzdisk |
Creates the kernel and installs it on a floppy disk (creates a boot disk). |
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. You should make a backup copy of the old modules before you install the new ones.
make modules_install
The install option both generates the kernel files and installs them on your system as vmlinuz., incorporating the make bzImage step. This operation will place the kernel files like the bzImage file in the /boot directory, giving them the appropriate names and kernel version number.
make install
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.
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 fewer lines, separating the commands with semicolons, as shown here:
make dep; make clean; make bzImage; make modules make modules_install; make install
A safer way to perform these operations on single lines is to make them conditionally dependent on one another, using the && command. In the preceding method, if one operation has an error, the next one will still be executed. By making the operations conditional, the next operation is run only if the preceding one is successful.
make dep && make clean && make bzImage make modules make modules_install && make install
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-2.4.22-1. Remember to first back up the old kernel file, as noted in the precautionary steps. 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, you copy it to the /boot directory with the name vmlinuz and the attached version number such as vmlinuz-2.4.22-1. You then create a symbolic link from /boot/vmlinuz to /boot/vmlinuz-2.4.22-1.
make bzImage cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.22-1 ln -s /boot/vmlinuz /boot/vmlinuz-2.4.22-1
Tip |
The bzImage option, and those options that begin with the letter b, 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, the same way you would with bzImage. Bear in mind that support for zImage will be phased out eventually. |
You will also have to make a copy of the System.map file, linking it to the System.map symbolic link.
cp arch/i386/boot/System.map /boot/System.map-2.4.22-1 ln -s /boot/System.map /boot/System.map-2.4.22-1
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. This kernel file is copied to the /boot directory and given the name vmlinuz-2.4.22-1 Then a symbolic link called /boot/vmlinuz is created to the kernel vmlinuz-2.4.22-1 file. Next, create the modules and install them:
make dep make clean make bzImage make modules make modules_install cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.22-1 ln -s /boot/vmlinux-2.4.22-1 /boot/vmlinuz cp System.map /boot/System.map-2.4.22-1 ln -s /boot/System.map-2.4.22-1 /boot/System.map
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. This option installs the kernel on a floppy disk placed in your floppy drive. The kernel resides 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
Be sure you have a floppy disk in the floppy drive. The make bzdisk command copies the image directly to the floppy disk. You still have to create and install your modules. Be sure that the bzImage file is small enough to fit on a floppy. 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 or boot CD-ROM, rather than installing it on your system. If something goes wrong, you can always boot up normally with your original kernel still on your system (though you can always configure your boot loader to access previous versions). |
< Day Day Up > |
This HTML Help has been published using the chm2web software. |