Differences between revisions 4 and 7 (spanning 3 versions)
Revision 4 as of 2009-11-24 21:31:49
Size: 2353
Editor: EvgeniGolov
Comment:
Revision 7 as of 2015-02-15 08:24:34
Size: 2323
Editor: PaulWise
Comment: use new --show-field option
Deletions are marked like this. Additions are marked like this.
Line 28: Line 28:
sversion:=$(shell dpkg-parsechangelog|grep "^Version:"|cut -d" " -f2|rev|cut -d- -f2-|rev|cut -d':' -f2) sversion:=$(shell dpkg-parsechangelog --show-field=Version|rev|cut -d- -f2-|rev)
Line 56: Line 56:
        dkms build -m "$name" -v "$version"
       dkms install -m "$name" -v "$version" --force
        dkms build -m "$name" -v "$version" && dkms install -m "$name" -v "$version" || true

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