Differences between revisions 1 and 2
Revision 1 as of 2009-11-24 20:40:42
Size: 1999
Editor: EvgeniGolov
Comment: first notes
Revision 2 as of 2009-11-24 21:29:57
Size: 2353
Editor: EvgeniGolov
Comment:
Deletions are marked like this. Additions are marked like this.
Line 16: Line 16:
BUILT_MODULE_NAME[0]="your_module" # only needed when your module name contains an underscore, but your name uses a hyphen
DEST_MODULE_LOCATION[0]=/extra # ignored by dkms, but you can't drop this line...
BUILT_MODULE_NAME[0]="your_module"
DEST_MODULE_LOCATION[0]=/extra
Line 20: Line 20:
 * You basically only have to change '''PACKAGE_NAME'''
 * '''BUILT_MODULE_NAME[#]''' is only needed when your module name differs from the '''PACKAGE_NAME''' (i.e. your_module vs, your-module) '''OR''' your package contains multiple modules
 * '''DEST_MODULE_LOCATION[#]''' is needed for every module you build, but will be ignored (dkms installs everything in '''/updates/dkms/''')
 * '''AUTOINSTALL=yes''' triggers an automated build when booting a new kernel, useful, but not required

Evgeni's private DKMS playground

Do not touch until I tell you to!

Prerequisites

  1. You need to create a new binary package your-module-dkms

  2. This package needs a Depends: dkms (>= 1.95)

dkms.conf(.in)

PACKAGE_NAME="your-module"
PACKAGE_VERSION="__VERSION__"
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"
AUTOINSTALL=yes
BUILT_MODULE_NAME[0]="your_module"
DEST_MODULE_LOCATION[0]=/extra
  • You basically only have to change PACKAGE_NAME

  • BUILT_MODULE_NAME[#] is only needed when your module name differs from the PACKAGE_NAME (i.e. your_module vs, your-module) OR your package contains multiple modules

  • DEST_MODULE_LOCATION[#] is needed for every module you build, but will be ignored (dkms installs everything in /updates/dkms/)

  • AUTOINSTALL=yes triggers an automated build when booting a new kernel, useful, but not required

rules

pdkms:=your-module-dkms
sname:=your-module
sversion:=$(shell dpkg-parsechangelog|grep "^Version:"|cut -d" " -f2|rev|cut -d- -f2-|rev|cut -d':' -f2)

install:
        dh_installdirs -p$(pdkms)  usr/src/$(sname)-$(sversion)
        cp -a CHANGES README Makefile *.c *.h debian/$(pdkms)/usr/src/$(sname)-$(sversion)
        sed "s/__VERSION__/$(sversion)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf

postinst

#!/bin/sh

set -e

package=your-module-dkms
name=your-module

version=`dpkg-query -W -f='${Version}' "$package" \
        |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`

isadded=`dkms status -m "$name" -v "$version"`

if [ "x${isadded}" = "x" ] ; then
        dkms add -m "$name" -v "$version"
fi

if [ "$1" = 'configure' ] ; then
        dkms build -m "$name" -v "$version"
        dkms install -m "$name" -v "$version" --force
fi

#DEBHELPER#

exit 0

prerm

#!/bin/sh

set -e

package=your-module-dkms
name=your-module

version=`dpkg-query -W -f='${Version}' "$package" \
        |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`

dkms remove -m "$name" -v "$version" --all || true

#DEBHELPER#

exit 0