Compile Kernel 2.6.9


Recommended Posts

Bushrat

How-To: Compile a 2.6.9 Kernel

Also posted on http://www.eth0.us

December 22nd:

Updated up2date so it would not overwrite module utilities preventing the kernel from booting

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 models. 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.

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/ker...ools-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/ker...ux-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_ss

l*;

Add the following entry::

modutils*

It should look something like this:

pkgSkipList=kernel*;httpd*;perl;mysql*;php*;mod_ss

l*;modutils*;

Save and you are all done.

Link to post
Share on other sites
Solarix

oh man thanks for this!!!

Link to post
Share on other sites
eth00

Just as an FYI the guide you posted above is old. I have a 2.6.10 +grsec + a kernel patch listed on my website right now. I would highly suggest that you use the new kernel over the 2.6.9 kernel.

Link to post
Share on other sites
Bushrat
Just as an FYI the guide you posted above is old. I have a 2.6.10 +grsec + a kernel patch listed on my website right now. I would highly suggest that you use the new kernel over the 2.6.9 kernel.

585301072[/snapback]

Whats the link and i will post it..

Link to post
Share on other sites
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.