This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
205 lines (180 loc) · 7.63 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
PHONY += all kernel install_kernel install clean clean_kernel
all:
.PHONY: $(PHONY)
.DELETE_ON_ERROR:
include ./configure.mk.kernel
export COMPAT_CONFIG=$(CWD)/compat.config
export COMPAT_AUTOCONF=$(CWD)/include/linux/compat_autoconf.h
export KLIB_BUILD
export KVERSION
export MAKE
-include $(COMPAT_CONFIG)
export CREL=$(shell cat $(CWD)/compat_version)
export CREL_PRE:=.compat_autoconf_
export CREL_CHECK:=$(CREL_PRE)$(CREL)
CFLAGS += \
-DCOMPAT_BASE="\"$(shell cat compat_base)\"" \
-DCOMPAT_BASE_TREE="\"$(shell cat compat_base_tree)\"" \
-DCOMPAT_BASE_TREE_VERSION="\"$(shell cat compat_base_tree_version)\"" \
-DCOMPAT_PROJECT="\"Compat-rdma\"" \
-DCOMPAT_VERSION="\"$(shell cat compat_version)\"" \
DEPMOD = /sbin/depmod
INSTALL_MOD_DIR ?= $(shell test -f /etc/redhat-release && echo extra/ofa_kernel || echo updates)
ifeq ($(CONFIG_MEMTRACK),m)
export KERNEL_MEMTRACK_CFLAGS = -include $(CWD)/drivers/infiniband/debug/mtrack.h
else
export KERNEL_MEMTRACK_CFLAGS =
endif
export OPEN_ISCSI_MODULES = iscsi_tcp.ko libiscsi.ko scsi_transport_iscsi.ko
$(COMPAT_AUTOCONF): $(COMPAT_CONFIG)
+@$(CWD)/ofed_scripts/gen-compat-autoconf.sh $(COMPAT_CONFIG) > $(COMPAT_AUTOCONF)
$(COMPAT_CONFIG):
+@$(CWD)/ofed_scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
configure.mk.kernel:
@echo Please run ./configure
@exit 1
all: kernel
install: install_kernel
install_kernel: install_modules
autoconf_h=$(shell /bin/ls -1 $(KSRC_OBJ)/include/*/autoconf.h 2> /dev/null | head -1)
kconfig_h=$(shell /bin/ls -1 $(KSRC)/include/*/kconfig.h 2> /dev/null | head -1)
ifneq ($(kconfig_h),)
KCONFIG_H = -include $(kconfig_h)
endif
V ?= 0
#########################
# make kernel #
#########################
#NB: The LINUXINCLUDE value comes from main kernel Makefile
# with local directories prepended. This eventually affects
# CPPFLAGS in the kernel Makefile
kernel: $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
@echo "Building kernel modules"
@echo "Kernel version: $(KVERSION)"
@echo "Modules directory: $(INSTALL_MOD_PATH)/$(MODULES_DIR)"
@echo "Kernel sources: $(KSRC_OBJ)"
env CWD=$(CWD) BACKPORT_INCLUDES=$(BACKPORT_INCLUDES) \
$(MAKE) -C $(KSRC_OBJ) SUBDIRS="$(CWD)" \
V=$(V) KBUILD_NOCMDDEP=1 $(WITH_MAKE_PARAMS) \
CONFIG_MEMTRACK=$(CONFIG_MEMTRACK) \
CONFIG_DEBUG_INFO=$(CONFIG_DEBUG_INFO) \
CONFIG_INFINIBAND=$(CONFIG_INFINIBAND) \
CONFIG_INFINIBAND_IPOIB=$(CONFIG_INFINIBAND_IPOIB) \
CONFIG_INFINIBAND_IPOIB_CM=$(CONFIG_INFINIBAND_IPOIB_CM) \
CONFIG_INFINIBAND_SDP=$(CONFIG_INFINIBAND_SDP) \
CONFIG_INFINIBAND_SRP=$(CONFIG_INFINIBAND_SRP) \
CONFIG_INFINIBAND_SRPT=$(CONFIG_INFINIBAND_SRPT) \
CONFIG_SCSI_SRP_ATTRS=$(CONFIG_SCSI_SRP_ATTRS) \
CONFIG_INFINIBAND_USER_MAD=$(CONFIG_INFINIBAND_USER_MAD) \
CONFIG_INFINIBAND_USER_ACCESS=$(CONFIG_INFINIBAND_USER_ACCESS) \
CONFIG_INFINIBAND_USER_MEM=$(CONFIG_INFINIBAND_USER_MEM) \
CONFIG_INFINIBAND_ADDR_TRANS=$(CONFIG_INFINIBAND_ADDR_TRANS) \
CONFIG_INFINIBAND_MTHCA=$(CONFIG_INFINIBAND_MTHCA) \
CONFIG_INFINIBAND_IPOIB_DEBUG=$(CONFIG_INFINIBAND_IPOIB_DEBUG) \
CONFIG_INFINIBAND_ISERT=$(CONFIG_INFINIBAND_ISERT) \
CONFIG_INFINIBAND_ISER=$(CONFIG_INFINIBAND_ISER) \
CONFIG_SCSI_ISCSI_ATTRS=$(CONFIG_SCSI_ISCSI_ATTRS) \
CONFIG_ISCSI_TCP=$(CONFIG_ISCSI_TCP) \
CONFIG_INFINIBAND_EHCA=$(CONFIG_INFINIBAND_EHCA) \
CONFIG_INFINIBAND_EHCA_SCALING=$(CONFIG_INFINIBAND_EHCA_SCALING) \
CONFIG_RDS=$(CONFIG_RDS) \
CONFIG_RDS_RDMA=$(CONFIG_RDS_RDMA) \
CONFIG_RDS_TCP=$(CONFIG_RDS_TCP) \
CONFIG_RDS_DEBUG=$(CONFIG_RDS_DEBUG) \
CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=$(CONFIG_INFINIBAND_IPOIB_DEBUG_DATA) \
CONFIG_INFINIBAND_SDP_SEND_ZCOPY=$(CONFIG_INFINIBAND_SDP_SEND_ZCOPY) \
CONFIG_INFINIBAND_SDP_RECV_ZCOPY=$(CONFIG_INFINIBAND_SDP_RECV_ZCOPY) \
CONFIG_INFINIBAND_SDP_DEBUG=$(CONFIG_INFINIBAND_SDP_DEBUG) \
CONFIG_INFINIBAND_SDP_DEBUG_DATA=$(CONFIG_INFINIBAND_SDP_DEBUG_DATA) \
CONFIG_INFINIBAND_IPATH=$(CONFIG_INFINIBAND_IPATH) \
CONFIG_INFINIBAND_QIB=$(CONFIG_INFINIBAND_QIB) \
CONFIG_INFINIBAND_MTHCA_DEBUG=$(CONFIG_INFINIBAND_MTHCA_DEBUG) \
CONFIG_INFINIBAND_MADEYE=$(CONFIG_INFINIBAND_MADEYE) \
CONFIG_INFINIBAND_QLGC_VNIC=$(CONFIG_INFINIBAND_QLGC_VNIC) \
CONFIG_INFINIBAND_QLGC_VNIC_DEBUG=$(CONFIG_INFINIBAND_QLGC_VNIC_DEBUG) \
CONFIG_INFINIBAND_QLGC_VNIC_STATS=$(CONFIG_INFINIBAND_QLGC_VNIC_STATS) \
CONFIG_CHELSIO_T3=$(CONFIG_CHELSIO_T3) \
CONFIG_INFINIBAND_CXGB3=$(CONFIG_INFINIBAND_CXGB3) \
CONFIG_INFINIBAND_CXGB3_DEBUG=$(CONFIG_INFINIBAND_CXGB3_DEBUG) \
CONFIG_CHELSIO_T4=$(CONFIG_CHELSIO_T4) \
CONFIG_INFINIBAND_CXGB4=$(CONFIG_INFINIBAND_CXGB4) \
CONFIG_SCSI_CXGB3_ISCSI=$(CONFIG_SCSI_CXGB3_ISCSI) \
CONFIG_SCSI_CXGB4_ISCSI=$(CONFIG_SCSI_CXGB4_ISCSI) \
CONFIG_INFINIBAND_NES=$(CONFIG_INFINIBAND_NES) \
CONFIG_INFINIBAND_NES_DEBUG=$(CONFIG_INFINIBAND_NES_DEBUG) \
CONFIG_MLX4_CORE=$(CONFIG_MLX4_CORE) \
CONFIG_MLX5_CORE=$(CONFIG_MLX5_CORE) \
CONFIG_MLX4_EN=$(CONFIG_MLX4_EN) \
CONFIG_MLX4_EN_DCB=$(CONFIG_MLX4_EN_DCB) \
CONFIG_MLX4_INFINIBAND=$(CONFIG_MLX4_INFINIBAND) \
CONFIG_MLX5_INFINIBAND=$(CONFIG_MLX5_INFINIBAND) \
CONFIG_MLX4_ETHERNET=$(CONFIG_MLX4_ETHERNET) \
CONFIG_MLX4_DEBUG=$(CONFIG_MLX4_DEBUG) \
CONFIG_MLX5_DEBUG=$(CONFIG_MLX5_DEBUG) \
CONFIG_IBP_SERVER=$(CONFIG_IBP_SERVER) \
CONFIG_IBP_DEBUG=$(CONFIG_IBP_DEBUG) \
CONFIG_INFINIBAND_SCIF=$(CONFIG_INFINIBAND_SCIF) \
CONFIG_INFINIBAND_AMSO1100=$(CONFIG_INFINIBAND_AMSO1100) \
CONFIG_SUNRPC_XPRT_RDMA=$(CONFIG_SUNRPC_XPRT_RDMA) \
CONFIG_SUNRPC_XPRT_RDMA_CLIENT=$(CONFIG_SUNRPC_XPRT_RDMA_CLIENT) \
CONFIG_SUNRPC_XPRT_RDMA_SERVER=$(CONFIG_SUNRPC_XPRT_RDMA_SERVER) \
CONFIG_INFINIBAND_OCRDMA=$(CONFIG_INFINIBAND_OCRDMA) \
CONFIG_BE2NET=$(CONFIG_BE2NET) \
CONFIG_INFINIBAND_ISERT=$(CONFIG_INFINIBAND_ISERT) \
CONFIG_INFINIBAND_USNIC=$(CONFIG_INFINIBAND_USNIC) \
LINUXINCLUDE=' \
-D__OFED_BUILD__ \
$(CFLAGS) \
-include $(autoconf_h) \
$(KCONFIG_H) \
-include $(CWD)/include/linux/compat-2.6.h \
$(BACKPORT_INCLUDES) \
$(KERNEL_MEMTRACK_CFLAGS) \
$(OPENIB_KERNEL_EXTRA_CFLAGS) \
-I$(CWD)/include \
-I$(CWD)/include/uapi \
-I$(CWD)/drivers/infiniband/debug \
-I/usr/local/include/scst \
-I$(CWD)/drivers/infiniband/ulp/srpt \
$$(if $$(CONFIG_XEN),-D__XEN_INTERFACE_VERSION__=$$(CONFIG_XEN_INTERFACE_VERSION)) \
$$(if $$(CONFIG_XEN),-I$$(srctree)/arch/x86/include/mach-xen) \
-I$$(srctree)/arch/$$(SRCARCH)/include \
-Iarch/$$(SRCARCH)/include/generated \
-Iinclude \
-I$$(srctree)/arch/$$(SRCARCH)/include/uapi \
-Iarch/$$(SRCARCH)/include/generated/uapi \
-I$$(srctree)/include \
-I$$(srctree)/include/uapi \
-Iinclude/generated/uapi \
$$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) \
-I$$(srctree)/arch/$$(SRCARCH)/include \
-Iarch/$$(SRCARCH)/include/generated \
' \
modules
#########################
# Install kernel #
#########################
install_modules:
@echo "Installing kernel modules"
$(MAKE) -C $(KSRC_OBJ) SUBDIRS="$(CWD)" \
INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
$(WITH_MAKE_PARAMS) modules_install;
if [ ! -n "$(INSTALL_MOD_PATH)" ]; then $(DEPMOD) $(KVERSION);fi;
clean: clean_kernel
clean_kernel:
$(MAKE) -C $(KSRC_OBJ) SUBDIRS="$(CWD)" $(WITH_MAKE_PARAMS) clean
@/bin/rm -f $(clean-files)
clean-files := Module.symvers modules.order Module.markers compat/modules.order
clean-files += $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
help:
@echo
@echo kernel: build kernel modules
@echo all: build kernel modules
@echo
@echo install_kernel: install kernel modules under $(INSTALL_MOD_PATH)/$(MODULES_DIR)
@echo install: run install_kernel
@echo
@echo clean: delete kernel modules binaries
@echo clean_kernel: delete kernel modules binaries
@echo