]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Add RHEL style kmod packages
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 25 Mar 2015 23:59:17 +0000 (16:59 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 27 Mar 2015 21:41:48 +0000 (14:41 -0700)
Provide a Redhat specific zfs-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 ZFS 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 <behlendorf1@llnl.gov>
config/zfs-build.m4
configure.ac
rpm/Makefile.am
rpm/redhat/.gitignore [new file with mode: 0644]
rpm/redhat/Makefile.am [new file with mode: 0644]
rpm/redhat/zfs-dkms.spec.in [new symlink]
rpm/redhat/zfs-kmod.spec.in [new file with mode: 0644]
rpm/redhat/zfs.spec.in [new symlink]

index 73ba979d10d135f1d5b7125c16f4407d44b4d820..8d3a373047ec7c2ef632e701ccf06e566f302c90 100644 (file)
@@ -151,7 +151,7 @@ AC_DEFUN([ZFS_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])
index 854af771c07673c0787066831e7a864aeaced1a7..63d0073e9a137c1cf60c80c8f5a4603062b80606 100644 (file)
@@ -134,6 +134,10 @@ AC_CONFIG_FILES([
        scripts/zpool-config/Makefile
        scripts/common.sh
        rpm/Makefile
+       rpm/redhat/Makefile
+       rpm/redhat/zfs.spec
+       rpm/redhat/zfs-kmod.spec
+       rpm/redhat/zfs-dkms.spec
        rpm/generic/Makefile
        rpm/generic/zfs.spec
        rpm/generic/zfs-kmod.spec
index b564eeefd9f4fd7f750b26c9c6c2a81378e1a791..f2cf72cef13ce964141811d9ba5fe472f46cc179 100644 (file)
@@ -1 +1 @@
-SUBDIRS = generic
+SUBDIRS = generic redhat
diff --git a/rpm/redhat/.gitignore b/rpm/redhat/.gitignore
new file mode 100644 (file)
index 0000000..7f5daaf
--- /dev/null
@@ -0,0 +1,3 @@
+/zfs-dkms.spec
+/zfs-kmod.spec
+/zfs.spec
diff --git a/rpm/redhat/Makefile.am b/rpm/redhat/Makefile.am
new file mode 100644 (file)
index 0000000..89b1364
--- /dev/null
@@ -0,0 +1 @@
+EXTRA_DIST = zfs.spec.in zfs-kmod.spec.in zfs-dkms.spec.in
diff --git a/rpm/redhat/zfs-dkms.spec.in b/rpm/redhat/zfs-dkms.spec.in
new file mode 120000 (symlink)
index 0000000..ffa051b
--- /dev/null
@@ -0,0 +1 @@
+../generic/zfs-dkms.spec.in
\ No newline at end of file
diff --git a/rpm/redhat/zfs-kmod.spec.in b/rpm/redhat/zfs-kmod.spec.in
new file mode 100644 (file)
index 0000000..ecc809b
--- /dev/null
@@ -0,0 +1,86 @@
+%bcond_with     debug
+%bcond_with     debug_dmu_tx
+
+Name:           @PACKAGE@-kmod
+Version:        @VERSION@
+Release:        @RELEASE@%{?dist}
+
+Summary:        Kernel module(s)
+Group:          System Environment/Kernel
+License:        @ZFS_META_LICENSE@
+URL:            http://zfsonlinux.org/
+BuildRequires:  %kernel_module_package_buildreqs
+BuildRequires:  kmod-spl-devel = %{version}
+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:       spl-kmod\n\
+Requires:       @PACKAGE@ = %{version}\n\
+Conflicts:      @PACKAGE@-dkms\n\n" > %{_sourcedir}/kmod-preamble)
+
+%description
+This package contains the ZFS kernel modules.
+
+%define kmod_name @PACKAGE@
+%define debug_package %{nil}
+
+%kernel_module_package -n %{kmod_name} -p %{_sourcedir}/kmod-preamble
+
+%define ksrc %{_usrsrc}/kernels/%{kverrel}
+%define kobj %{ksrc}
+%define splsrc %{_usrsrc}/spl-%{version}
+%define splobj %{splsrc}/%{kverrel}
+
+%package -n kmod-%{kmod_name}-devel
+Summary:        ZFS kernel module(s) devel common
+Group:          System Environment/Kernel
+Requires:       kmod-spl-devel = %{version}
+
+%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_dmu_tx}
+%define debug_dmu_tx --enable-debug-dmu-tx
+%else
+%define debug_dmu_tx --disable-debug-dmu-tx
+%endif
+
+%setup -n %{kmod_name}-%{version}
+%build
+%configure \
+        --with-config=kernel \
+        --with-linux=%{ksrc} \
+        --with-linux-obj=%{kobj} \
+        --with-spl="%{splsrc}" \
+        --with-spl-obj="%{splobj}" \
+        %{debug} \
+        %{debug_dmu_tx}
+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/zfs.spec.in b/rpm/redhat/zfs.spec.in
new file mode 120000 (symlink)
index 0000000..4c80791
--- /dev/null
@@ -0,0 +1 @@
+../generic/zfs.spec.in
\ No newline at end of file