Translation(s): English - Русский


Building Debian kernel modules with DKMS

Originally discussed: http://lists.debian.org/debian-kernel/2009/10/msg00683.html

Please improve these notes.The instructions need to be tested and verified.

Package Configuration

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

    PACKAGE_NAME=test
    PACKAGE_VERSION=0.1
    BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
    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"
    DEST_MODULE_LOCATION[0]=/extra
    REMAKE_INITRD=yes
    AUTOINSTALL=yes

    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

To-Do


CategoryKernel