[Pkg-virtualbox-devel] Auto-building out-of-tree kernel modules

Ben Hutchings ben at decadent.org.uk
Sat Oct 17 17:34:20 UTC 2009

On Sat, 2009-10-17 at 18:32 +0200, Evgeni Golov wrote:
> Hi,
> On Sat, Oct 17, 2009 at 04:55:09PM +0100, Ben Hutchings wrote:
> > Due to bug #517130, linux-modules-extra-2.6 must be removed.
> > 
> > If you want to continue having modules auto-built, we recommend that you
> > consider integrating with DKMS.  You can trigger a build on installation
> > or upgrade of the module source.  The dkms package then automatically
> > rebuilds installed module sources when a new kernel version is
> > installed.
> > 
> > Why DKMS and not module-assistant?  Your packages presumably already
> > work with m-a, but m-a doesn't automatically rebuild modules on upgrade.
> > Also, DKMS is supported by other distributions, so many out-of-tree
> > module sources already include the necessary configuration file.
> That means the modules will be "auto-built" on users computers?


> Wasting time and bandwidth (fetching linux-headers etc)? Great...

Building obscure modules for every kernel flavour on Debian's own
auto-builders is also a waste, especially when just one broken module
breaks the whole conglomeration package.

> Are there any docs for how to add DKMS support in a Debian package? For 
> people who never touched DKMS before?

I don't think so, but the following should work:

1. Write a configuration file.  This is documented in the dkms manual
   page and there are examples in /usr/share/doc/dkms/examples .  A
   minimal configuration file would be:

      MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
      CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"

   Note: DEST_MODULE_LOCATION[0] is used only when the module replaces
   an in-tree module, so its value is not important for you, but you need
   to specify it anyway.

2. Add to your postinst:

      dkms add -m <name> -v <version>
      dkms build -m <name> -v <version> && dkms install -m <name> -v <version> || true

   The configuration file is assumed to be installed as
   /usr/src/<name>-<version>/dkms.conf and the source is assumed to be
   installed under /usr/src/<name>-<version>.  You must specify
   additional options to dkms add to override this.

3. Add to your prerm:

      dkms remove -m <name> -v <version> --all || true

(DKMS maintainers: it might be worth adding a dh_dkms to implement the
above, or whatever you think should be the canonical way of doing this.)

There is a mailing list for DKMS in Debian:
   pkg-dkms-maint at lists.alioth.debian.org


Ben Hutchings
It is impossible to make anything foolproof because fools are so ingenious.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-virtualbox-devel/attachments/20091017/30e1a102/attachment.pgp>

More information about the Pkg-virtualbox-devel mailing list