Section 3 - Compiling the kernel

# 4 Section 3 - Compiling the kernel

Contents of this section

## 4.1 3.0. Cleaning and depending

When the configure script ends, it will tell you to ```dep`'' and ```clean`.'' So, do the ```make dep`.'' It doesn't take that long unless you've got a really slow computer. Making depend makes sure you've got all of the dependencies in place, like the include files and that kind of thing. When finished (you can also do it before the ```make dep`''), do a ```make clean`.'' This wipes out all of the object files and some other things that the kernel compiles. Don't forget this step.

## 4.2 3.1. Compile time

After depending and cleaning, you can now do ```make`'' or ```make zdisk`.'' ```make`'' will compile the kernel, and leave you with a file called ```zImage`'' (among other things). That's the new kernel. ```make zdisk`'' does the same thing, but sticks it on a floppy disk that you have hopefully put in drive A:. ```zdisk`'' is fairly handy for testing new kernels; if it totally bombs out, just remove the floppy and boot with your old kernel. It's also a handy way to boot if you accidentally remove or kernel or something. You can also use it in installing new systems when you just dump the contents of one disk onto the other (all of this and more! NOW how much would you pay?).

All reasonably recent kernels are compressed, hence the ```z`'' in front of the names. The kernel is compressed, and when run, automatically decompresses itself (a nice way to save disk space).

## 4.3 3.2. Other ``make''ables

```make mrproper`'' will do a more extensive ```clean`''ing. ```make zlilo`'' will install the kernel, run LILO on it, and get you all ready to boot, BUT ONLY if lilo is configured in the following way on your system: kernel is `/vmlinuz` , lilo is in `/sbin` (naughty boy, it shouldn't be; it's not a statically linked executable), and your lilo config agrees.

## 4.4 3.3. Installing the kernel

After you've got a new kernel that seems to work the way you want it to, it's time to install it. Most people use LILO (Linux Loader) for this. It's a fairly easy package to install which, however, can confuse people with the config file. If you don't have the latest version, look at the config file (either `/etc/lilo/config` for older versions or `/etc/lilo.conf` for new versions), and see what you've got. It will say something like this:

        image = /vmlinux
            label = Linux
            root = /dev/hda1
            ...

First off, that ```image =` '' is set to what the installed kernel is. Most people seem to use `/vmlinuz`, but I use `/vmlinux`. ```label`'' is used by lilo to tell which kernel or operating system you're booting, and ```root`'' is the `/` of that particular OS. Make a backup copy of your old kernel (whatever it's called), and copy the zImage you made into place (like, you would say ```cp zImage /vmlinuz`'' if you use ```/vmlinuz`''). Then, rerun lilo -- on newer systems, you can just run ```lilo`,'' but on older stuff, you might have to do an `/etc/lilo/install` or even an `/etc/lilo/lilo -C /etc/lilo/config`.

If you want to know more about LILO's configuration, or you don't have LILO but you want to, get the newest version from your favorite ftp site and follow the instructions.

To be able to boot one of your old kernels off the hard disk (another way to save yourself in case you floozie up the new kernel), copy the lines (including the line) ```image = xxx`'' in the lilo config file to the bottom of the file, and change the ```image = xxx`'' to ```image = yyy`,'' where ```yyy`'' is the name of the thing you saved your backup kernel to. Then, change the ```label = xXx`'' to something like ```label = linux-backup`.'' Then, rerun lilo. You may have to put a line in the config file saying ```delay=x`,'' where x is an amount in tenths of a second. That's to make lilo wait before booting, so you can interrupt it (with the shift key, for example), and type in the label of the backup boot image (in case unpleasant things happen).

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter