Differences between revisions 3 and 5 (spanning 2 versions)
Revision 3 as of 2009-11-24 21:30:27
Size: 2353
Editor: EvgeniGolov
Comment:
Revision 5 as of 2009-11-24 22:06:19
Size: 2353
Editor: EvgeniGolov
Comment:
No differences found!

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