Subject: Re: [vserver] How to build kernel modules for host?
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Wed, 24 Sep 2008 21:13:19 +0200

On Wed, Sep 24, 2008 at 12:00:18PM -0700, Roderick A. Anderson wrote:
> Herbert Poetzl wrote:
> >On Wed, Sep 24, 2008 at 10:47:20AM -0700, Roderick A. Anderson wrote:
> >>And if that question isn't ambiguous enough I don't know what would be.
> >>
> >>So here goes.  I need to build a kernel module that is need by software 
> >>to run in a guest.  Specifically the zaptel(ztdummy) module for Asterisk.
> >>
> >>The instructions I'm using (http://www.telephreak.org/papers/vpa/) are 
> >>based on a debian install so since I use CentOS so my-mileage-will-vary.
> >>
> >>When I've installed Asterisk on standalone systems I remember needing to 
> >>install the kernel sources/headers.  That was a full Asterisk install so 
> >>I'm not sure if to build only the zaptel driver I need them -- the 
> >>source/headers.
> >>
> >>To be on the safe side I'd like to go ahead and install them.
> >>
> >>So the questions are:
> >> * Is the kernel*src*.rpm from Daniel's repository enough?
> >
> >should be fine to build modules ..
> >actually a 'devel' package for the kernel should suffice
> 
> That sound much better.  I downloaded the the src RPM and did a rpmbuild 
> -bp to get tarball extracted and patches applied.  But now it is the 
> zaptel build that is giving me the fits.  It gives me:
> 
> You do not appear to have the sources for the 2.6.22.19-vs2.3.0.34.1 

nowadays out-of-kernel modules only need a
quite small set of headers to build against a
kernel, those are usually 'linked' from the 
/lib/modules/<kernel-version>/build link

check that this is pointing to your kernel's
devel tree ...

> kernel installed.  So far I've tried to softlink link
> 
> /usr/src/2.6.22.19-vs2.3.0.34.1 to /usr/src/redhat/BUILD/kernel-2.6.22

that doesn't look very useful :)

some older out-of-kernel modules require certain
kernel source files to 'modify' and/or reuse them,
thos would be looking for /usr/src/linux as link
to the full kernel source

> No joy.  So I'll keep at it unless someone can give me a cheap-trick 
> that will get the zaptel makefile look at the LV source directory.  I 
> see there are two below the one mentioned above which means I'm probably 
> pointing at the wrong one.

well, checking _where_ it looks for the kernel
source/devel package might sched some light on it

HTH,
Herbert

> Rod
> -- 
> >
> >> * Would the L-V patches cause any problems when building other 
> >>   kernel modules?
> >
> >depends on what interfaces the kernel module utilizes
> >most of the existing mainline interfaces are the same
> >than with mainline ekrnels nowadays
> >
> >> * Should I just install, via yum, the whole *-devel pile?
> >
> >as I said, the kernel-*-delev-* package should suffice
> >for building out of kernel modules
> >
> >HTH,
> >Herbert
> >
> >>Thanks for any help suggestions,
> >>Rod
> >>--