1 # Makefile for building ecore as a module.
7 KVER
= $(shell uname
-r
)
10 __ARCH
=$(shell uname
-m
)
12 # PREFIX may be set by the RPM build to set the effective root.
14 ifeq ($(shell ls
/lib
/modules
/$(KVER
)/build
> /dev
/null
2>&1 && echo build
),)
16 _KVER
=$(shell echo
$(KVER
) | cut
-d
"-" -f1
,2)
17 _KFLA
=$(shell echo
$(KVER
) | cut
-d
"-" -f3
)
18 _ARCH
=$(shell file
-b
/lib
/modules
/$(shell uname
-r
)/build | cut
-d
"/" -f5
)
22 ifeq ($(shell ls
/usr
/src
/linux-
$(_KVER
)-obj
> /dev
/null
2>&1 && echo linux
),)
23 ifeq ($(shell ls
/usr
/src
/kernels
/$(KVER
)-$(__ARCH
) > /dev
/null
2>&1 && echo linux
),)
26 LINUX
=/usr
/src
/kernels
/$(KVER
)-$(__ARCH
)
34 KERNEL_DIR
=/usr
/src
/linux-
$(_KVER
)-obj
/$(_ARCH
)/$(_KFLA
)
36 LINUXSRC
=/usr
/src
/linux-
$(_KVER
)
40 BCMCFGS
:= /lib
/modules
/$(KVER
)/build \
41 /usr
/src
/kernels
/$(KVER
)-$(BCMPROC
) \
42 /usr
/src
/linux-
$(shell echo
$(KVER
) | sed
"s|\(.*\)-\([a-z]*\)|\1-obj/$(BCMPROC)/\2|") \
45 # Delete any entries that do not exist.
46 BCMTSTDIR
= $(shell if ls
$(DIR
) > /dev
/null
2>&1; then echo
$(DIR
); fi
)
47 BCMCFGS
:= $(foreach DIR
, $(BCMCFGS
), $(BCMTSTDIR
))
50 $(error Linux kernel config directory not found
)
53 KERNEL_DIR
:= $(firstword $(BCMCFGS
))
55 ifneq ($(shell ls
/lib
/modules
/$(KVER
)/source
> /dev
/null
2>&1 && echo source
),)
56 LINUXSRC
=/lib
/modules
/$(KVER
)/source
64 LINUXSRC
=$(KERNEL_DIR
)
68 ifeq ($(shell ls
/lib
/modules
/$(KVER
)/updates
> /dev
/null
2>&1 && echo
1),1)
71 ifeq ($(shell grep
-q
"search.*[[:space:]]updates" /etc
/depmod.conf
> /dev
/null
2>&1 && echo
1),1)
74 ifeq ($(shell grep
-q
"search.*[[:space:]]updates" /etc
/depmod.d
/* > /dev
/null
2>&1 && echo
1),1)
77 DRV_DIR
= kernel
/drivers
/net
82 sles_distro
:= $(wildcard /etc
/SuSE-release
)
83 ifneq ($(sles_distro
),)
84 SLES_VERSION
= $(shell cat
/etc
/SuSE-release | grep VERSION | grep
-o
-P
[0-9]+)
85 SLES_PATCHLEVEL
= $(shell cat
/etc
/SuSE-release | grep PATCHLEVEL | grep
-o
-P
[0-9]+)
86 PADDED_PATCHLEVEL
= $(shell if
[ 10 -gt
$(SLES_PATCHLEVEL
) ]; then echo
0$(SLES_PATCHLEVEL
); else echo
$(SLES_PATCHLEVEL
); fi
)
87 SLES_DISTRO_VER
= "0x$(SLES_VERSION)$(PADDED_PATCHLEVEL)"
88 EXTRA_CFLAGS
+= -DSLES_DISTRO
=$(SLES_DISTRO_VER
)
91 SOURCES
= ecore_chain.c ecore_cxt.c ecore_dev.c ecore_dbg_fw_funcs.c ecore_user_dbg_fw_funcs.c ecore_hw.c ecore_init_fw_funcs.c ecore_init_ops.c ecore_int.c ecore_mcp.c ecore_sp_commands.c ecore_spq.c ecore_dcbx.c ecore_phy.c ecore_selftest.c ecore_mng_tlv.c
92 HEADERS_LL2
= ecore_ll2_api.h ecore_ll2.h
93 HEADERS_HSI
= ecore_hsi_common.h ecore_hsi_iscsi.h ecore_hsi_roce.h ecore_hsi_rdma.h ecore_hsi_iwarp.h ecore_hsi_fcoe.h ecore_hsi_toe.h ecore_hsi_debug_tools.h ecore_hsi_init_func.h ecore_hsi_init_tool.h ..
/common
/include/common_hsi.h ..
/common
/include/eth_common.h ..
/common
/include/fcoe_common.h ..
/common
/include/iscsi_common.h ..
/common
/include/roce_common.h ..
/common
/include/rdma_common.h ..
/common
/include/storage_common.h ..
/common
/include/tcp_common.h ..
/common
/include/iwarp_common.h
94 HEADERS
= ecore_chain.h ecore_cxt_api.h ecore_cxt.h ecore_dbg_fw_funcs.h ecore_user_dbg_fw_funcs.h ecore_dbg_values.h ecore_dbg_values_user.h ecore_dev_api.h ecore_gtt_reg_addr.h ecore_gtt_values.h ecore.h ecore_hw_defs.h ecore_hw.h ecore_init_fw_funcs.h ecore_init_ops.h ecore_init_values.h ecore_init_values_zipped.h ecore_int_api.h ecore_int.h ecore_iro.h ecore_iro_values.h ecore_mcp.h ecore_phy_api.h ecore_mcp_api.h ecore_proto_if.h ecore_rt_defs.h ecore_sp_api.h ecore_sp_commands.h ecore_spq.h ecore_status.h ecore_utils.h ecore_dcbx.h ecore_dcbx_api.h ecore_selftest_api.h
include/bcm_osal.h ..
/..
/hsi
/hw
/pcics_reg_driver.h ..
/..
/hsi
/hw
/reg_addr.h ..
/..
/hsi
/mcp
/nvm_cfg.h ..
/..
/hsi
/mcp
/mcp_public.h ..
/..
/hsi
/mcp
/spad_layout.h ..
/..
/hsi
/mfw_hsi.h ..
/..
/hsi
/mcp
/nvm_map.h ecore_tcp_ip.h
96 obj-m
+= $(MODULE_NAME
).o
97 ecore-objs
= ecore_cxt.o ecore_dev.o ecore_dbg_fw_funcs.o ecore_user_dbg_fw_funcs.o ecore_hw.o ecore_init_fw_funcs.o ecore_init_ops.o ecore_int.o ecore_mcp.o ecore_phy.o ecore_sp_commands.o ecore_spq.o ecore_dcbx.o ecore_selftest.o ecore_chain.o ecore_mng_tlv.o
99 #TODO - we need all HSI [e.g., ecore_cxt.c needs to know the size of all contexts.
100 #Either need to carefully revise this, or everyone will need all the HSI files.
101 #since both L2 and LL2 require ecore_hsi_eth.h, every flavour needs it
102 HEADERS
+= $(HEADERS_HSI
) ecore_hsi_eth.h
104 # Determine the content of the ecore compilation - on default do everything
124 HEADERS
+= ecore_l2_api.h ecore_l2.h
125 HEADERS
+= ecore_roce.h ecore_roce_api.h ecore_hsi_roce.h ecore_hsi_rdma.h
126 HEADERS
+= ecore_fcoe_api.h ecore_fcoe.h ecore_hsi_fcoe.h
127 HEADERS
+= ecore_hsi_iscsi.h ecore_iscsi_api.h ecore_iscsi.h ecore_ooo.h
128 HEADERS
+= $(HEADERS_LL2
)
129 HEADERS
+= ecore_iov_api.h ecore_sriov.h ecore_vf_api.h ecore_vf.h ecore_vfpf_if.h
130 HEADERS
+= ecore_ptp_api.h
134 ecore-objs
+= ecore_l2.o
135 SOURCES
+= ecore_l2.c
136 EXTRA_CFLAGS
+= -DCONFIG_ECORE_L2
140 SOURCES
+= ecore_roce.c
141 ecore-objs
+= ecore_roce.o
142 EXTRA_CFLAGS
+= -DCONFIG_ECORE_ROCE
146 SOURCES
+= ecore_fcoe.c
147 ecore-objs
+= ecore_fcoe.o
148 EXTRA_CFLAGS
+= -DCONFIG_ECORE_FCOE
152 SOURCES
+= ecore_iscsi.c ecore_ooo.c
153 ecore-objs
+= ecore_iscsi.o ecore_ooo.o
154 EXTRA_CFLAGS
+= -DCONFIG_ECORE_ISCSI
158 EXTRA_CFLAGS
+= -DCONFIG_ECORE_IWARP
164 SOURCES
+= ecore_ll2.c
165 ecore-objs
+= ecore_ll2.o
166 EXTRA_CFLAGS
+= -DCONFIG_ECORE_LL2
169 ecore-objs
+= ecore_sriov.o ecore_vf.o
170 SOURCES
+= ecore_sriov.c ecore_vf.c
171 EXTRA_CFLAGS
+= -DCONFIG_ECORE_SRIOV
174 ecore-objs
+= ecore_ptp.o
175 SOURCES
+= ecore_ptp.c
176 EXTRA_CFLAGS
+= -DCONFIG_ECORE_PTP
179 #Add include subdir for both user/module flavours
180 EXTRA_CFLAGS
+= -DECORE_PACKAGE
-I
$(src
)/include -I.
/include -I
$(src
)/..
/common
/include/ -I.
/..
/common
/include/ -I
$(src
)/..
/..
/hsi
/hw
/ -I.
/..
/..
/hsi
/hw
-I
$(src
)/..
/..
/hsi
/mcp
/ -I.
/..
/..
/hsi
/mcp
-I
$(src
)/..
/..
/hsi
/ -I..
/..
/hsi
/
182 all default
: $(obj-m
)
185 rm -rf
*.o
*.ko .
*.cmd
*.mod.c Module.symvers modules.order
188 $(MAKE
) -C
$(KERNEL_DIR
) M
=`pwd` modules
191 $(CC
) -c
$(SOURCES
) $(EXTRA_CFLAGS
)
193 tar: $(SOURCES
) $(HEADERS
)
194 rm -rf
/tmp
/ecore.
tar.gz
197 cp
-r
$(SOURCES
) $(HEADERS
) release.txt
/tmp
/ecore
/
198 echo
"L2 = $(L2)" >> /tmp
/ecore
/Makefile
199 echo
"FCOE = $(FCOE)" >> /tmp
/ecore
/Makefile
200 echo
"ISCSI = $(ISCSI)" >> /tmp
/ecore
/Makefile
201 echo
"ROCE = $(ROCE)" >> /tmp
/ecore
/Makefile
202 echo
"SRIOV = $(SRIOV)" >> /tmp
/ecore
/Makefile
203 cat Makefile
>> /tmp
/ecore
/Makefile
204 tar czvf
/tmp
/ecore.
tar.gz
-C
/tmp ecore