Posts Tagged ‘kernel’
(note, this should work on most debian based systems, etch, lenny, ubuntu,etc)
Well, thanks to Fedora 10 i recently learned that if I wanted to install the (recently released for linux) driver for my Debian Lenny computer. I would need a better kernel. Unfortunately, Lenny is on a freeze right now, and neither Debian testing nor unstable have a newer kernel on stock other than 2.6.26
I decided to install the 2.6.28 kernel from source, and decided to do it the debian way, since i run debian so it makes sense, and also because word on the street is that the debian way is easier on most distros. It involves making a .deb package from the source code and then installing it, and it works wonders :).
After googling around for a little bit, I found a guide to compile a kernel the debian way (http://www.howtoforge.com/kernel_compilation_debian_etch), but it was a little bit out off date and i had to tweak some things here and there to optimize it for my needs
First of all,
Install these packages
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential
this is the directory we will compile our kernel in
cd /usr/src
i went over to http://www.kernel.org/ to download the latest stable kernel, which at the moment is 2.6.28. Find the kernel and get it into /usr/src. I used wget to download it, but you could just download it by clicking on the link and then just moving it into /usr/src if you are unable to use wget. If you can, just copy the link for the kernel and paste it after wget.
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.2.tar.bz2
then we unpack the downloaded file.
tar xjf linux-2.6.28.2.tar.bz2
ln -s linux-2.6.28.2 linux
cd /usr/src/linux
Now we can configure our new kernel. I liked the idea the guy in the “howtoforge” link above had, to use the configuration file from your previous kernel in your new kernel. This insures that any options or settings that your old kernel had still apply in your new kernel. Of course we can also edit this configuration file to personalize it to our needs
make clean && make mrproper
cp /boot/config-`uname -r` ./.config
this will create a menu to config your kernel
make menuconfig
Go down the list to “Load an Alternate Configuration File” and choose .config. After you do that you can edit and tweak this file to personalize it better, but unless you dramatically change it, it should work fine with your distribution; unless, you are trying to install a new kernel in a hopelessly out of date system, of course.


Make sure you save your work, or it wont use your settings (i’ve heard of some people do this, how? i dont know)

We are almost done with the hard part, now its time to build the kernel!
make-kpkg clean
fakeroot make-kpkg –initrd –append-to-version=-custom kernel_image kernel_headers
(note: wordpress is condensing the two minus signs before the initrd and append into one giant one, making it so that if you just copy and paste this code it won’t work, if this happens to you just delete the giant minus sign before initrd and append and type two minus signs, now it should work)
After –append-to-version= you can write any string that helps you identify the kernel, but it must begin with a minus (-) and must not contain whitespace( i just kept custom kernel_image because it fit right, i had made several tweaks to my kernel.)
you’ll find two .deb packages in /usr/src. Now this is a tip for everyone out there who is like me and likes to reinstall their computers a lot: that took some time so far right? especially the building right? you wouldn’t want to go trought that again now would ya? Well the good news is that these .deb packages can be copied and pasted into other Debian based systems and install them there just by double clicking on them, saves you some time huh? i got copies on my FAT32 partition is use to save things i think i may reuse if i reinstall.)
Anyways, run these commands
cd /usr/src
ls -l
now to install the kernel, you can either opt to do this the easy but geeky looking way
dpkg -i linux-image-2.6.28.2-custom_2.6.28.2-custom-10.00.Custom_amd64.deb
dpkg -i linux-headers-2.6.28.2-custom_2.6.28.2-custom-10.00.Custom_amd64.deb
or do it the less cool looking, simple way, just double clicking the .deb packages and installing them with something like gdeb.
now just reboot the pc
grub should automatically add your kernel and make it the default kernel