Tags
admin astro ATLAS Bash computing Debian Debian/Lenny Debian/Squeeze Dropbox DS9 Emacs Epson Perfection V30 Evernote FFTW Firefox hardware high performance computing install procedure Japanese JWM kernel Last.fm LaTeX Linux multimedia music network Nevernote NVIDIA GeForce 8800 GT OS X OS X/Leopard OS X/Snow Leopard privoxy programming PS3 PyFITS Python reference research SExtractor software stellar population synthesis T410s USB web browser-
-
Recent Posts
- Using Linux Shell Command within Python
- Installing Firefox 9 on Debian Squeeze
- Installing kcorrect (v4_2) for IDL Locally on Linux
- g3data
- Half-Light Radii for Various Profiles
Recent Comments
- Taro on Installing Kindle for PC on Debian Squeeze
- S on Installing Kindle for PC on Debian Squeeze
- Taro on Installing Kindle for PC on Debian Squeeze
- sash on Installing Kindle for PC on Debian Squeeze
- sash on Installing Kindle for PC on Debian Squeeze
Archives
- January 2012
- December 2011
- May 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- August 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- August 2009
- July 2009
- June 2009
- April 2009
- March 2009
Meta
- Log in
- Entries RSS
- Comments RSS
- WordPress.org
Customizing & Installing Linux Kernel on Debian Squeeze
Here is a quickie for customizing and install Linux kernel 2.6.x on Squeeze.
Install some packages and kernel source:
$ sudo aptitude update
$ sudo aptitude install kernel-package bzip2 g++ libqt3-mt-dev libncurses5-dev sudo fakeroot
If you do not belong to group “src”, add yourself to the group as we work under /usr/src:
$ sudo adduser username src
You need to logout and login for this change to take effect. You also need to be able to use sudo or su to install the new kernel in the end.
The kernel packaged for Squeeze is at version 2.6.32. Alternatively a newer kernel could be obtained from kernel.org and saved to /usr/src. The customization procedure should be similar. Here I just follow the Debian way:
$ sudo aptitude install linux-source-2.6.32
Extract the source tree:
$ sudo chgrp -R src /usr/src
$ sudo chmod -R g+w /usr/src
$ cd /usr/src
$ rm linux
$ tar -jxf linux-source-2.6.32.tar.bz2
$ ln -s linux-source-2.6.32 linux
$ cd linux
Edit the EXTRAVERSION entry in Makefile, as in:
EXTRAVERSION = .20100321.1
for example to add .20100321.1 to the kernel version number. This is convenient for keeping the existing, working kernels around when you need to recompile with different options.
Use xconfig or menuconfig to customize the kernel options. Before the make-kpkg
lines, setting concurrency (most likely to the number of cores of my processor) is optinal but having a higher number typically reduces the compilation time.
$ make mrproper
$ make xconfig # or make menuconfig
$ export CONCURRENCY_LEVEL=4 # this is optional
$ fakeroot make-kpkg clean
$ fakeroot make-kpkg --initrd kernel_image
$ cd ..
$ sudo dpkg -i linux-image-2.6.32.20100321.1_2.6.32.20100321.1-10.00.Custom_amd64.deb
Upon reboot in the GRUB menu you will find the newly installed kernel:
$ sudo reboot
Purging Old Kernel Image from System
For example, if the kernel to be uninstalled is of version 2.6.26 and the extra version that I used was 20091112.1, do:
$ sudo dpkg -P linux-image-2.6.26.20091112.1
That’s it. However it is often a good idea to keep at least one kernel image that I know for sure to work so that when a custom kernel fails, I have something to fall back on. On the other hand, it is also a good idea to purge very old kernel images to save space in /boot.
Giving Kernel Boot Options with Grub (Version 2)
The new Grub has a slightly different way of specifying boot options (/boot/grub/menu.lst no longer exists for version 2!).
$ sudo chmod +w /boot/grub/grub.cfg
... open and edit /boot/grub/grub.cfg ...
$ sudo chmod -w /boot/grub/grub.cfg
If I need to provide a kernel with boot options, find the “menuentry” for the kernel, and change from
linux /vmlinuz-2.6.36.1.3 root=UUID=somehash ro quiet
to
linux /vmlinuz-2.6.36.1.3 root=UUID=somehash ro quiet usbcore.autosuspend=1
in order to set the usbcore.autosuspend option, for example.
Playing with CONCURRENCY_LEVEL
With Core i5 (2 cores but virtually 4 cores with hyperthreading), I get:
$ fakeroot make-kpkg clean
$ export CONCURRENCY_LEVEL=4
$ time fakeroot make-kpkg --initrd kernel_image
...
real 6m50.028s
user 21m45.186s
sys 2m42.246s
$ fakeroot make-kpkg clean
$ export CONCURRENCY_LEVEL=1
$ time fakeroot make-kpkg --initrd kernel_image
...
real 13m55.216s
user 13m23.638s
sys 1m50.359s
I say significant speed up!
What if Kernel Panics after Reboot?
(NOTE: This was true back when I was playing around when Squeeze was still far from stable. I don’t think this section is relevant as of November 2010, since Squeeze is very close to stable now. Just leaving the note in case for its archival value.)
Well, it turns out make-kpkg --initrd
does not automatically create a /boot/inird.img-* file for my current configuration. I wondered for a while why my new custom kernel keeps panicking upon reboot but finally realized that was the cause.
Fortunately, I can create the image myself easily:
$ sudo update-initramfs -c -k 2.6.32.20100321.1
$ sudo update-grub
This should work.
12 Responses to Customizing & Installing Linux Kernel on Debian Squeeze
Pingback: Installing Debian Squeeze (AMD64) on Lenovo T410s « Biboroku
Pingback: Installing Debian Squeeze on Dell XPS 630i « Biboroku
Pingback: USB 3.0 ExpressCard Adapter on Debian Squeeze | Biboroku
Thanks for posting. This helped me a lot.
Pingback: Debian Linux - Squeeze - Build audio driver snd-cs46xx
does this method create headers?
what should i do when sysnapsis wants to install a kernel that is older than the one I installed?
thanks for post,
jim
Jim — If you have problem reverting to the custom kernel, you can try reinstalling it. But usually at boot (with grub/lilo) you should continue to have an option to choose whatever kernel installed on your system.
My problem is: (and maybe it’s just ignorance)
How do I get synaptic to not want to install a kernel which
is older than the one I compiled and am using?
My present kernel is 2.6.38.6
Thanks
I personally don’t use Synaptic (just using apt-get or aptitude command-line), so if there’s any specific difference I don’t know how to go about it. If it’s a security update, I tend to apply all package updates including kernel related stuff (via aptitude update, upgrade, dist-upgrade sequence, for example).
Even after you do that, the custom kernel doesn’t get overwritten. The version you custom installed should continue to be available during the boot menu with grub or lilo. You just need to choose one, if not set as default. We actually have an option to keep kernel builds with different kernel options (after all customization is where Linux shines….). My older desktop still has 2.4.X kernel builds, and I sometimes run it when I have problems with the box….
If you really need to keep your package to an older version, there is a way to do it (with apt pinning and such), but I don’t know why you need to bother with it in the kernel updates. I can imagine a few instances in which conflicts between the custom kernel and prepackaged versions need to be resolved (e.g., building a kernel module against a source), but unless you have that type of problem, I don’t see why you wish to bother with not applying security updates and all.
Hi, so great, I have the same problem that initrd is not produced,
image is ok
I follow your guide, it actually works out. Thanks.
“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”‘
Well, it turns out make-kpkg –initrd does not automatically create a /boot/inird.img-* file for my current configuration. I wondered for a while why my new custom kernel keeps panicking upon reboot but finally realized that was the cause.
Fortunately, I can create the image myself easily:
$ sudo update-initramfs -c -k 2.6.32.20100321.1
$ sudo update-grub
“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”‘
BTW, wubi is the tool used to install Xubuntu.
The procedure is for Debian, so it may well be different for Ubuntu, yes…
Pingback: Setting up a Quantum LTO5 Tape Drive on Debian « Stream #0