Whamcloud - gitweb
LU-17461 dkms: improve /etc/sysconfig/lustre
[fs/lustre-release.git] / debian / dkms.conf.in
1 # SPDX-License-Identifier: NOASSERTION
2
3 #
4 # Copyright 2012 Genome Research Ltd.
5 #           2017-2018 Universität Hamburg
6 #
7
8 #
9 # This file is part of Lustre, http://www.lustre.org/
10 #
11 # debian/dkms.conf.in
12 #
13 # Lustre Linux kernel module (DKMS)
14 #
15 # Created by Guy Coates
16 # Updated by Michael Kuhn
17 #
18
19 PACKAGE_NAME="lustre-client-modules"
20 PACKAGE_CONFIG="/etc/sysconfig/lustre"
21 PACKAGE_VERSION="@UPVERSION@"
22
23 OPTS=""
24 if [[ "x${PACKAGE_NAME}" = "xlustre-client-modules" ]] ; then
25     OPTS="${OPTS} --disable-server --disable-quilt"
26 fi
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"
30
31 if [[ -r ${PACKAGE_CONFIG} ]] ; then
32    source ${PACKAGE_CONFIG}
33    shopt -q -s extglob
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"
38    fi
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"
43    fi
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"
48    fi
49    if [[ -n ${LUSTRE_DKMS_ENABLE_GSS} ]] ; then
50       [[ ${LUSTRE_DKMS_ENABLE_GSS,,} == @(y|yes) ]] &&
51          OPTS="${OPTS} --enable-gss" || OPTS="${OPTS} --disable-gss"
52    fi
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"
57    fi
58    if [[ -n ${LUSTRE_DKMS_ENABLE_CRYPTO} ]] ; then
59       [[ ${LUSTRE_DKMS_ENABLE_CRYPTO,,} == @(y|yes) ]] &&
60          OPTS="${OPTS} --enable-crypto" || OPTS="${OPTS} --disable-crypto"
61    fi
62    [[ -n ${LUSTRE_DKMS_CONFIGURE_EXTRA} ]] &&
63        OPTS="${OPTS} ${LUSTRE_DKMS_CONFIGURE_EXTRA}"
64 fi
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"
68
69 AUTOGEN="sh ./autogen.sh"
70 CONFIGURE="./configure --with-linux=$kernel_source_dir"
71 CONFIGURE="${CONFIGURE} --with-linux-obj=$kernel_source_dir ${OPTS}"
72
73 # Note OPTS, AUTOGEN, CONFIGURE are not exposed to dkms parser
74
75 MAKE="${AUTOGEN} && ${CONFIGURE} && make"
76 CLEAN="make distclean || true"
77
78 NO_WEAK_MODULES="yes"
79 AUTOINSTALL="yes"
80 STRIP="no"
81
82 # Where modules are installed
83 kmoddir="updates/kernel"
84
85 module() {
86   built_name=$1
87   built_loc=$2
88   dest=$3
89   do_strip=$4
90
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}
96 }
97
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
102
103 # Determine which, if any, o2ib to install:
104 can_o2ib_mofed=no
105 can_o2ib_in_kernel=no
106 ext_mofed=no
107 int_mofed=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
118    can_o2ib_mofed=yes
119    ext_mofed=yes
120 else
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
134              can_o2ib_mofed=yes
135              ext_mofed=yes
136           fi
137       fi
138    fi
139 fi
140 [[ "x${ext_mofed}" = "xno" ]] && [[ x${can_o2ib_in_kernel} = "xyes" ]] &&
141    int_mofed=yes
142
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
147 fi
148
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
160
161 # Lustre optional gss module:
162 if echo "${OPTS} " | grep -E -q -- '--enable-gss[^-]' ; then
163     module ptlrpc_gss lustre/ptlrpc/gss fs/lustre
164 fi