How to properly compile a kernel?

Josef Wolf jw at raven.inka.de
Mon Jan 14 17:18:42 UTC 2008


Hello,

I am trying to compile the kernel on my Gutsy box by myself.  This is
what I tried so far:

   apt-get install linux-source kernel-package debianutils fakeroot \
                   libc6-dev libncurses5-dev gcc make
   cd /usr/src
   tar xjf linux-source-2.6.22.tar.bz2
   cd linux-source-2.6.22
   cp /boot/config-`uname -r` .config
   make oldconfig
   make prepare
   make-kpkg kernel_image kernel_headers --initrd \
             --append-to-version -mykernel \
             --revision myrev

This works so far, but it generates
linux-image-2.6.22.9-mykernel_myrev_i386 while the original kernel
was linux-image-2.6.22-14-generic_2.6.22-14.46_i386.  Notice the
differences in the version numbers?  Why is apt-get retrieving the
wrong version of the sources?  How do I get exactly the version which
was installed by apt?

A second problem is that not all of the modules are built.  I guess I
have to compile linux-ubuntu-modules-2.6.22_2.6.22-14.37 somehow.  But
this is yet another version number.  How do I know which version of
the modules sources belongs to a given kerne?  And how do I properly
compile the modules?

Any hints?




More information about the ubuntu-users mailing list