which packages to install to compile kernel modules?

Robert P. J. Day rpjday at crashcourse.ca
Mon Jun 14 18:49:28 UTC 2010


On Mon, 14 Jun 2010, sktsee wrote:

> On Mon, 14 Jun 2010 13:26:49 -0400, Robert P. J. Day wrote:
>
> > i'm still feeling my way around ubuntu so what is/are the package(s) i
> > need to have installed in order to compile a simple kernel module? in
> > other words, what package(s) will give me the essential part of the
> > kernel source tree corresponding to the current kernel against which i
> > can compile that module?
> >
> >   a quick perusal suggests the package
> > linux-headers-2.6.32-22-generic, which provides the content under the
> > corresponding /usr/src directory.  is that it?
> >
>
> linux-headers-generic. This is a metapackage which always depends on
> the lastest version of the generic kernel headers available. It's
> part of the default installation. You also need the development
> tools depended upon by the build-essential metapackage. The
> build-essential packages are not installed by default, but they are
> included with the installation CD (live and alternate) so they can
> be installed offline. -- sktsee

  ok, so one more question (ok, two).  first, what's the command to
display the actual packages that a metapackage represents?

  and second, i can see on this system that there are two /usr/src
directories that correspond to my running kernel:

drwxr-xr-x 24 root root 4096 2010-06-05 09:04 linux-headers-2.6.32-22
drwxr-xr-x  7 root root 4096 2010-06-05 09:05 linux-headers-2.6.32-22-generic

  so what's the rationale behind having *two* /usr/src directories per
kernel?  (i come from a fedora background where there was only one.)

  does the "generic" suffix mean architecture independent?  what's the
distinguishing feature by which some headers are placed in one subdir
but not the other?  thanks.

rday

p.s.  i notice the symlink from the /lib/modules subdir looks like
this:

 build -> /usr/src/linux-headers-2.6.32-22-generic

which means that the latter would be the directory i would compile a
module against.  so i'm still unsure what that other directory is for.

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Top-notch, inexpensive online Linux/OSS/kernel courses:
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================




More information about the ubuntu-users mailing list