From dkms the default $kernel_source_dir will be
@MODDIR@/$kernelver/build
unless otherwise specified with the --kernelsourcedir option.
Unfortunately the check for kernel headers will fail as only
the generated headers are available from the 'build' symbolic
link on SUSE.
Probe for the 'source' symbolic link if it points to a directory
with 'include/linux' proceed to prefer it when checking for
in-kernel rdma support.
HPE-bug-id: LUS-12710
Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I645acfa9f0cd6308fd5c234dc679c63f94172164
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57905
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Caleb Carlson <caleb.carlson@hpe.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
can_o2ib_in_kernel=no
ext_mofed=no
int_mofed=no
-[[ -f \${kernel_source_dir}/include/rdma/rdma_cm.h ]] &&
-[[ -f \${kernel_source_dir}/include/rdma/ib_cm.h ]] &&
-[[ -f \${kernel_source_dir}/include/rdma/ib_verbs.h ]] &&
+ksrc=\$(dirname \${kernel_source_dir})/source
+[[ -d \$ksrc/include/linux ]] || ksrc=\${kernel_source_dir}
+[[ -f \${ksrc}/include/rdma/rdma_cm.h ]] &&
+[[ -f \${ksrc}/include/rdma/ib_cm.h ]] &&
+[[ -f \${ksrc}/include/rdma/ib_verbs.h ]] &&
can_o2ib_in_kernel=yes
# Now check if ext_o2ib is explicit, or will be auto-detected:
o2ib=\$(echo \${OPTS} | tr ' ' '\\n' | grep -- '--with-o2ib=' | cut -c 13-)