Message Board -  Archive

[ Login ] [ Create Account ]
[ Board List ] [ View Board ] [ Post Reply ]
  Author  Subject: Re: kernel compile

Posted on 06-02-2004 01:47 a.m. ET  reply

Original Poster: Mark Krentel

> Does anyone have a good set of basic steps to recompile a kernel
> for RH 9x?

This is what I use in Red Hat 7 and kernel 2.4.x.

(1) Clean the source tree. You really only need to do this step once.
You can restart future builds with step (2) or (3).

cd /usr/src/linux
edit Makefile to set EXTRAVERSION
make mrproper

Note: "make mrproper" will delete your .config file, so if you want to
reuse the same configuration, be sure to save .config first. Also,
EXTRAVERSION just needs to be some unique string like "mykernel",
so the new kernel won't be installed on top of the old one.

(2) Configure the kernel. If you have a .config file that you're
happy with, then you can restore it, else you need to make one with
"make config", "make menuconfig" or "make xconfig".

make menuconfig

Note: Even if you restored a previous .config file, you still need to
start "make menuconfig" and immediately exit to restore a few other
files that "make mrproper" also deletes.

(3) Build the kernel and modules.

make dep
make clean
make bzImage
make modules

(4) Assuming everything compiled ok, then install the kernel and

make modules_install
make install

(5) Finally, if you use LILO, then reinstall LILO. I'm not sure if
GRUB needs this step.


Of course, it's a good idea to keep a copy of the old kernel (be sure
to set EXTRAVERSION) and to know how to boot it (or from a rescue

See also the Kernel Howto. The old version has been "removed for
review" (but I've temporarily restored it).

The new version is "more or less finished" and available at:

Btw, in FreeBSD, the above is one command. :-)

cd /usr/src ; make buildkernel KERNCONF=GENERIC


< Previous 1 Next >

Site Contents