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

Building Debian kernel modules with DKMS

Originally discussed:

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 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