aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2015-03-27 14:23:27 -0700
committerBrian Behlendorf <[email protected]>2015-03-27 14:42:04 -0700
commitfade6b00b61e71f4332d274b9a5e0528764df5fb (patch)
treec5be9fa8694258eaae9b7924b282ef8d2992d30c
parent72998c2c9db99a7589cfd4696bd11042e262297d (diff)
Add RHEL style kmod packages
Provide a Redhat specific spl-kmod.spec file which uses the old style kmods (not kmods2) packaging. By using the provided kmodtool script packages can be built which support weak modules. This allows for the kernel to be updated without having to rebuild the SPL kernel modules. Packages for RHEL/Centos/SL/TOSS which use this spec file can by built as follows: $ ./configure --with-spec=redhat $ make rpms Signed-off-by: Brian Behlendorf <[email protected]>
-rw-r--r--config/spl-build.m42
-rw-r--r--configure.ac4
-rw-r--r--rpm/Makefile.am2
-rw-r--r--rpm/redhat/.gitignore3
-rw-r--r--rpm/redhat/Makefile.am1
l---------rpm/redhat/spl-dkms.spec.in1
-rw-r--r--rpm/redhat/spl-kmod.spec.in104
l---------rpm/redhat/spl.spec.in1
8 files changed, 116 insertions, 2 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4
index 058866dd6..3bfc1e232 100644
--- a/config/spl-build.m4
+++ b/config/spl-build.m4
@@ -229,7 +229,7 @@ AC_DEFUN([SPL_AC_RPM], [
RPM_SPEC_DIR="rpm/generic"
AC_ARG_WITH([spec],
AS_HELP_STRING([--with-spec=SPEC],
- [Spec files 'generic']),
+ [Spec files 'generic|redhat']),
[RPM_SPEC_DIR="rpm/$withval"])
AC_MSG_CHECKING([whether spec files are available])
diff --git a/configure.ac b/configure.ac
index 2aee70b71..efeb243cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,10 @@ AC_CONFIG_FILES([
include/vm/Makefile
scripts/Makefile
rpm/Makefile
+ rpm/redhat/Makefile
+ rpm/redhat/spl.spec
+ rpm/redhat/spl-kmod.spec
+ rpm/redhat/spl-dkms.spec
rpm/generic/Makefile
rpm/generic/spl.spec
rpm/generic/spl-kmod.spec
diff --git a/rpm/Makefile.am b/rpm/Makefile.am
index b564eeefd..f2cf72cef 100644
--- a/rpm/Makefile.am
+++ b/rpm/Makefile.am
@@ -1 +1 @@
-SUBDIRS = generic
+SUBDIRS = generic redhat
diff --git a/rpm/redhat/.gitignore b/rpm/redhat/.gitignore
new file mode 100644
index 000000000..67129ff14
--- /dev/null
+++ b/rpm/redhat/.gitignore
@@ -0,0 +1,3 @@
+/spl-dkms.spec
+/spl-kmod.spec
+/spl.spec
diff --git a/rpm/redhat/Makefile.am b/rpm/redhat/Makefile.am
new file mode 100644
index 000000000..da6c4abe2
--- /dev/null
+++ b/rpm/redhat/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = spl.spec.in spl-kmod.spec.in spl-dkms.spec.in
diff --git a/rpm/redhat/spl-dkms.spec.in b/rpm/redhat/spl-dkms.spec.in
new file mode 120000
index 000000000..900f524aa
--- /dev/null
+++ b/rpm/redhat/spl-dkms.spec.in
@@ -0,0 +1 @@
+../generic/spl-dkms.spec.in \ No newline at end of file
diff --git a/rpm/redhat/spl-kmod.spec.in b/rpm/redhat/spl-kmod.spec.in
new file mode 100644
index 000000000..393528597
--- /dev/null
+++ b/rpm/redhat/spl-kmod.spec.in
@@ -0,0 +1,104 @@
+%bcond_with debug
+%bcond_with debug_log
+%bcond_with debug_kmem
+%bcond_with debug_kmem_tracking
+%bcond_with atomic_spinlocks
+
+Name: @PACKAGE@-kmod
+Version: @VERSION@
+Release: @RELEASE@%{?dist}
+
+Summary: Kernel module(s)
+Group: System Environment/Kernel
+License: GPLv2+
+URL: http://zfsonlinux.org/
+BuildRequires: %kernel_module_package_buildreqs
+Source0: @PACKAGE@-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+# Additional dependency information for the kmod sub-package must be specified
+# by generating a preamble text file which kmodtool can append to the spec file.
+%(/bin/echo -e "\
+Requires: @PACKAGE@ = %{version}\n\
+Conflicts: @PACKAGE@-dkms\n\n" > %{_sourcedir}/kmod-preamble)
+
+%description
+This package contains the kernel modules required to emulate
+several interfaces provided by the Solaris kernel.
+
+%define kmod_name spl
+%define debug_package %{nil}
+
+%kernel_module_package -n %{kmod_name} -p %{_sourcedir}/kmod-preamble
+
+%define ksrc %{_usrsrc}/kernels/%{kverrel}
+%define kobj %{ksrc}
+
+%package -n kmod-%{kmod_name}-devel
+Summary: SPL kernel module(s) devel common
+Group: System Environment/Kernel
+
+%description -n kmod-%{kmod_name}-devel
+This package provides the header files and objects to build kernel modules
+which depend on the SPL kernel module.
+
+%prep
+if ! [ -d "%{ksrc}" ]; then
+ echo "Kernel build directory isn't set properly, cannot continue"
+ exit 1
+fi
+
+%if %{with debug}
+%define debug --enable-debug
+%else
+%define debug --disable-debug
+%endif
+
+%if %{with debug_log}
+%define debug_log --enable-debug-log
+%else
+%define debug_log --disable-debug-log
+%endif
+
+%if %{with debug_kmem}
+%define debug_kmem --enable-debug-kmem
+%else
+%define debug_kmem --disable-debug-kmem
+%endif
+
+%if %{with debug_kmem_tracking}
+%define debug_kmem_tracking --enable-debug-kmem-tracking
+%else
+%define debug_kmem_tracking --disable-debug-kmem-tracking
+%endif
+
+%if %{with atomic_spinlocks}
+%define atomic_spinlocks --enable-atomic-spinlocks
+%else
+%define atomic_spinlocks --disable-atomic-spinlocks
+%endif
+
+%setup -n %{kmod_name}-%{version}
+%build
+%configure \
+ --with-config=kernel \
+ --with-linux=%{ksrc} \
+ --with-linux-obj=%{kobj} \
+ %{debug} \
+ %{debug_log} \
+ %{debug_kmem} \
+ %{debug_kmem_tracking} \
+ %{atomic_spinlocks}
+make %{?_smp_mflags}
+
+%install
+make install \
+ DESTDIR=${RPM_BUILD_ROOT} \
+ INSTALL_MOD_DIR=extra/%{kmod_name}
+%{__rm} -f %{buildroot}/lib/modules/%{kverrel}/modules.*
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files -n kmod-%{kmod_name}-devel
+%{_usrsrc}/%{kmod_name}-%{version}
diff --git a/rpm/redhat/spl.spec.in b/rpm/redhat/spl.spec.in
new file mode 120000
index 000000000..d3276f013
--- /dev/null
+++ b/rpm/redhat/spl.spec.in
@@ -0,0 +1 @@
+../generic/spl.spec.in \ No newline at end of file