Skip to content

Commit 46dd3e0

Browse files
committed
nvidia-peermem: Prefer ofa_kernel-dkms path for DOCA-OFED headers
Since DOCA 3.2.0, DKMS is the default OFED drivers' installation method. These store the headers in /usr/src/ofa_kernel-dkms/ and create symlinks from /usr/src/ofa_kernel/ for backward compatibility. Using the -dkms path directly is more robust as it contains the actual files, avoiding potential issues with symlinks that may be missing, broken, or not yet created during package installation. Add ofa_kernel-dkms as the highest-priority candidate, drop the /var/lib/dkms/mlnx-ofed-kernel/ fallback whose directory structure never matched the expected layout, and replace the shell for-loop with $(firstword $(wildcard ...)) to match the pattern used by OFED's own DKMS submodules. Signed-off-by: Leonid Bloch <lb.workbox@gmail.com>
1 parent 66b184c commit 46dd3e0

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

kernel-open/nvidia-peermem/nvidia-peermem.Kbuild

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,11 @@ else
4343
OFA_ARCH := $(ARCH)
4444
endif
4545
OFA_DIR := /usr/src/ofa_kernel
46-
OFA_CANDIDATES = $(OFA_DIR)/$(OFA_ARCH)/$(KERNELRELEASE) $(OFA_DIR)/$(KERNELRELEASE) $(OFA_DIR)/default /var/lib/dkms/mlnx-ofed-kernel
47-
MLNX_OFED_KERNEL := $(shell for d in $(OFA_CANDIDATES); do \
48-
if [ -d "$$d" ]; then \
49-
echo "$$d"; \
50-
exit 0; \
51-
fi; \
52-
done; \
53-
echo $(OFA_DIR) \
54-
)
46+
OFA_DKMS_DIR := $(OFA_DIR)-dkms
47+
OFA_CANDIDATES = $(OFA_DKMS_DIR)/$(OFA_ARCH)/$(KERNELRELEASE) $(OFA_DIR)/$(OFA_ARCH)/$(KERNELRELEASE) $(OFA_DIR)/$(KERNELRELEASE) $(OFA_DIR)/default
48+
MLNX_OFED_KERNEL := $(firstword $(wildcard $(OFA_CANDIDATES)))
5549

56-
ifneq ($(shell test -d $(MLNX_OFED_KERNEL) && echo "true" || echo "" ),)
50+
ifneq ($(MLNX_OFED_KERNEL),)
5751
NVIDIA_PEERMEM_CFLAGS += -I$(MLNX_OFED_KERNEL)/include -I$(MLNX_OFED_KERNEL)/include/rdma
5852
KBUILD_EXTRA_SYMBOLS := $(MLNX_OFED_KERNEL)/Module.symvers
5953
endif

0 commit comments

Comments
 (0)