Skip to content

Commit

Permalink
debian: Apply Ubuntu patch to add DKMS support.
Browse files Browse the repository at this point in the history
I tested that installing openvswitch-datapath-dkms worked OK on my own
Debian machine.

The bulk of this patch is taken from downstream Ubuntu DKMS support written
by Chuck Short <[email protected]>, version 1.2.0-1ubuntu1.  I made the
following changes:

  * Update debian/.gitignore.

  * Update debian/automake.mk.

  * Correct description in debian/control (it was a cut-and-paste from
    the openvswitch-datapath-source description without editing).

  * Fix up for --with-l26 to --with-linux and datapath/linux-2.6 to
    datapath/linux transitions.

CC: Chuck Short <[email protected]>
CC: Dave Walker <[email protected]>
Acked-by: Simon Horman <[email protected]>
  • Loading branch information
Chuck Short authored and blp committed Aug 25, 2011
1 parent 0027492 commit 49c57a8
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Andy Southgate [email protected]
Ben Pfaff [email protected]
Bryan Phillippe [email protected]
Casey Barker [email protected]
Chuck Short [email protected]
Dan Wendlandt [email protected]
David Erickson [email protected]
Ethan Jackson [email protected]
Expand Down
1 change: 1 addition & 0 deletions debian/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/openvswitch-common.copyright
/openvswitch-controller
/openvswitch-datapath-source
/openvswitch-datapath-dkms
/openvswitch-dbg
/openvswitch-ipsec
/openvswitch-pki
Expand Down
3 changes: 3 additions & 0 deletions debian/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ EXTRA_DIST += \
debian/control.modules.in \
debian/copyright \
debian/copyright.in \
debian/dkms.conf.in \
debian/dirs \
debian/openvswitch-brcompat.install \
debian/openvswitch-brcompat.manpages \
Expand All @@ -20,6 +21,8 @@ EXTRA_DIST += \
debian/openvswitch-controller.manpages \
debian/openvswitch-controller.postinst \
debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in \
debian/openvswitch-datapath-dkms.postinst \
debian/openvswitch-datapath-dkms.prerm \
debian/openvswitch-datapath-source.README.Debian \
debian/openvswitch-datapath-source.copyright \
debian/openvswitch-datapath-source.dirs \
Expand Down
10 changes: 9 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@ Package: openvswitch-datapath-source
Architecture: all
Depends: module-assistant, bzip2, debhelper (>= 5.0.37), ${misc:Depends}
Suggests: openvswitch-switch
Description: Source code for Open vSwitch datapath Linux module
Description: Open vSwitch datapath module source - module-assistant version
This package provides the Open vSwitch datapath module source code
that is needed by openvswitch-switch. The kernel module can be built
from it using module-assistant or make-kpkg. README.Debian in this
package provides further instructions.
.
Open vSwitch is a full-featured software-based Ethernet switch.

Package: openvswitch-datapath-dkms
Architecture: all
Depends: dkms (>= 1.95), make, ${misc:Depends}
Description: Open vSwitch datapath module source - DKMS version
This package provides the Open vSwitch datapath module source code
that is needed by openvswitch-switch. DKMS can built the kernel
module from it.

Package: openvswitch-common
Architecture: linux-any
Depends: ${shlibs:Depends}, openssl, ${misc:Depends}, python
Expand Down
9 changes: 9 additions & 0 deletions debian/dkms.conf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PACKAGE_NAME="openvswitch"
PACKAGE_VERSION="__VERSION__"
MAKE="./configure --with-linux=/usr/src/linux-headers-`uname -r` ; make -C datapath/linux"
BUILT_MODULE_NAME[0]=openvswitch_mod
BUILT_MODULE_NAME[1]=brcompat_mod
BUILT_MODULE_LOCATION[0]=datapath/linux/
BUILT_MODULE_LOCATION[1]=datapath/linux/
DEST_MODULE_LOCATION[0]=/kernel/drivers/net/openvswitch/
DEST_MODULE_LOCATION[1]=/kernel/drivers/net/openvswitch/
21 changes: 21 additions & 0 deletions debian/openvswitch-datapath-dkms.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -e

package=openvswitch-datapath-dkms
name=openvswitch

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#
15 changes: 15 additions & 0 deletions debian/openvswitch-datapath-dkms.prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -e

package=openvswitch-datapath-dkms
name=openvswitch

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
15 changes: 15 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
# Official build number. Leave set to 0 if not an official build.
BUILD_NUMBER = 0

PACKAGE=openvswitch
pdkms=openvswitch-datapath-dkms
DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
srcfiles := $(filter-out debian, $(wildcard * .[^.]*))

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
Expand Down Expand Up @@ -82,6 +87,16 @@ install-indep: build-indep
chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
cd debian/openvswitch-datapath-source/usr/src && tar -c modules | bzip2 -9 > openvswitch-datapath.tar.bz2 && rm -rf modules

#dkms stuff
# setup the dirs
dh_installdirs -p$(pdkms) usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)

# copy the source
cd debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION) && tar xvzf $(CURDIR)/_debian/openvswitch.tar.gz && mv openvswitch/* . && rmdir openvswitch

# Prepare dkms.conf from the dkms.conf.in template
sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf

install-arch: build-arch
dh_testdir
dh_testroot
Expand Down

0 comments on commit 49c57a8

Please sign in to comment.