How-To: Compile a 2.6.9 Kernel
This guide is to be used completely at your own risk! It was designed with
an ev1 dual xeon hardware configuration in mind but will also work on some
of the P4 modals. I am not going to try and support every possible hardware
combination. I started this because I wanted a kernel for my own use but
decided to share my work. Upgrading a kernel from rpm is easy and doing it
as i have below is pretty easy as I have already done much of the hard configuration
work. I was able to use the following
guide
on
multiple
servers
with no problem and I know that it works. The key that makes this much easier
is that you are using the .config file I have already created which contains
all of the variables and configuration options. If you would like to view the
.config file and offer any input please feel free! I have a little experience
with compiling kernels but I am sure there are a few more things here and there
I can remove.
As of 12/30/04 this guide will no longer be updated. I will only be updating the 2.6.9 + grsecurity guide.
I do plan on adding grsecurity when it becomes available for 2.6.9 and I get
time.
Now that is done the guide is below, good luck!
First compile module-init-tools which is needed to compile a 2.6.* kernel on
a system currently running a 2.4.* kernel. Do note that this may cause rkhunter
to bring up false positives.
-----command-----
cd
/usr/local/src/
wget http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-tools-3.1.tar.gz
tar -zxf module-init-tools-3.1.tar.gz
cd module-init-tools-3.1
./configure --prefix=""
make moveold
make install
./generate-modprobe.conf /etc/modprobe.conf
cd ..
-----command-----
-----command-----
cd /usr/local/src/
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.9.tar.gz
tar -zxf linux-2.6.9.tar.gz
cd linux-2.6.9
wget http://eth0.us/.config
-----command-----
At this stage you can configure the kernel how you like it. By running "make
menuconfig" you will be presented by a huge menu of options that you can try
to comile into your kernel. After you do your changes click exit and continue.
Not making changes is fine as I have already removed a lot of the extra stuff
in the kernel. If you change the configuration after you have compiled it you
will need to run the below rm commands to delete the kernel files you have
created. They will be regenerated next time you run make. Also know that if
you have trouble with the kernel booting you can just delete the .config and
redownload mine.
-----command-----
rm -rf /boot/config-2.6.9-eth00
rm -rf /boot/vmlinuz-2.6.9-eth00
rm -rf /boot/System.map-2.6.9-eth00
rm -rf /boot/initrd-2.6.9-eth00.img 2.6.9-eth00
-----command-----
Now to actually compile the kernel
-----command-----
make
make modules_install
-----command-----
Make sure there are NO errors after this! If you do get errors the below
is not going to work. The next step is going to copy the kernel into your
/boot directory so you are able to use it.
-----command-----
cp .config /boot/config-2.6.9-eth00
cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.9-eth00
cp System.map /boot/System.map-2.6.9-eth00
mkinitrd /boot/initrd-2.6.9-eth00.img 2.6.9-eth00
-----command-----
All of he ev1 servers I have worked on have lilo installed so below is what
you
need to add to the file to allow you to boot. The append elavator deadline should
help with the IO of your server. If after recompiling you have trouble with the
IO remove the line and reboot to see if that is what is causing the trouble.
image=/boot/vmlinuz-2.6.9-eth00
label=2.6.9-eth00
append="root=LABEL=/ elevator=deadline"
read-only
initrd=/boot/initrd-2.6.9-eth00.img
Make sure when you run this lilo command that you can see no errors. If
there are something is configured wrong and the server is not going to boot.
-----command-----
lilo -v -v
-----command-----
Make SURE there are no errors! Now have your server reboot into the new kernel.
-----command-----
lilo -R 2.6.9-eth00
-----command-----
Ok you are ready to reboot and test it out. Go ahead and shutdown via "shutdown
-r now". If it does not come up after 10 minutes you are going to have to
get the server rebooted. Since we used the -R it will boot back to the old kernel
last time. If it fails you can check the logs to see if anything is shown but
many times nothing does and the only way to do it is have a tech look at the
screen or use a kvm/drac. If it does work for you change the default= in the
lilo.conf to your new kernel.
Now up2date needs to be updated so that redhat will not overwrite the module-init
which will cause the kernel to not load. Edit the up2date config file
-----command-----
pico -w /etc/sysconfig/rhn/up2date
-----command-----
Next look for the skiplist, my old skiplist looked like this:
pkgSkipList=kernel*;httpd*;perl;mysql*;php*;mod_ssl*;
Add the following entry::
modutils*
It should look something like this:
pkgSkipList=kernel*;httpd*;perl;mysql*;php*;mod_ssl*;modutils*;
Save and you are all done.
Hopefully it will come up fine for you :) I have tried this config on multiple
servers and all came up just fine. It is generic enough it worked on a P4
but at the
same time it is still 1.1Mb vs the 3.4Mb the vmlinuz file takes for a RHEL-smp
kernel.
Recent comments
2 years 49 weeks ago
2 years 49 weeks ago
3 years 30 weeks ago
3 years 40 weeks ago
3 years 41 weeks ago
3 years 47 weeks ago
3 years 47 weeks ago
3 years 47 weeks ago
3 years 47 weeks ago
3 years 47 weeks ago