Skip to content

Commit 49c57a8

Browse files
Chuck Shortblp
authored andcommitted
debian: Apply Ubuntu patch to add DKMS support.
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 <zulcss@ubuntu.com>, 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 <zulcss@ubuntu.com> CC: Dave Walker <DaveWalker@ubuntu.com> Acked-by: Simon Horman <horms@verge.net.au>
1 parent 0027492 commit 49c57a8

8 files changed

Lines changed: 74 additions & 1 deletion

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Andy Southgate andy.southgate@citrix.com
77
Ben Pfaff blp@nicira.com
88
Bryan Phillippe bp@toroki.com
99
Casey Barker crbarker@google.com
10+
Chuck Short zulcss@ubuntu.com
1011
Dan Wendlandt dan@nicira.com
1112
David Erickson derickso@stanford.edu
1213
Ethan Jackson ethan@nicira.com

debian/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/openvswitch-common.copyright
1212
/openvswitch-controller
1313
/openvswitch-datapath-source
14+
/openvswitch-datapath-dkms
1415
/openvswitch-dbg
1516
/openvswitch-ipsec
1617
/openvswitch-pki

debian/automake.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ EXTRA_DIST += \
55
debian/control.modules.in \
66
debian/copyright \
77
debian/copyright.in \
8+
debian/dkms.conf.in \
89
debian/dirs \
910
debian/openvswitch-brcompat.install \
1011
debian/openvswitch-brcompat.manpages \
@@ -20,6 +21,8 @@ EXTRA_DIST += \
2021
debian/openvswitch-controller.manpages \
2122
debian/openvswitch-controller.postinst \
2223
debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in \
24+
debian/openvswitch-datapath-dkms.postinst \
25+
debian/openvswitch-datapath-dkms.prerm \
2326
debian/openvswitch-datapath-source.README.Debian \
2427
debian/openvswitch-datapath-source.copyright \
2528
debian/openvswitch-datapath-source.dirs \

debian/control

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,22 @@ Package: openvswitch-datapath-source
1515
Architecture: all
1616
Depends: module-assistant, bzip2, debhelper (>= 5.0.37), ${misc:Depends}
1717
Suggests: openvswitch-switch
18-
Description: Source code for Open vSwitch datapath Linux module
18+
Description: Open vSwitch datapath module source - module-assistant version
1919
This package provides the Open vSwitch datapath module source code
2020
that is needed by openvswitch-switch. The kernel module can be built
2121
from it using module-assistant or make-kpkg. README.Debian in this
2222
package provides further instructions.
2323
.
2424
Open vSwitch is a full-featured software-based Ethernet switch.
2525

26+
Package: openvswitch-datapath-dkms
27+
Architecture: all
28+
Depends: dkms (>= 1.95), make, ${misc:Depends}
29+
Description: Open vSwitch datapath module source - DKMS version
30+
This package provides the Open vSwitch datapath module source code
31+
that is needed by openvswitch-switch. DKMS can built the kernel
32+
module from it.
33+
2634
Package: openvswitch-common
2735
Architecture: linux-any
2836
Depends: ${shlibs:Depends}, openssl, ${misc:Depends}, python

debian/dkms.conf.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
PACKAGE_NAME="openvswitch"
2+
PACKAGE_VERSION="__VERSION__"
3+
MAKE="./configure --with-linux=/usr/src/linux-headers-`uname -r` ; make -C datapath/linux"
4+
BUILT_MODULE_NAME[0]=openvswitch_mod
5+
BUILT_MODULE_NAME[1]=brcompat_mod
6+
BUILT_MODULE_LOCATION[0]=datapath/linux/
7+
BUILT_MODULE_LOCATION[1]=datapath/linux/
8+
DEST_MODULE_LOCATION[0]=/kernel/drivers/net/openvswitch/
9+
DEST_MODULE_LOCATION[1]=/kernel/drivers/net/openvswitch/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
package=openvswitch-datapath-dkms
6+
name=openvswitch
7+
8+
version=`dpkg-query -W -f='${Version}' "$package" \
9+
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`
10+
11+
isadded=`dkms status -m "$name" -v "$version"`
12+
13+
if [ "x${isadded}" = "x" ] ; then
14+
dkms add -m "$name" -v "$version"
15+
fi
16+
17+
if [ "$1" = 'configure' ] ; then
18+
dkms build -m "$name" -v "$version" && dkms install -m "$name" -v "$version" || true
19+
fi
20+
21+
#DEBHELPER#
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
package=openvswitch-datapath-dkms
6+
name=openvswitch
7+
8+
version=`dpkg-query -W -f='${Version}' "$package" \
9+
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`
10+
11+
dkms remove -m "$name" -v "$version" --all || true
12+
13+
#DEBHELPER#
14+
15+
exit 0

debian/rules

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
# Official build number. Leave set to 0 if not an official build.
1414
BUILD_NUMBER = 0
1515

16+
PACKAGE=openvswitch
17+
pdkms=openvswitch-datapath-dkms
18+
DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
19+
srcfiles := $(filter-out debian, $(wildcard * .[^.]*))
20+
1621
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
1722
PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
1823
else
@@ -82,6 +87,16 @@ install-indep: build-indep
8287
chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
8388
cd debian/openvswitch-datapath-source/usr/src && tar -c modules | bzip2 -9 > openvswitch-datapath.tar.bz2 && rm -rf modules
8489

90+
#dkms stuff
91+
# setup the dirs
92+
dh_installdirs -p$(pdkms) usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)
93+
94+
# copy the source
95+
cd debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION) && tar xvzf $(CURDIR)/_debian/openvswitch.tar.gz && mv openvswitch/* . && rmdir openvswitch
96+
97+
# Prepare dkms.conf from the dkms.conf.in template
98+
sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf
99+
85100
install-arch: build-arch
86101
dh_testdir
87102
dh_testroot

0 commit comments

Comments
 (0)