From 06ba412f4ae34dd3d672efa2f5e9a752e3799ece Mon Sep 17 00:00:00 2001 From: Stephen Champion Date: Fri, 18 Oct 2013 15:02:45 -0700 Subject: [PATCH] LU-4124 build: make module installation directory flexible Add --with-kmp-moddir option to configure. Distributions vary in the installation directory for kernel modules. The RHEL standard installation directory is /lib/modules/$(uname -r)/extra while the SLES standard is /lib/modules/$(uname -r)/updates Adding the option --with-kmp-moddir option to configure allows users to select the appropriate installation target. With this change, it is neccessary to support both options in the test framework. Signed-off-by: Stephen Champion Signed-off-by: Dmitry Eremin Change-Id: Iec3137e0e5039dd43622c2e285030a5339fa6fd3 Reviewed-on: http://review.whamcloud.com/8065 Reviewed-by: James Simmons Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Oleg Drokin --- autoMakefile.am | 4 ++++ config/lustre-build-linux.m4 | 37 ++++++++++++++++++++++++------------- lustre.spec.in | 37 ++++++++++++++++++++++++++----------- lustre/tests/test-framework.sh | 1 + 4 files changed, 55 insertions(+), 24 deletions(-) diff --git a/autoMakefile.am b/autoMakefile.am index d45897a..768deeb 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -99,6 +99,7 @@ rpms: @PACKAGE_TARNAME@.spec dist Makefile for arg in $(ac_configure_args); do \ case $$arg in \ --with-release=* ) ;; \ + --with-kmp-moddir=* ) ;; \ --enable-tests | --disable-tests ) ;; \ --with-linux=* | --with-linux-obj=* ) ;; \ * ) CONFIGURE_ARGS="$$CONFIGURE_ARGS '$$arg'" ;; \ @@ -111,6 +112,9 @@ rpms: @PACKAGE_TARNAME@.spec dist Makefile RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \ fi; \ fi; \ + if [ -n "@KMP_MODDIR@" ]; then \ + RPMARGS="$$RPMARGS --define \"kmoddir @KMP_MODDIR@\""; \ + fi; \ if [ -n "@CROSS_PATH@" ]; then \ if [[ "X$(BUILD_SERVER)" = Xtrue ]]; then \ echo -e "\n" \ diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4 index a26759e..22833c5 100644 --- a/config/lustre-build-linux.m4 +++ b/config/lustre-build-linux.m4 @@ -83,27 +83,17 @@ AC_DEFUN([LB_LINUX_RELEASE], [ LB_LINUX_UTSRELEASE -moduledir='$(CROSS_PATH)/lib/modules/$(LINUXRELEASE)/updates/kernel' -AC_SUBST(moduledir) - -modulefsdir='$(moduledir)/fs/$(PACKAGE)' -AC_SUBST(modulefsdir) - -modulenetdir='$(moduledir)/net/$(PACKAGE)' -AC_SUBST(modulenetdir) - # ------------ RELEASE -------------------------------- AC_MSG_CHECKING([for Lustre release]) -AC_ARG_WITH([release],[ +AC_ARG_WITH([release], AC_HELP_STRING([--with-release=string], [set the release string (default=$kvers_YYYYMMDDhhmm)]), - [RELEASE=$withval], + [RELEASE=$withval],[ RELEASE="" if test -n "$DOWNSTREAM_RELEASE"; then RELEASE="${DOWNSTREAM_RELEASE}_" fi - RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID" -]) + RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID"]) AC_MSG_RESULT($RELEASE) AC_SUBST(RELEASE) @@ -121,6 +111,27 @@ AC_MSG_CHECKING([for RedHat kernel version]) AC_MSG_RESULT([not found]) LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[]) ]) + +AC_MSG_CHECKING([for kernel module package directory]) +AC_ARG_WITH([kmp-moddir], + AC_HELP_STRING([--with-kmp-moddir=string], + [set the kmod updates or extra directory]), + [KMP_MODDIR=$withval],[ + AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra"], + [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates"])]) + +AC_MSG_RESULT($KMP_MODDIR) +AC_SUBST(KMP_MODDIR) + +moduledir='$(CROSS_PATH)/lib/modules/$(LINUXRELEASE)/$(KMP_MODDIR)/kernel' +AC_SUBST(moduledir) + +modulefsdir='$(moduledir)/fs/$(PACKAGE)' +AC_SUBST(modulefsdir) + +modulenetdir='$(moduledir)/net/$(PACKAGE)' +AC_SUBST(modulenetdir) + ]) # LB_ARG_REPLACE_PATH(PACKAGE, PATH) diff --git a/lustre.spec.in b/lustre.spec.in index c6c7b34..4f5b05b 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -65,6 +65,18 @@ %endif %endif +%if %{undefined kmoddir} + %if %{defined kernel_module_package_moddir} + %global kmoddir %{kernel_module_package_moddir} + %else + %if %{defined suse_kernel_module_package} + %global kmoddir updates + %else + %global kmoddir extra + %endif + %endif +%endif + %if %{defined cross_path} && %{defined post_script} %define rpm_post_base %(echo $(dirname %{cross_path})/%{lustre_name}) %endif @@ -281,6 +293,9 @@ fi if [ -n "%kobjdir" ]; then CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//') fi +# remove --with-kmp-moddir from configure arguments, +# it will be set --with-kmp-moddir=%%kmoddir +CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-kmp-moddir=[^ ][^ ]* \?//') # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted # string in it which we don't want word splitted by the shell @@ -290,7 +305,7 @@ fi %eval_configure \ %{?kdir: --with-linux=%kdir} %{?kobjdir: --with-linux-obj=%kobjdir} \ - $CONFIGURE_ARGS + $CONFIGURE_ARGS --with-kmp-moddir=%{kmoddir} make -j $RPM_BUILD_NCPUS -s %{?make_args} %install @@ -375,7 +390,7 @@ fi echo '%{_libdir}/lustre/tests/*' >lustre-tests.files echo '%{_bindir}/mcreate' >>lustre-tests.files echo '%{_bindir}/munlink' >>lustre-tests.files -echo '%{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.ko' >>lustre-tests.files +echo '%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lustre-tests.files if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then echo '%{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files fi @@ -402,7 +417,7 @@ fi %endif %else # mark modules executable for find-debuginfo.sh -find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -type f | \ +find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/%{kmoddir} -name "*.ko" -type f | \ xargs --no-run-if-empty chmod u+x %endif @@ -411,16 +426,16 @@ find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -ty %files modules %defattr(-,root,root) -%{?rootdir}/lib/modules/%{kversion}/updates/* +%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/* %if %{with lustre_tests} -%exclude %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.ko +%exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko %endif %if %{with ldiskfs} -%exclude %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/ldiskfs.ko -%exclude %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko +%exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko +%exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko %endif %if %{with zfs} -%exclude %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko +%exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko %endif %if %{defined rpm_post_base} %attr(0555, root, root) %{rpm_post_base}-modules.sh @@ -432,8 +447,8 @@ find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -ty %if %{with ldiskfs} %files osd-ldiskfs %defattr(-,root,root) -%{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/ldiskfs.ko -%{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko +%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko +%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko %if %{defined rpm_post_base} %attr(0555, root, root) %{rpm_post_base}-osd-ldiskfs.sh %endif @@ -442,7 +457,7 @@ find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -ty %if %{with zfs} %files osd-zfs %defattr(-,root,root) -%{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko +%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko %if %{defined rpm_post_base} %attr(0555, root, root) %{rpm_post_base}-osd-zfs.sh %endif diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index a7dcc28..41f3095 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -303,6 +303,7 @@ init_test_env() { export I_MOUNTED=${I_MOUNTED:-"no"} if [ ! -f /lib/modules/$(uname -r)/kernel/fs/lustre/mdt.ko -a \ ! -f /lib/modules/$(uname -r)/updates/kernel/fs/lustre/mdt.ko -a \ + ! -f /lib/modules/$(uname -r)/extra/kernel/fs/lustre/mdt.ko -a \ ! -f $LUSTRE/mdt/mdt.ko ]; then export CLIENTMODSONLY=yes fi -- 1.8.3.1