Permalink
Browse files

Support building a spl-modules-dkms sub package

This commit adds support for building a spl-modules-dkms sub package
built around Dynamic Kernel Module Support. This is to allow building
packages using the DKMS infrastructure which is intended to ease the
burden of kernel version changes, upgrades, etc.

By default spl-modules-dkms-* sub package will be built as part of
the 'make rpm' target.  Alternately, you can build only the DKMS
module package using the 'make rpm-dkms' target.

Examples:

    # To build packaged binaries as well as a dkms packages
    $ ./configure && make rpm

    # To build only the packaged binary utilities and dkms packages
    $ ./configure && make rpm-utils rpm-dkms

Note: Only the RHEL 5/6, CHAOS 5, and Fedora distributions are
      supported for building the dkms sub package.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#535
  • Loading branch information...
1 parent 476ff5a commit d83d25c2f81b2f7771d338ae03ea184b9e7ac40f @prakashsurya prakashsurya committed with behlendorf Aug 7, 2012
Showing with 201 additions and 10 deletions.
  1. +1 −0 Makefile.am
  2. +34 −8 Makefile.in
  3. +26 −1 config/rpm.am
  4. +2 −1 configure
  5. +1 −0 configure.ac
  6. +23 −0 dkms.conf.in
  7. +24 −0 dkms.postinst
  8. +90 −0 spl-modules.spec.in
View
@@ -14,6 +14,7 @@ SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META DISCLAIMER
EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
+EXTRA_DIST += dkms.postinst
noinst_HEADERS = spl_config.h spl.release
distclean-local::
View
@@ -80,11 +80,12 @@ target_triplet = @target@
DIST_COMMON = $(am__configure_deps) $(noinst_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/PKGBUILD-spl-modules.in $(srcdir)/PKGBUILD-spl.in \
- $(srcdir)/spl-modules.spec.in $(srcdir)/spl.release.in \
- $(srcdir)/spl.spec.in $(srcdir)/spl_config.h.in \
- $(top_srcdir)/config/arch.am $(top_srcdir)/config/deb.am \
- $(top_srcdir)/config/rpm.am $(top_srcdir)/config/tgz.am \
- $(top_srcdir)/configure $(top_srcdir)/module/Makefile.in \
+ $(srcdir)/dkms.conf.in $(srcdir)/spl-modules.spec.in \
+ $(srcdir)/spl.release.in $(srcdir)/spl.spec.in \
+ $(srcdir)/spl_config.h.in $(top_srcdir)/config/arch.am \
+ $(top_srcdir)/config/deb.am $(top_srcdir)/config/rpm.am \
+ $(top_srcdir)/config/tgz.am $(top_srcdir)/configure \
+ $(top_srcdir)/module/Makefile.in \
$(top_srcdir)/module/spl/Makefile.in \
$(top_srcdir)/module/splat/Makefile.in AUTHORS COPYING \
ChangeLog INSTALL config/config.guess config/config.sub \
@@ -102,7 +103,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = spl_config.h
CONFIG_CLEAN_FILES = module/Makefile module/spl/Makefile \
module/splat/Makefile spl.spec spl-modules.spec PKGBUILD-spl \
- PKGBUILD-spl-modules spl.release
+ PKGBUILD-spl-modules spl.release dkms.conf
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
@@ -331,7 +332,7 @@ SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META \
DISCLAIMER config/config.awk config/rpm.am config/deb.am \
- config/tgz.am
+ config/tgz.am dkms.postinst
noinst_HEADERS = spl_config.h spl.release
all: spl_config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -404,6 +405,8 @@ PKGBUILD-spl-modules: $(top_builddir)/config.status $(srcdir)/PKGBUILD-spl-modul
cd $(top_builddir) && $(SHELL) ./config.status $@
spl.release: $(top_builddir)/config.status $(srcdir)/spl.release.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+dkms.conf: $(top_builddir)/config.status $(srcdir)/dkms.conf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
@@ -852,13 +855,16 @@ srpm-utils:
srpm: srpm-modules srpm-utils
+rpm-dkms: srpm-modules
+@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" dkms-common
+
rpm-modules: srpm-modules
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
rpm-utils: srpm-utils
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
-rpm: rpm-modules rpm-utils
+rpm: rpm-modules rpm-utils rpm-dkms
rpm-local:
@(if test "${HAVE_RPMBUILD}" = "no"; then \
@@ -877,6 +883,26 @@ rpm-local:
mkdir -p $(rpmbuild)/SOURCES && \
cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
+dkms-common:
+ rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
+ rpmspec=$(pkg).spec; \
+ rpmdkms=$(pkg)-dkms-$(SPL_META_VERSION)-$(SPL_META_RELEASE).noarch.rpm;\
+ rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ rpmbuild="$$rpmbuild" \
+ rpmspec="$$rpmspec" \
+ rpm-local || exit 1; \
+ $(RPMBUILD) \
+ --define "_tmppath $$rpmbuild/TMP" \
+ --define "_topdir $$rpmbuild" \
+ --define "dist %{nil}" \
+ --define "_without_kernel 1" \
+ --define "_without_kernel_debug 1" \
+ --define "_with_kernel_dkms 1" \
+ --nodeps --rebuild $$rpmpkg || exit 1; \
+ cp $$rpmbuild/RPMS/noarch/$$rpmdkms . || exit 1; \
+ $(RM) -R $$rpmbuild
+
srpm-common: dist
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
View
@@ -18,6 +18,11 @@ endif
srpm: srpm-modules srpm-utils
+rpm-dkms: srpm-modules
+if CONFIG_KERNEL
+ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" dkms-common
+endif
+
rpm-modules: srpm-modules
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
@@ -28,7 +33,7 @@ if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
endif
-rpm: rpm-modules rpm-utils
+rpm: rpm-modules rpm-utils rpm-dkms
rpm-local:
@(if test "${HAVE_RPMBUILD}" = "no"; then \
@@ -47,6 +52,26 @@ rpm-local:
mkdir -p $(rpmbuild)/SOURCES && \
cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
+dkms-common:
+ rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
+ rpmspec=$(pkg).spec; \
+ rpmdkms=$(pkg)-dkms-$(SPL_META_VERSION)-$(SPL_META_RELEASE).noarch.rpm;\
+ rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ rpmbuild="$$rpmbuild" \
+ rpmspec="$$rpmspec" \
+ rpm-local || exit 1; \
+ $(RPMBUILD) \
+ --define "_tmppath $$rpmbuild/TMP" \
+ --define "_topdir $$rpmbuild" \
+ --define "dist %{nil}" \
+ --define "_without_kernel 1" \
+ --define "_without_kernel_debug 1" \
+ --define "_with_kernel_dkms 1" \
+ --nodeps --rebuild $$rpmpkg || exit 1; \
+ cp $$rpmbuild/RPMS/noarch/$$rpmdkms . || exit 1; \
+ $(RM) -R $$rpmbuild
+
srpm-common: dist
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
View
@@ -24169,7 +24169,7 @@ fi
-ac_config_files="$ac_config_files Makefile lib/Makefile cmd/Makefile module/Makefile module/spl/Makefile module/splat/Makefile include/Makefile scripts/Makefile spl.spec spl-modules.spec PKGBUILD-spl PKGBUILD-spl-modules spl.release"
+ac_config_files="$ac_config_files Makefile lib/Makefile cmd/Makefile module/Makefile module/spl/Makefile module/splat/Makefile include/Makefile scripts/Makefile spl.spec spl-modules.spec PKGBUILD-spl PKGBUILD-spl-modules spl.release dkms.conf"
cat >confcache <<\_ACEOF
@@ -25091,6 +25091,7 @@ do
"PKGBUILD-spl") CONFIG_FILES="$CONFIG_FILES PKGBUILD-spl" ;;
"PKGBUILD-spl-modules") CONFIG_FILES="$CONFIG_FILES PKGBUILD-spl-modules" ;;
"spl.release") CONFIG_FILES="$CONFIG_FILES spl.release" ;;
+ "dkms.conf") CONFIG_FILES="$CONFIG_FILES dkms.conf" ;;
*) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
View
@@ -59,6 +59,7 @@ AC_CONFIG_FILES([
PKGBUILD-spl
PKGBUILD-spl-modules
spl.release
+ dkms.conf
])
AC_OUTPUT
View
@@ -0,0 +1,23 @@
+AUTOINSTALL="yes"
+PACKAGE_NAME="@PACKAGE@"
+PACKAGE_VERSION="@VERSION@"
+PRE_BUILD="configure
+ --prefix=/usr
+ --with-config=kernel
+ --with-linux=$(case `lsb_release -is` in
+ (Debian) echo ${kernel_source_dir/%build/source} ;;
+ (*) echo ${kernel_source_dir} ;;
+ esac)
+ --with-linux-obj=${kernel_source_dir}
+"
+POST_INSTALL="dkms.postinst -a ${arch} -k ${kernelver} -t ${dkms_tree}
+ -n ${PACKAGE_NAME} -v ${PACKAGE_VERSION}
+"
+REMAKE_INITRD="no"
+MAKE[0]="make"
+BUILT_MODULE_NAME[0]="spl"
+BUILT_MODULE_LOCATION[0]="module/spl/"
+DEST_MODULE_LOCATION[0]="/extra/spl/spl"
+BUILT_MODULE_NAME[1]="splat"
+BUILT_MODULE_LOCATION[1]="module/splat/"
+DEST_MODULE_LOCATION[1]="/extra/splat/splat"
View
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+PROG=$0
+
+while getopts "a:k:n:t:v:" opt; do
+ case $opt in
+ a) arch=$OPTARG ;;
+ k) kver=$OPTARG ;;
+ n) pkgname=$OPTARG ;;
+ t) tree=$OPTARG ;;
+ v) pkgver=$OPTARG ;;
+ esac
+done
+
+if [ -z "${arch}" -o -z "${kver}" -o -z "${pkgname}" -o \
+ -z "${tree}" -o -z "${pkgver}" ]; then
+ echo "Usage: $PROG -a <arch> -k <kver> -n <pkgname>" \
+ "-t <tree> -v <pkgver>"
+ exit 1
+fi
+
+cp ${tree}/${pkgname}/${pkgver}/build/spl_config.h \
+ ${tree}/${pkgname}/${pkgver}/build/module/Module.symvers \
+ ${tree}/${pkgname}/${pkgver}/${kver}/${arch}/
Oops, something went wrong.

0 comments on commit d83d25c

Please sign in to comment.