isert: Support building against MOFED without patching the kernel build system

Additionally, print OFED flavor name while building and embed the
OFED flavor name in the module description.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@6139 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Yan Burman
2015-03-03 11:25:37 +00:00
parent ed3a17ca7a
commit 025574018e
5 changed files with 8 additions and 15 deletions
+4 -3
View File
@@ -54,9 +54,9 @@ all: include/iscsi_scst_itf_ver.h progs mods
ISER_SYMVERS:=$(KMOD)/Module.symvers ISER_SYMVERS:=$(KMOD)/Module.symvers
OFED_CFLAGS:= OFED_CFLAGS:=
MLNX_OFED:=$(shell if ofed_info -s | grep MLNX >/dev/null 2>/dev/null; then echo true; else echo false; fi) OFED_FLAVOR=$(shell if [ -e /usr/bin/ofed_info ]; then /usr/bin/ofed_info 2>/dev/null | head -n1 | sed -n 's/^\(MLNX_OFED\|OFED-internal\).*/MOFED/p;s/^OFED-.*/OFED/p'; else echo in-tree; fi)
ifeq ($(MLNX_OFED),true) ifeq ($(OFED_FLAVOR),MOFED)
# Whether MLNX_OFED for ubuntu has been installed # Whether MLNX_OFED for ubuntu has been installed
MLNX_OFED_IB_UBUNTU_INSTALLED:=$(shell if dpkg -s mlnx-ofed-kernel-dkms >/dev/null 2>/dev/null; then echo true; else echo false; fi) MLNX_OFED_IB_UBUNTU_INSTALLED:=$(shell if dpkg -s mlnx-ofed-kernel-dkms >/dev/null 2>/dev/null; then echo true; else echo false; fi)
@@ -100,8 +100,9 @@ else
endif endif
mods: Modules.symvers Module.symvers mods: Modules.symvers Module.symvers
echo " Building against $(OFED_FLAVOR) InfiniBand kernel headers."
$(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) modules $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) modules
$(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(ISERTMOD) PRE_CFLAGS="$(OFED_CFLAGS)" KBUILD_EXTRA_SYMBOLS=$(ISER_SYMVERS) modules $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(ISERTMOD) PRE_CFLAGS="$(OFED_CFLAGS) -DOFED_FLAVOR=$(OFED_FLAVOR)" KBUILD_EXTRA_SYMBOLS=$(ISER_SYMVERS) modules
progs: progs:
$(MAKE) -C usr SCST_INC_DIR=$(SCST_INC_DIR) $(MAKE) -C usr SCST_INC_DIR=$(SCST_INC_DIR)
+1 -1
View File
@@ -38,7 +38,7 @@ Troubleshooting:
The cause of this is often compilation issues if you have OFED or MLNX_OFED installed: The cause of this is often compilation issues if you have OFED or MLNX_OFED installed:
If you are compiling for OFED/MLNX_OFED, make sure OFED is installed for If you are compiling for OFED/MLNX_OFED, make sure OFED is installed for
the kernel you are running. Also, make sure you followed ALL steps described the kernel you are running. Also, make sure you followed ALL steps described
in README.iser_ofed including patching the kernel. in README.iser_ofed.
If you are compiling for non-OFED kernel, make sure you don't have If you are compiling for non-OFED kernel, make sure you don't have
OFED/MLNX_OFED installed. OFED/MLNX_OFED installed.
-10
View File
@@ -58,16 +58,6 @@ Remove any distro-provided InfiniBand drivers:
rm -rf /lib/modules/$(uname -r)/kernel/drivers/infiniband rm -rf /lib/modules/$(uname -r)/kernel/drivers/infiniband
rm -rf /lib/modules/$(uname -r)/kernel/drivers/net/mlx4 rm -rf /lib/modules/$(uname -r)/kernel/drivers/net/mlx4
Now locate the file Makefile.lib and patch it such that it supports
the variable PRE_CFLAGS:
if [ -e /lib/modules/$(uname -r)/build/scripts/Makefile.lib ]; then
cd /lib/modules/$(uname -r)/build
else
cd /usr/src/linux-$(uname -r)
fi
patch -p1 < ${SCST_DIR}/srpt/patches/kernel-${KV}-pre-cflags.patch
Next, download and install an OFED pacakge. Next, download and install an OFED pacakge.
For MLNX_OFED, just run the mlnxofedinstall script inside the MLNX_OFED directory. For MLNX_OFED, just run the mlnxofedinstall script inside the MLNX_OFED directory.
+1
View File
@@ -24,6 +24,7 @@ cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
enable-Wextra = $(shell uname_r="$$(uname -r)"; if [ "$${uname_r%.el5}" = "$${uname_r}" ]; then echo "$(1)"; fi) enable-Wextra = $(shell uname_r="$$(uname -r)"; if [ "$${uname_r%.el5}" = "$${uname_r}" ]; then echo "$(1)"; fi)
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
EXTRA_CFLAGS += -I$(src)/../../include -I$(src)/../ -I$(SCST_INC_DIR) EXTRA_CFLAGS += -I$(src)/../../include -I$(src)/../ -I$(SCST_INC_DIR)
EXTRA_CFLAGS += $(call enable-Wextra,-Wextra \ EXTRA_CFLAGS += $(call enable-Wextra,-Wextra \
$(call cc-option,-Wno-old-style-declaration) \ $(call cc-option,-Wno-old-style-declaration) \
+2 -1
View File
@@ -492,7 +492,8 @@ out:
MODULE_AUTHOR("Yan Burman"); MODULE_AUTHOR("Yan Burman");
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("iSER target transport driver"); MODULE_DESCRIPTION("iSER target transport driver v3.0.1-pre#"
__stringify(OFED_FLAVOR));
module_init(isert_init_module); module_init(isert_init_module);
module_exit(isert_cleanup_module); module_exit(isert_cleanup_module);