summaryrefslogtreecommitdiff
path: root/rhel
diff options
context:
space:
mode:
authorAlex Wang <alexw@nicira.com>2015-06-28 16:31:16 -0700
committerAlex Wang <alexw@nicira.com>2015-07-01 08:34:57 -0700
commit5cdc4335e5f0bae5b09c734f710773020fa1b9ee (patch)
treeb86d201626cdb4d0db711a9345b835bc0b4d9619 /rhel
parent532e1463fcfb71738316a86420ae4fcb07b56ac3 (diff)
downloadopenvswitch-5cdc4335e5f0bae5b09c734f710773020fa1b9ee.tar.gz
rhel: Add dkms support for ovs datapath build.
This commit adds a rpmbuild spec file for building ovs datapath in dkms similar to the one for debian. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Flavio Leitner <fbl@sysclose.org>
Diffstat (limited to 'rhel')
-rw-r--r--rhel/.gitignore1
-rw-r--r--rhel/automake.mk5
-rw-r--r--rhel/openvswitch-dkms.spec.in100
3 files changed, 106 insertions, 0 deletions
diff --git a/rhel/.gitignore b/rhel/.gitignore
index fa2554fa5..164bb6671 100644
--- a/rhel/.gitignore
+++ b/rhel/.gitignore
@@ -1,3 +1,4 @@
+openvswitch-dkms.spec
openvswitch-kmod-rhel5.spec
openvswitch-kmod-rhel6.spec
openvswitch-kmod-fedora.spec
diff --git a/rhel/automake.mk b/rhel/automake.mk
index f6272a311..d26332589 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -12,6 +12,8 @@ EXTRA_DIST += \
rhel/etc_logrotate.d_openvswitch \
rhel/etc_sysconfig_network-scripts_ifdown-ovs \
rhel/etc_sysconfig_network-scripts_ifup-ovs \
+ rhel/openvswitch-dkms.spec \
+ rhel/openvswitch-dkms.spec.in \
rhel/openvswitch-kmod-rhel6.spec \
rhel/openvswitch-kmod-rhel6.spec.in \
rhel/openvswitch-kmod.files \
@@ -33,6 +35,9 @@ update_rhel_spec = \
< $(srcdir)/rhel/$(@F).in > $(@F).tmp || exit 1; \
if cmp -s $(@F).tmp $@; then touch $@; rm $(@F).tmp; else mv $(@F).tmp $@; fi
+$(srcdir)/rhel/openvswitch-dkms.spec: rhel/openvswitch-dkms.spec.in $(top_builddir)/config.status
+ $(update_rhel_spec)
+
$(srcdir)/rhel/openvswitch-kmod-rhel6.spec: rhel/openvswitch-kmod-rhel6.spec.in $(top_builddir)/config.status
$(update_rhel_spec)
diff --git a/rhel/openvswitch-dkms.spec.in b/rhel/openvswitch-dkms.spec.in
new file mode 100644
index 000000000..a47c038fd
--- /dev/null
+++ b/rhel/openvswitch-dkms.spec.in
@@ -0,0 +1,100 @@
+# Spec file for Open vSwitch kernel modules using DKMS.
+#
+# Copyright (C) 2015 Nicira, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without warranty of any kind.
+
+%define oname openvswitch
+
+Name: %{oname}-dkms
+Version: @VERSION@
+Release: 1%{?dist}
+Summary: Open vSwitch kernel module
+
+Group: System/Kernel
+License: GPLv2
+URL: http://openvswitch.org/
+Source: %{oname}-%{version}.tar.gz
+Requires: autoconf, gcc, make
+Requires(post): dkms
+Requires(preun): dkms
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+# Without this we get an empty openvswitch-debuginfo package (whose name
+# conflicts with the openvswitch-debuginfo package for OVS userspace).
+%undefine _enable_debug_packages
+
+
+%description
+Open vSwitch Linux kernel module.
+
+
+%prep
+%setup -n %{oname}-%{version}
+
+cat > %{oname}.conf << EOF
+override %{oname} * extra/%{oname}
+override %{oname} * weak-updates/%{oname}
+EOF
+
+
+%build
+# for running the '%{__make} -C datapath print-build-modules' below.
+./configure
+
+
+%install
+%{__rm} -rf %{buildroot}
+
+# Kernel module sources install for dkms
+%{__mkdir_p} %{buildroot}%{_usrsrc}/%{oname}-%{version}/
+%{__cp} -r * %{buildroot}%{_usrsrc}/%{oname}-%{version}/
+
+# check we can get kernel module names
+%{__make} -C datapath print-build-modules
+
+# Prepare dkms.conf
+cat > %{buildroot}%{_usrsrc}/%{oname}-%{version}/dkms.conf << EOF
+MODULES=( `%{__make} -C datapath print-build-modules | grep -v make` )
+
+PACKAGE_NAME="openvswitch"
+PACKAGE_VERSION="%{version}-%{release}"
+MAKE="./configure --with-linux='\${kernel_source_dir}' && make -C datapath/linux"
+for __idx in \${!MODULES[@]}; do
+ BUILT_MODULE_NAME[__idx]=\${MODULES[__idx]}
+ BUILT_MODULE_LOCATION[__idx]=datapath/linux/
+ DEST_MODULE_LOCATION[__idx]=/kernel/drivers/net/openvswitch/
+done
+AUTOINSTALL=yes
+EOF
+
+install -d %{buildroot}%{_sysconfdir}/depmod.d/
+install -m 644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/
+
+
+%post
+# Add to DKMS registry
+isadded=`dkms status -m "%{oname}" -v "%{version}"`
+if [ "x${isadded}" = "x" ] ; then
+ dkms add -m "%{oname}" -v "%{version}" || :
+fi
+dkms build -m "%{oname}" -v "%{version}" || :
+dkms install -m "%{oname}" -v "%{version}" --force || :
+
+
+%preun
+# Remove all versions from DKMS registry
+dkms remove -m "%{oname}" -v "%{version}" --all || :
+
+
+%clean
+%{__rm} -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root)
+%{_usrsrc}/%{oname}-%{version}/
+/etc/depmod.d/openvswitch.conf