posted by Clinton De Young on Mon 3rd Mar 2003 03:07 UTC

"Compilation, Installing the kernel"

SAVING THE KERNEL CONFIGUATION AND COMPILING

Now we are ready to compile the kernel. Before we do that, however, I would like to mention one thing. If you have multiple machines that you want to install the same kernel on (This won't work well if the hardware on the machines isn't the same) click the "Store Configuration to File" button. This will save all the changes you just made to a file. You can then copy that file to your other machines, and when you open the Linux Kernel Configuration utility on those machines, you just have to click on the "Load Configuration from File" button and open your saved kernel file. This will save you from having to go through the configuration process on each machine.

Now, let's compile the kernel. From the main Linux Kernel Configuration window, click on the button titled "Save and Exit". It will pop up a window telling you to check the top level makefile and run make dep. You don't have to do either of these things, so just click the "OK" button. You should now be back at the command prompt.

At the command prompt, type "pwd" to print the working directory. It should return "/usr/src/linux" (if it returns anything else, type "cd /usr/src/linux" to go to the directory that contains your kernel's source code).

Once you are in this directory, type the following two commands: make-kpkg clean
make-kpkg --revision=786:MyKernel2.4.20 kernel_image

The second of these commands is where the actual compiling takes place. On my AMD Athlon 1800+ machine, the compile process takes around ten minutes to finish. On one of my older machines, it can take over an hour (on a 486, you're probably looking at a few days). If you have an older machine, go eat lunch and enjoy a good comedy movie. The compilation should be finished by the time you come back. You probably need a break anyway.

If you really want to understand the deep crevices of what is going on here, you can read the documentation that is located in /usr/doc/kernel-package/ for more information. In a nutshell, however, what you are doing is creating a .deb file that we are going to install in exactly the same way we install programs; using the dpkg utility. This file we are generating will automatically handle the system configuration tasks for us that the poor saps that use other Linux distributions have to do manually. This is generally a good thing.

INSTALLING THE NEW KERNEL

Once you have finished lunch and a movie, your machine should be finished compiling the kernel and you should be back at a prompt. You should also have a new file in your /usr/src directory.

Let's go there now by typing "cd /usr/src" at the command line. If you type "ls -l" at the command prompt, assuming you didn't receive any compile errors, you should see a file called "kernel-image-2.4.20_MyKernel2.4.20.deb"; or something like that.

Now we need to install the kernel, just as we would any .deb file, by using the dpkg utility. Type "dpkg -i kernel-image-2.4.20_MyKernel2.4.20.deb" (or the name of the file if yours is different) at the command prompt and press Enter.

Once the installation is finished, you will be prompted to create a boot floppy. I suggest you do so, but you don't have to.

Next, you will be prompted to install a boot block using the existing /etc/lilo.conf. If you don't say yes here you won't be able to boot your machine into your new kernel (unless you said yes to the floppy question, but then you can only boot with that floppy). Regardless of which you choose, make sure you say "yes" to either or both questions; otherwise you will be left without the ability to boot your shiny new 2.4.20 Linux machine.

Once this process has finished, you need to reboot your machine. Upon reboot, type "dmesg" and look at the output. Look for any errors. You should also notice (if you can read cryptic Linux messages) that your sound card has been recognized. If you see a problem, such as you picked the wrong sound card, then you will need to make the change in the kernel and try again. If that happens, see the last section of this article.

Table of contents
  1. "Intro, Downloading the kernel"
  2. "Step by Step Kernel building, requirements"
  3. "Configuring the kernel"
  4. "Configuring for sound, ext3 and burners"
  5. "Compilation, Installing the kernel"
  6. "ext3 journaling, troubleshooting, conclusion"
e p (0)    59 Comment(s)

Technology White Papers

See More