2 # SPDX-License-Identifier: GPL-2.0
5 # This file is part of Lustre, http://www.lustre.org/
7 # lustre-dkms_pre-build.sh
9 # Script run before dkms build
14 # $2 : $module_version
16 # $4 : $kernel_source_dir
20 # $8 : $kmoddir [lustre-client either 'extra|updates']
24 SERVER="--disable-server --enable-client"
25 ksrc="$(dirname $4)/source"
26 KERNEL_STUFF="--with-linux=$(realpath $ksrc) --with-linux-obj=$(realpath $4)"
29 flavor=$(echo $3 | tr '-' '\n' | tail -1)
30 if [ -f /usr/src/kfabric/${flavor}/Module.symvers ]; then
31 KERNEL_STUFF="${KERNEL_STUFF} --with-kfi=/usr/src/kfabric/${flavor}"
32 elif [ -f /usr/src/kfabric/default/Module.symvers ]; then
33 KERNEL_STUFF="${KERNEL_STUFF} --with-kfi=/usr/src/kfabric/default"
36 if [ -d /usr/src/ofa_kernel/${flavor} ]; then
37 O2IBPATH=/usr/src/ofa_kernel/${flavor}
38 elif [ -d /usr/src/ofa_kernel/default ]; then
39 O2IBPATH=/usr/src/ofa_kernel/default
41 if [ -n ${O2IBPATH} ]; then
42 KERNEL_STUFF="${KERNEL_STUFF} --with-o2ib=${O2IBPATH}"
44 if [ -n ${kmoddir} ]; then
45 KERNEL_STUFF="${KERNEL_STUFF} --with-kmp-moddir=${kmoddir}/${name}"
50 lustre-zfs|lustre-all)
52 if [ "$1" == "lustre-zfs" ]; then
53 LDISKFS="--disable-ldiskfs"
56 # ZFS and SPL are version locked
57 ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 2>/dev/null |
58 sed -e 's:zfs/::g' -e 's:,.*::g' | cut -d: -f1 |
60 if [ -z $ZFS_VERSION ] ; then
61 echo "zfs-dkms package must already be installed and built under DKMS control"
65 SERVER="--enable-server $LDISKFS \
66 --with-linux=$4 --with-linux-obj=$4 \
67 --with-spl=$(realpath $7/spl/${ZFS_VERSION}/source) \
68 --with-spl-obj=$(realpath $7/spl/kernel-$3-$5) \
69 --with-zfs=$(realpath $7/zfs/${ZFS_VERSION}/source) \
70 --with-zfs-obj=$(realpath $7/zfs/kernel-$3-$5)"
72 KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
76 SERVER="--enable-server --without-zfs --without-spl \
77 --with-linux=$4 --with-linux-obj=$4"
79 KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
83 PACKAGE_CONFIG="/etc/sysconfig/lustre"
85 [[ -r ${PACKAGE_CONFIG} ]] \
86 && source ${PACKAGE_CONFIG} \
87 && shopt -q -s extglob \
90 if [[ -n ${LUSTRE_DKMS_DISABLE_CDEBUG} ]] ; then
91 [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]] &&
92 echo --disable-libcfs-cdebug ||
93 echo --enable-libcfs-cdebug
95 if [[ -n ${LUSTRE_DKMS_DISABLE_TRACE} ]] ; then
96 [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]] &&
97 echo --disable-libcfs-trace ||
98 echo --enable-libcfs-trace
100 if [[ -n ${LUSTRE_DKMS_DISABLE_ASSERT} ]] ; then
101 [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]] &&
102 echo --disable-libcfs-assert ||
103 echo --enable-libcfs-assert
105 if [[ -n ${LUSTRE_DKMS_ENABLE_GSS} ]] ; then
106 [[ ${LUSTRE_DKMS_ENABLE_GSS,,} == @(y|yes) ]] &&
110 if [[ -n ${LUSTRE_DKMS_ENABLE_GSS_KEYRING} ]] ; then
111 [[ ${LUSTRE_DKMS_ENABLE_GSS_KEYRING,,} == @(y|yes) ]] &&
112 echo --enable-gss-keyring ||
113 echo --disable-gss-keyring
115 if [[ -n ${LUSTRE_DKMS_ENABLE_CRYPTO} ]] ; then
116 [[ ${LUSTRE_DKMS_ENABLE_CRYPTO,,} == @(y|yes) ]] &&
117 echo --enable-crypto ||
118 echo --disable-crypto
120 if [[ -n ${LUSTRE_DKMS_ENABLE_IOKIT} ]] ; then
121 [[ ${LUSTRE_DKMS_ENABLE_IOKIT,,} == @(y|yes) ]] &&
122 echo --enable-iokit ||
125 [[ -n ${LUSTRE_DKMS_CONFIGURE_EXTRA} ]] &&
126 echo ${LUSTRE_DKMS_CONFIGURE_EXTRA}
130 echo "${DKMS_CONFIG_OPTS} " | grep -E -q -- '--disable-gss[^-]|--enable-gss[^-]'
131 if [ $? != 0 ] ; then
132 # User did not force, guess for rpm distros
133 rpm -qa | grep krb5-devel >/dev/null
134 [[ $? == 0 ]] && GSS="--enable-gss" || GSS="--disable-gss"
137 # run a configure pass to clean "--enable-dist" only effect and also to
138 # ensure local/on-target environment to be taken into account for
139 # dkms.mkconf script customizations and before next build/MAKE step
140 ./configure --prefix=/usr --enable-modules --disable-iokit \
141 --disable-doc --disable-utils --disable-tests --disable-maintainer-mode \
142 $KERNEL_STUFF $GSS $SERVER $DKMS_CONFIG_OPTS \
143 --disable-manpages --disable-mpitests
145 if [ $? != 0 ] ; then
146 echo "configure error, check $7/$1/$2/build/config.log"