Evgeni's private DKMS playground
Do not touch until I tell you to!
Prerequisites
You need to create a new binary package your-module-dkms
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 --show-field=Version|rev|cut -d- -f2-|rev) 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" || true 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