$kernelver in [PRE|POST]_BUILD etc (including patch)

Matt Domsch Matt_Domsch at dell.com
Fri Jun 25 13:09:11 CDT 2010

On Fri, Jun 25, 2010 at 05:56:28PM +0200, Christoph Mathys wrote:
> Hello!
> I'm doing a rather delicate package for some kernel modules with
> internal dependencies. I have decided to split the modules into
> several different dkms-packages, but this means I have to find some
> way to access "Modules.symvers". I've solved this by copying around
> the file so the dependent modules can find it and use it in their
> MODPOST 2. The copying is done by scripts run in the POST_BUILD and
> PRE_BUILD hooks of dkms. In order to copy Modules.symvers I need to
> know where dkms-source is located and for which kernel the module has
> been built (to reduce chances of accidentally using the wrong
> Module.symvers). I could not find a nice way of getting access to this
> information from inside the script, so I changed a few lines inside
> dkms (patch attached). Or is there another way of getting this
> information from inside the scripts without too much hassle
> (especially kernelver)?

The typical way this is done is to pass these values in as arguments
to your scripts called in the POST_BUILD and PRE_BUILD hooks.

PRE_BUILD="pre_build.sh $kernel_source_dir \
                        $dkms_tree/$module/$module_version/source \
                        $dkms_tree/$module/$module_version/build \

And in your script, reference these as argv values.

no exports needed. :-)


Matt Domsch
Technology Strategist
Dell | Office of the CTO

More information about the DKMS-devel mailing list