From f3da4933799f184b1a7ec55cf05145c06b127ae4 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Wed, 4 Apr 2018 09:15:27 +0800 Subject: [PATCH] RM-844 lbuild: add support for building kmod-lustre-o2ib-ofed With this patch, we will be able to build ofed and mlnx lustre RPMS at the same time. Introduce extra option --enable-o2ib_kernel to lbuild enable ofed RPMS, in default, it won't be built. This is a quick walkaround solution that we could support both MLNX and OFED KMOD RPMS, for the long term, we should handle this more gracefully Test-Parameters: trivial Change-Id: I581535d2e13b5d412a9b6e057294eb146f4ef086 Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/41875 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- config/lustre-build.m4 | 4 ++ lnet/autoconf/lustre-lnet.m4 | 15 ++++++ lustre.spec.in | 105 +++++++++++++++++++++++++++++++++++++- rpm/kmp-lustre-o2ib-mlnx.preamble | 1 + rpm/kmp-lustre-o2ib-ofed.files | 2 + rpm/kmp-lustre-o2ib-ofed.preamble | 18 +++++++ 6 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 rpm/kmp-lustre-o2ib-ofed.files create mode 100644 rpm/kmp-lustre-o2ib-ofed.preamble diff --git a/config/lustre-build.m4 b/config/lustre-build.m4 index 4d089bd..8ab2144 100644 --- a/config/lustre-build.m4 +++ b/config/lustre-build.m4 @@ -551,6 +551,7 @@ for arg; do --enable-utils | --disable-utils ) ;; --enable-iokit | --disable-iokit ) ;; --enable-manpages | --disable-manpages ) ;; + --enable-o2ib_kernel| --disable-o2ib_kernel ) ;; * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;; esac done @@ -619,6 +620,9 @@ fi if test x$enable_mpitests != xyes ; then RPMBINARGS="$RPMBINARGS --without mpi" fi +if test x$enable_o2ib_kernel = xyes ; then + RPMBINARGS="$RPMBINARGS --with ofed" +fi RPMBUILD_BINARY_ARGS=$RPMBINARGS diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index a9f05e3..625aa07 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -40,6 +40,20 @@ AC_DEFUN([LN_CONFIG_DLC], [ ]) # +# LN_CONFIG_O2IB_KERNEL +# +# check whether to enable kernel ofed RPMS +# +AC_DEFUN([LN_CONFIG_O2IB_KERNEL], [ +AC_MSG_CHECKING([whether to enable kernel ofed]) +AC_ARG_ENABLE([o2ib_kernel], + AC_HELP_STRING([--enable-o2ib_kernel=[yes|no]], + [enable ofed kernel]), + [], [enable_o2ib_kernel="no"]) +AC_MSG_RESULT([$enable_o2ib_kernel]) +]) # LN_CONFIG_O2IB_KERNEL + +# # LN_CONFIG_O2IB # # If current OFED installed (assume with "ofed_info") and devel @@ -845,6 +859,7 @@ AC_MSG_NOTICE([LNet kernel checks LN_CONFIG_BACKOFF LN_CONFIG_O2IB +LN_CONFIG_O2IB_KERNEL LN_CONFIG_GNILND # 3.10 LN_EXPORT_KMAP_TO_PAGE diff --git a/lustre.spec.in b/lustre.spec.in index 1c345d3..554734d 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -19,6 +19,7 @@ %bcond_without mpi %bcond_with kabi %bcond_without mlnx +%bcond_with ofed # By default both gss and gss keyring are disabled. # gss keyring requires the gss core. If the builder @@ -154,7 +155,7 @@ %endif %undefine with_mlnx -# check whether to enable mlnx +# check whether to enable mlnx or ofed %if "%{o2ibpath}" != "no" %if "%(grep mlnx %{o2ibpath}/Module.symvers >&/dev/null && echo yes)" == "yes" %define with_mlnx 1 @@ -202,6 +203,8 @@ Source6: kmp-lustre-osd-zfs.files Source7: kmp-lustre-tests.files Source8: kmp-lustre-o2ib-mlnx.preamble Source9: kmp-lustre-o2ib-mlnx.files +Source10: kmp-lustre-o2ib-ofed.preamble +Source11: kmp-lustre-o2ib-ofed.files URL: https://wiki.whamcloud.com/ BuildRoot: %{_tmppath}/lustre-%{version}-root %if %{with lustre_modules} @@ -290,6 +293,10 @@ echo $TMPFILE %kernel_module_package -n %{name}-o2ib-mlnx%{?mlnx_kabi_name:-%{mlnx_kabi_name}} -p %{SOURCE8} -f %{SOURCE9} default %endif +%if %{with ofed} +%kernel_module_package -n %{name}-o2ib-ofed -p %{SOURCE10} -f %{SOURCE11} default +%endif + %if %{with ldiskfs} %kernel_module_package -n %{name}-osd-ldiskfs -p %SOURCE3 -f %SOURCE4 %{_flavor} %if %{with lustre_utils} @@ -489,7 +496,7 @@ mv Makefile.in Makefile.in.in sed -i 's/\@INCLUDE_RULES\@//' Makefile.in.in # Make sure our config.h is included after the lustre's one (from Rules) cat >> Makefile.in.in <configure.ac <<\EOF +AC_PREREQ([2.57]) +AC_INIT([o2iblnd-ofed], [LUSTRE_VERSION.DDN_LUSTRE_VERSION.DDN_BUILD_TAG], [https://jira.hpdd.intel.com/], [lustre]) + +AC_CONFIG_AUX_DIR([../../../config]) +AC_CONFIG_MACRO_DIR([config]) + +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE([1.10 tar-ustar -Wno-portability]) +AM_MAINTAINER_MODE([enable]) + +AC_PROG_CC +LB_PROG_LINUX +LN_PROG_LINUX +LB_LINUX_PATH +LN_PATH_DEFAULTS +LN_CONDITIONALS + +LN_CONFIG_O2IB +AC_CONFIG_HEADERS([config.h]) +# Override specific vars from "main" config.h (pulled in by manually including Rules) +EXTRA_KCFLAGS="-include $PWD/undef.h -include $PWD/config.h $EXTRA_KCFLAGS" +AC_SUBST(EXTRA_KCFLAGS) +AC_SUBST(EXTRA_SYMBOLS) +AC_CONFIG_FILES([Makefile.in]) +AC_OUTPUT +EOF + +mv Makefile.in Makefile.in.in + +# Remove inclusion of main Rules file here, as it contains reference toModule.symvers from the +# kernel (with its IB symbols). That reference should go AFTER ofed one. +sed -i 's/\@INCLUDE_RULES\@//' Makefile.in.in +# Make sure our config.h is included after the lustre's one (from Rules) +cat >> Makefile.in.in <& lustre.symvers + # Also instruct kernel build system to use Module.symvers from a main lustre build + cat >> Makefile.in < Makefile + + make %{?_smp_mflags} -C %{kdir} modules M=$PWD + popd +%endif + %install %{?_openmpi_load} %{?_mpich_load} @@ -623,6 +716,14 @@ basemodpath=$RPM_BUILD_ROOT%{modules_fs_path}/%{name} popd %endif +%if %{with ofed} + cp lnet/klnds/o2iblnd/autoMakefile lnet/klnds/o2iblnd-ofed + pushd lnet/klnds/o2iblnd-ofed + make install DESTDIR=$RPM_BUILD_ROOT + mkdir -p $basemodpath-o2ib-ofed/net + mv $basemodpath/net/ko2iblnd.ko $basemodpath-o2ib-ofed/net/ko2iblnd.ko + popd +%endif %if %{with ldiskfs} mkdir -p $basemodpath-osd-ldiskfs/fs mv $basemodpath/fs/osd_ldiskfs.ko $basemodpath-osd-ldiskfs/fs/osd_ldiskfs.ko diff --git a/rpm/kmp-lustre-o2ib-mlnx.preamble b/rpm/kmp-lustre-o2ib-mlnx.preamble index f49c8cf..56fed5d 100644 --- a/rpm/kmp-lustre-o2ib-mlnx.preamble +++ b/rpm/kmp-lustre-o2ib-mlnx.preamble @@ -3,6 +3,7 @@ Requires: %{requires_kmod_name} = %{requires_kmod_version} Requires: kmod-%{name} = %{version} Provides: %{name}-o2ib-mlnx = %{version} Requires: kmod-mlnx-ofa_kernel +Conflicts: kmod-%{name}-o2ib-ofed # kmod-lustre should be already on-disk when post(un) scriptlet is run (which run depmod), yum may mess that up # See https://www.redhat.com/archives/rpm-list/2008-September/msg00022.html diff --git a/rpm/kmp-lustre-o2ib-ofed.files b/rpm/kmp-lustre-o2ib-ofed.files new file mode 100644 index 0000000..9b3071c --- /dev/null +++ b/rpm/kmp-lustre-o2ib-ofed.files @@ -0,0 +1,2 @@ +%defattr(-,root,root) +%{modules_fs_path}/%{lustre_name}-o2ib-ofed/net/ko2iblnd.ko diff --git a/rpm/kmp-lustre-o2ib-ofed.preamble b/rpm/kmp-lustre-o2ib-ofed.preamble new file mode 100644 index 0000000..1b39b1a --- /dev/null +++ b/rpm/kmp-lustre-o2ib-ofed.preamble @@ -0,0 +1,18 @@ +#Requires: kmod-lustre%{?kmod_kabi_name:-%{kmod_kabi_name}}${kmod_variant:+-${kmod_variant}} = %{version}-%{release} +Requires: %{requires_kmod_name} = %{requires_kmod_version} +Requires: kmod-%{name} = %{version} +Provides: %{name}-o2ib-ofed = %{version} +Conflicts: kmod-%{name}-o2ib-mlnx +#Requires: kmod-mlnx-ofa_kernel${reqdashvariant} + +# kmod-lustre should be already on-disk when post(un) scriptlet is run (which run depmod), yum may mess that up +# See https://www.redhat.com/archives/rpm-list/2008-September/msg00022.html +#Requires(post): kmod-lustre%{?kmod_kabi_name:-%{kmod_kabi_name}}${kmod_variant:+-${kmod_variant}} = %{version}-%{release} +#Provides: kmod-lustre${kmod_variant:+-${kmod_variant}}-o2ib-mlnx = %{version}-%{release} +#%if ! 0%{?_maint_release} +#Provides: kmod-lustre-latest${kmod_variant:+-${kmod_variant}}-o2ib-mlnx = %{version}-%{release} +#%endif +# Mellanox modules should be there too +#Requires: kmod-mlnx-ofa_kernel${reqdashvariant} +#Requires(post): kmod-mlnx-ofa_kernel${reqdashvariant} +#Conflicts: kmod-lustre%{?kmod_kabi_name:-%{kmod_kabi_name}}${kmod_variant:+-${kmod_variant}}-o2ib-mlnx -- 1.8.3.1