How to properly compile a kernel?

kenneth karlsen kkarls2 at broadpark.no
Mon Jan 14 18:43:30 UTC 2008


Josef Wolf wrote:
> 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?
>
>   
 From man make-kpkg:   make-kpkg [options] [target [target ...]]
not target options.
Skip also make prepare, I have never used it.
You want to read the section
--append_to_version foo, in man make-kpkg.
You can check in your source that the modules your are building are 
actually in your source, check --config menuconfig or --config xconfig 
in make-kpkg.
Regards Kenneth.




More information about the ubuntu-users mailing list