Whamcloud - gitweb
LU-4124 build: make module installation directory flexible 15/8315/4
authorStephen Champion <schamp@sgi.com>
Fri, 18 Oct 2013 22:02:45 +0000 (15:02 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 4 Feb 2014 03:31:14 +0000 (03:31 +0000)
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 <schamp@sgi.com>
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: http://review.whamcloud.com/8065
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Change-Id: Iec3137e0e5039dd43622c2e285030a5339fa6fd3
Reviewed-on: http://review.whamcloud.com/8315
Reviewed-by: Christopher J. Morrone <chris.morrone.llnl@gmail.com>
autoMakefile.am
config/lustre-build-linux.m4
lustre.spec.in
lustre/tests/test-framework.sh

index d45897a..768deeb 100644 (file)
@@ -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" \
index 49f06bd..3104a4b 100644 (file)
@@ -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)
index 8d2ccd0..3f2121b 100644 (file)
     %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
@@ -294,6 +306,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
@@ -303,7 +318,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
@@ -314,9 +329,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
 # hack to include the llog_test module in lustre-tests
 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
 if [ -e ${llog_base}.ko ]; then
-  cp ${llog_base}.ko $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre
+  cp ${llog_base}.ko $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/lustre
 elif [ -e ${llog_base}.o ]; then
-  cp ${llog_base}.o $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre
+  cp ${llog_base}.o $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/lustre
 fi
 
 # The .ha_v2 extension identifies the heartbeat resource agent as using
@@ -343,8 +358,6 @@ cat >lustre.files <<EOF
 %attr(-, root, root) %{_bindir}/llobdstat
 %attr(-, root, root) %{_bindir}/llstat
 %attr(-, root, root) %{_bindir}/lustre_req_history
-%attr(-, root, root) %{_bindir}/mcreate
-%attr(-, root, root) %{_bindir}/munlink
 %attr(-, root, root) %{_bindir}/plot-llstat
 %attr(-, root, root) %{_bindir}/req_layout
 %attr(-, root, root) %{_libdir}/libptlctl.a
@@ -396,7 +409,9 @@ fi
 
 %if %{with lustre_tests}
 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
-echo '%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
+echo '%attr(-, root, root) %{_bindir}/mcreate' >>lustre-tests.files
+echo '%attr(-, root, root) %{_bindir}/munlink' >>lustre-tests.files
+echo '%attr(-, root, root) %{?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 '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
 fi
@@ -423,24 +438,24 @@ 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
 
 %files -f lustre.files
 
 %files modules
-%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/*
+%attr(-, root, root) %{?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/fsfilt_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@/fsfilt_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
@@ -451,9 +466,9 @@ find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -ty
 
 %if %{with ldiskfs}
 %files osd-ldiskfs
-%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/ldiskfs.ko
-%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/fsfilt_ldiskfs.ko
-%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
+%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko
+%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/fsfilt_ldiskfs.ko
+%attr(-, root, root) %{?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
@@ -461,7 +476,7 @@ find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -ty
 
 %if %{with zfs}
 %files osd-zfs
-%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
+%attr(-, root, root) %{?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
index 24057df..2c17cee 100644 (file)
@@ -291,11 +291,12 @@ init_test_env() {
     export RLUSTRE=${RLUSTRE:-$LUSTRE}
     export RPWD=${RPWD:-$PWD}
     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 `dirname $0`/../mdt/mdt.ko ]; then
-        export CLIENTMODSONLY=yes
-    fi
+       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
 
     export SHUTDOWN_ATTEMPTS=${SHUTDOWN_ATTEMPTS:-3}
        export OSD_TRACK_DECLARES_LBUG=${OSD_TRACK_DECLARES_LBUG:-"yes"}