1 # SPDX-License-Identifier: NOASSERTION
4 # Copyright 2012 Genome Research Ltd.
5 # 2017-2018 Universität Hamburg
9 # This file is part of Lustre, http://www.lustre.org/
13 # Lustre Linux kernel module (DKMS)
15 # Created by Guy Coates
16 # Updated by Michael Kuhn
19 PACKAGE_NAME="lustre-client-modules"
20 PACKAGE_CONFIG="/etc/sysconfig/lustre"
21 PACKAGE_VERSION="@UPVERSION@"
24 if [[ "x${PACKAGE_NAME}" = "xlustre-client-modules" ]] ; then
25 OPTS="${OPTS} --disable-server --disable-quilt"
27 OPTS="${OPTS} --disable-dependency-tracking --disable-doc"
28 OPTS="${OPTS} --disable-utils --disable-iokit --disable-tests"
29 OPTS="${OPTS} --enable-quota --with-kmp-moddir=updates"
31 if [[ -r ${PACKAGE_CONFIG} ]] ; then
32 source ${PACKAGE_CONFIG}
34 if [[ -n ${LUSTRE_DKMS_DISABLE_CDEBUG} ]] ; then
35 [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]] &&
36 OPTS="${OPTS} --disable-libcfs-cdebug" ||
37 OPTS="${OPTS} --enable-libcfs-cdebug"
39 if [[ -n ${LUSTRE_DKMS_DISABLE_TRACE} ]] ; then
40 [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]] &&
41 OPTS="${OPTS} --disable-libcfs-trace" ||
42 OPTS="${OPTS} --enable-libcfs-trace"
44 if [[ -n ${LUSTRE_DKMS_DISABLE_ASSERT} ]] ; then
45 [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]] &&
46 OPTS="${OPTS} --disable-libcfs-assert" ||
47 OPTS="${OPTS} --enable-libcfs-assert"
49 if [[ -n ${LUSTRE_DKMS_ENABLE_GSS} ]] ; then
50 [[ ${LUSTRE_DKMS_ENABLE_GSS,,} == @(y|yes) ]] &&
51 OPTS="${OPTS} --enable-gss" || OPTS="${OPTS} --disable-gss"
53 if [[ -n ${LUSTRE_DKMS_ENABLE_GSS_KEYRING} ]] ; then
54 [[ ${LUSTRE_DKMS_ENABLE_GSS_KEYRING,,} == @(y|yes) ]] &&
55 OPTS="${OPTS} --enable-gss-keyring" ||
56 OPTS="${OPTS} --disable-gss-keyring"
58 if [[ -n ${LUSTRE_DKMS_ENABLE_CRYPTO} ]] ; then
59 [[ ${LUSTRE_DKMS_ENABLE_CRYPTO,,} == @(y|yes) ]] &&
60 OPTS="${OPTS} --enable-crypto" || OPTS="${OPTS} --disable-crypto"
62 [[ -n ${LUSTRE_DKMS_CONFIGURE_EXTRA} ]] &&
63 OPTS="${OPTS} ${LUSTRE_DKMS_CONFIGURE_EXTRA}"
65 echo "${OPTS} " | grep -E -q -- '--disable-gss[^-]|--enable-gss[^-]' ||
66 dpkg -l | grep libkrb5-dev | grep -q ^ii &&
67 OPTS="${OPTS} --enable-gss" || OPTS="${OPTS} --disable-gss"
69 AUTOGEN="sh ./autogen.sh"
70 CONFIGURE="./configure --with-linux=$kernel_source_dir"
71 CONFIGURE="${CONFIGURE} --with-linux-obj=$kernel_source_dir ${OPTS}"
73 # Note OPTS, AUTOGEN, CONFIGURE are not exposed to dkms parser
75 MAKE="${AUTOGEN} && ${CONFIGURE} && make"
76 CLEAN="make distclean || true"
82 # Where modules are installed
83 kmoddir="updates/kernel"
91 [[ -z $do_strip ]] && do_strip=${STRIP}
92 BUILT_MODULE_NAME[${#BUILT_MODULE_NAME[@]}]=${built_name}
93 BUILT_MODULE_LOCATION[${#BUILT_MODULE_LOCATION[@]}]=${built_loc}/
94 DEST_MODULE_LOCATION[${#DEST_MODULE_LOCATION[@]}]="/updates/kernel/${dest}/"
95 STRIP[${#STRIP[@]}]=${do_strip}
98 module libcfs libcfs/libcfs net/lustre
99 module lnet lnet/lnet net/lustre
100 module lnet_selftest lnet/selftest net/lustre
101 module ksocklnd lnet/klnds/socklnd net/lustre
103 # Determine which, if any, o2ib to install:
105 can_o2ib_in_kernel=no
108 [[ -f ${kernel_source_dir}/include/rdma/rdma_cm.h ]] &&
109 [[ -f ${kernel_source_dir}/include/rdma/ib_cm.h ]] &&
110 [[ -f ${kernel_source_dir}/include/rdma/ib_verbs.h ]] &&
111 can_o2ib_in_kernel=yes
112 # Now check if ext_o2ib is explicit, or will be auto-detected:
113 o2ib=$(echo ${OPTS} | tr ' ' '\\n' | grep -- '--with-o2ib=' | cut -c 13-)
114 if [[ "x$o2ib" = "xno" ]] ; then
115 can_o2ib_in_kernel=no
116 elif [[ -f $o2ib ]] ; then
117 # User specified path, if the build completes it will be ext_ofed
121 # could be either, ext_ofed will be preferred by default
122 if which ofed_info >/dev/null ; then
123 pkgs="mlnx-ofed-kernel-dkms|mlnx-ofed-kernel-modules|mlnx-ofa_kernel-devel"
124 pkgs="${pkgs}|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel"
125 paths=$(dpkg -l | awk '{print $2}' |
126 grep -E -w "${pkgs}" | xargs dpkg --listfiles 2>/dev/null |
127 grep -E '/ofa_kernel|/ofa_kernel/default|/openib' |
128 grep -v /ofed_scripts/ | head -n1)
129 if [[ -n "$paths" ]]; then
130 epaths=$(find $paths -name rdma_cm.h |
131 grep -F -e "$(uname -r)" -e default |
132 sed -e 's:/include/rdma/rdma_cm.h::')
133 if [ $(echo $epaths | wc -w) -eq 1 ]; then
140 [[ "x${ext_mofed}" = "xno" ]] && [[ x${can_o2ib_in_kernel} = "xyes" ]] &&
143 if [ "x${ext_mofed}" = "xyes" ] ; then
144 module ko2iblnd lnet/klnds/o2iblnd net/lustre
145 elif [ "x${int_mofed}" = "xyes" ] ; then
146 module ko2iblnd lnet/klnds/in-kernel-o2iblnd net/lustre
149 module fid lustre/fid fs/lustre
150 module fld lustre/fld fs/lustre
151 module lmv lustre/lmv fs/lustre
152 module lov lustre/lov fs/lustre
153 module lustre lustre/llite fs/lustre
154 module mdc lustre/mdc fs/lustre
155 module mgc lustre/mgc fs/lustre
156 module obdclass lustre/obdclass fs/lustre
157 module obdecho lustre/obdecho fs/lustre
158 module osc lustre/osc fs/lustre
159 module ptlrpc lustre/ptlrpc fs/lustre
161 # Lustre optional gss module:
162 if echo "${OPTS} " | grep -E -q -- '--enable-gss[^-]' ; then
163 module ptlrpc_gss lustre/ptlrpc/gss fs/lustre