November 21st, 2003 03: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 .
November 21st, 2003 04:24 PM
Woohoo!! I've been looking for something like this......at least I now have a starting point.
November 21st, 2003 08:48 PM
Weeeee! Been looking for one of these! Now I'm off to b0rk my kernel!
With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!
Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.
November 22nd, 2003 04:18 AM
You must spread your AntiPoints around before giving it to .: Shrekkie :. again.
November 22nd, 2003 01:00 PM
Yesterday I tried the "make dep && make clean bzImage modules modules_install".
This works too, but he automatically tells the "make dep" is not necessary, so that would make it pretty much the same
November 22nd, 2003 01:25 PM
Excellent. I love it. Keep it up ogre
Ubuntu-: Means in African : "Im too dumb to use Slackware"
November 22nd, 2003 03:57 PM
cool tut, I wrote one a while back about general kernel compilation (not specfic to any release number)
prefer your layout and its up to date with the brand new shinny kernel
December 18th, 2003 11:38 PM
February 21st, 2004 07:50 PM
I was amazed how easy it was to upgrade from 2.4 to 2.6 - everything worked perfectly and this is the first time I have compiled the kernel (usually I just use the one the vendor provides). Cheers Shrekkie!