Skip to content

Commit

Permalink
xenserver: modify module spec file
Browse files Browse the repository at this point in the history
Based on feedback from Citrix about building for multiple kernels,
the spec file has been modified to take three arguments on the
command line: kernel_name, kernel_version and kernel_flavor.

The kernel_flavor is either xen or kdump. The kernel_name is the
Name value embedded in the kernel rpm and the kernel_version
is Version-Release values embedded in the kernel rpm. The
xen_version is calculated.

The INSTALL document has been updated to reflect these changes.

Signed-off-by: Sajjad Lateef <[email protected]>
(cherry picked from commit b11e4aa7e92854612a4d139b8a620d036a5d41a2)
  • Loading branch information
Sajjad Lateef committed May 17, 2011
1 parent 29d935d commit 9765870
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 13 deletions.
30 changes: 23 additions & 7 deletions INSTALL.XenServer
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,42 @@ Once you have a distribution tarball, copy it into
/usr/src/redhat/SOURCES inside the VM. Then execute the following:

VERSION=<Open vSwitch version>
XENKERNEL=<Xen kernel version>
KERNEL_NAME=<Xen Kernel name>
KERNEL_VERSION=<Xen Kernel version>
KERNEL_FLAVOR=<Xen Kernel flavor(suffix) >
cd /tmp
tar xfz /usr/src/redhat/SOURCES/openvswitch-$VERSION.tar.gz
rpmbuild \
-D "openvswitch_version $VERSION" \
-D "xen_version $XENKERNEL" \
-D "kernel_name $KERNEL_NAME" \
-D "kernel_version $KERNEL_VERSION" \
-D "kernel_flavor $KERNEL_FLAVOR" \
-bb openvswitch-$VERSION/xenserver/openvswitch-xen.spec

where:

<openvswitch version> is the version number that appears in the
name of the Open vSwitch tarball, e.g. 0.90.0.

<Xen kernel version> is the version number of the Xen kernel,
e.g. 2.6.32.12-0.7.1.xs5.6.100.307.170586xen. This version number
appears as the name of a directory in /lib/modules inside the VM.
It always ends in "xen".
<Xen Kernel name> is the name of the Xen Kernel,
e.g. kernel-xen or kernel-NAME-xen. By convention, the name
starts with "kernel-" and ends with "-xen".
This can be obtained by executing
'rpm -q --queryformat "%{Name}" kernel.*xen'
with the "kernel-" stripped out using sed 's/kernel-//'
e.g. kernel-NAME-xen => NAME-xen

<Xen Kernel version> is the output of:
rpm -q --queryformat "%{Version}-%{Release}" kernel.*xen-devel
e.g. 2.6.32.12-0.7.1.xs5.6.100.323.170596

<Xen Kernel flavor (suffix) > is either "xen" or "kdump".
The "xen" flavor is the main running kernel flavor and the "kdump" flavor is
the crashdump kernel flavor. Commonly, one would specify "xen" here.

Three RPMs will be output into /usr/src/redhat/RPMS/i386, whose names begin
with "openvswitch", "openvswitch-modules-xen", and "openvswitch-debuginfo".
with "openvswitch", "openvswitch-modules-xen" (if building for kernel_flavor=xen),
and "openvswitch-debuginfo".

Installing Open vSwitch for XenServer
-------------------------------------
Expand Down
18 changes: 12 additions & 6 deletions xenserver/openvswitch-xen.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@
# without warranty of any kind.

# When building, the rpmbuild command line should define
# openvswitch_version, xen_version, and build_number using -D arguments.
# openvswitch_version, kernel_name, kernel_version, kernel_flavor,
# and build_number using -D arguments.
# for example:
#
# rpmbuild -D "openvswitch_version 0.8.9~1+build123" -D "xen_version 2.6.18-128.1.1.el5.xs5.1.0.483.1000xen" -D "build_number --with-build-number=123" -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
# rpmbuild -D "openvswitch_version 1.1.0+build123"
# -D "kernel_name NAME-xen"
# -D "kernel_version 2.6.32.12-0.7.1.xs5.6.100.323.170596"
# -D "kernel_flavor xen"
# -D "build_number --with-build-number=123"
# -bb /usr/src/redhat/SPECS/openvswitch-xen.spec

%define version %{openvswitch_version}-%{xen_version}
%define xen_version %{kernel_version}%{kernel_flavor}

# bump this when breaking compatibility with userspace
%define module_abi_version 0
Expand All @@ -23,7 +29,7 @@
# kernel version string w/o kernel type
%define kernel_version %(echo '%{xen_version}' | sed -r 's/[a-z]+$//')
# build-supplemental-pack.sh requires this naming for kernel module packages
%define module_package modules%{binsuffix}-%{kernel_version}
%define module_package modules-%{kernel_flavor}-%{kernel_version}

Name: openvswitch
Summary: Open vSwitch daemon/database/utilities
Expand All @@ -47,8 +53,8 @@ traffic.
Summary: Open vSwitch kernel module
Group: System Environment/Kernel
License: GPLv2
Provides: %{name}-modules = %{kernel_version}, openvswitch_mod.ko.%{module_abi_version}
Requires: kernel%{binsuffix} = %{kernel_version}
Provides: %{name}-modules-%{kernel_flavor} = %{kernel_version}, openvswitch_mod.ko.%{module_abi_version}
Requires: kernel-%{kernel_name} = %{kernel_version}

%description %{module_package}
Open vSwitch Linux kernel module compiled against kernel version
Expand Down

0 comments on commit 9765870

Please sign in to comment.