November 21st, 2003, 04:23 PM
Compiling a 2.6 Kernel
I didn’t find a kernel guide for the 2.6 range kernels, so after googling and rtfm-ing I managed to compile my own 2.6.0-test9 kernel.
This will be the kernel we will be compiling. My OS is Gentoo. I replaced every Gentoo-specific lines to common ones, so this should work for most distro’s.
It's very important to know this kernel isn't yet announced stable, so this is on your own risk.
So let’s begin.
First make sure you know your system.
$ su ( get in root)
This will give you a list of the modules loaded in your old good functioning kernel. Here you also get the good modules you need to probe if you might have problems later. So you might want to write these down.
Now, we need to get the kernel so,
#wget –c ftp://ftp.kernel.org/pub/linux/kerne...-test9.tar.bz2
#tar –xvjf linux-2.6.0-test9.tar.bz2
With the tar command you’ll extract the compressed kernel
If ok you’ll see a present symlink from /usr/src/linux -> /usr/src/old-kernel
#rm –d linux
With this command you remove this symlink, because we will make one to the new kernel. We will do this with the next line.
#ln –s linux-2.6.0-test9 /usr/src/linux
If you do an ls –la you should see the new symlink to the new kernel dir.
Here, take your time to config the new kernel and make sure you have your specs of your box aside you or in your head
If not /usr/src/linux, then #cd /usr/src/linux
You will now see the kernelconfig menu. In the top of that screen you can see the version of the kernel. If you don’t see here something like linux 2.6.0 – test 9 kernel, you should look what you have missed. Maybe only a symlink problem.
If you’re ready with the kernel config, than its time to compile the kernel.
On the 2.4 kernels it was like this :
# make dep && make clean bzImage modules modules_install
On the 2.6 kernel its like this :
#make && make modules_install
This is because in this version ‘make’ is an alias for ‘make bzImage modules vmlinux’
If you’re not sure about this , then get a manual or type
#make help (I know it worked for me)
OK. Kernel done. Now is another important part in case you did something wrong.
Now you're in the boot section and you can move the old image to a new namm
#mv bzImage bzImage.old
#cp /usr/src/linux/arch/i386/boot/bzImage /boot
This will move the old kernel to bzImage.old and copy the new kernel to /boot/bzImage
To make it easy on yourself, edit your bootloader-conf-file, and change the existing line
for the old kernel to the bzImage.old and add a new section pointing towards the new kernel (bzImage).
Also if you need modules to be loaded, edit your /etc/modules.autoload if you want them loaded on boot.
If you’re using Grub saving the conf file will do, but if you’re using LILO make sure you rebuild LILO like this.
So, lets finish up ,
#shutdown –r now
If everything goes well you should see your bootloader giving a new option (aka kernel) to be tried out.
Don’t panic if something goes wrong on boot, just reboot , launch the old kernel and review what you might have done wrong.
Good luck !
*** EDIT : Did a minor fix .