aboutsummaryrefslogtreecommitdiff
blob: 52d6157445713a1e1379e71249e14a0967df7991 (plain)
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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit rpm linux-mod

DESCRIPTION="OpenIB kernel modules"
HOMEPAGE="http://www.openfabrics.org/"
SHORT_PV=${PV%\.[^.]}
SRC_URI="http://www.openfabrics.org/builds/ofed-${SHORT_PV}/release/OFED-${PV}.tgz"
MY_P="OFED-${PV}"
S="${WORKDIR}/ofa_kernel-${PV}"

LICENSE="|| ( GPL-2 BSD-2 )"
SLOT="0"

KEYWORDS="~x86 ~amd64"
IUSE="memtrack hpage-patch srp ipath iser ehca mlx4 rds madeye vnic cxgb3 debug"

RDEPEND=""
PDEPEND="=sys-infiniband/openib-files-${PV}"
DEPEND="${RDEPEND}
	virtual/linux-sources"

pkg_setup() {

	CONFIG_CHECK="!INFINIBAND PCI"
	ERROR_INFINIBAND="Infiniband is already compiled into the kernel."
	ERROR_PCI="PCI must be enabled in the kernel."

	linux-mod_pkg_setup
}

src_unpack() {
	unpack ${A} || die "unpack failed"
	rpm_unpack ${MY_P}/SRPMS/ofa_kernel-${PV}-0.src.rpm
	tar xzf ofa_kernel-${PV}.tgz
	# remove patches that failed for me:
	rm "${S}/kernel_patches/fixes/0050_cxgb3__fix_MSI_X_failure_path" \
		"${S}/kernel_patches/fixes/0051_cxgb3__Use_wild_card_for_PCI_subdevice_ID_match" \
		"${S}/kernel_patches/fixes/0052_cxgb3__Fix_resources_release" \
		"${S}/kernel_patches/fixes/0053_cxgb3__Add_EEH_support" \
		"${S}/kernel_patches/fixes/0054_cxgb3__FW_upgrade" \
		"${S}/kernel_patches/fixes/0055_cxgb3__fix_interaction_with_pktgen" \
		"${S}/kernel_patches/fixes/0056_cxgb3__HW_set_up_updates" \
		"${S}/kernel_patches/fixes/0057_cxgb3__Fix_I_O_synchronization" \
		"${S}/kernel_patches/fixes/0071_cxgb3_Parity_initialization_for_T3C_adapters.patch" \
		"${S}/kernel_patches/fixes/0072_cxgb3_Fix_EEH_missing_softirq_blocking.patch" \
		"${S}/kernel_patches/fixes/z_0010_skb_copy.patch" \
		"${S}/kernel_patches/fixes/z_0040_napi_default.patch"
}

make_target() {
	local myARCH="${ARCH}" myABI="${ABI}"
	ARCH="$(tc-arch-kernel)"
	ABI="${KERNEL_ABI}"

	emake HOSTCC=$(tc-getBUILD_CC) CC=$(get-KERNEL_CC) $@ \
		|| die "Unable to run emake $@"

	ARCH="${myARCH}"
	ABI="${myABI}"
}

src_compile() {
	convert_to_m Makefile

	export CONFIG_INFINIBAND="m"
	export CONFIG_INFINIBAND_IPOIB="m"
	export CONFIG_INFINIBAND_SDP="m"
	export CONFIG_INFINIBAND_SRP="m"

	export CONFIG_INFINIBAND_USER_MAD="m"
	export CONFIG_INFINIBAND_USER_ACCESS="m"
	export CONFIG_INFINIBAND_ADDR_TRANS="y"
	export CONFIG_INFINIBAND_MTHCA="m"
	export CONFIG_INFINIBAND_IPATH="m"

	CONF_PARAMS="--prefix=${ROOT}usr --kernel-version=${KV_FULL}
				 --with-core-mod
				 --with-ipoib-mod
				 --with-ipoib-cm
				 --with-sdp-mod
				 --with-user_mad-mod
				 --with-user_access-mod
				 --with-addr_trans-mod
				 --with-mthca-mod"
	CONF_PARAMS="$CONF_PARAMS
			     $(use_with srp)-mod
			     $(use_with ipath)_inf-mod
			     $(use_with iser)-mod
			     $(use_with ehca)-mod
			     $(use_with mlx4)-mod
			     $(use_with rds)-mod
			     $(use_with madeye)-mod
			     $(use_with vnic)-mod
			     $(use_with cxgb3)-mod"
	if use debug; then
		CONF_PARAMS="$CONF_PARAMS
					 --with-mthca_debug-mod
					 --with-ipoib_debug-mod
					 --with-sdp_debug-mod
					 $(use_with srp)_debug-mod
					 $(use_with rds)_debug-mod
					 $(use_with vnic)_debug-mod
					 $(use_with mlx4)_debug-mod
					 $(use_with cxgb3)_debug-mod"
	else
		CONF_PARAMS="$CONF_PARAMS
					 --without-mthca_debug-mod
					 --without-ipoib_debug-mod
					 --without-sdp_debug-mod"
	fi
	ebegin "Configuring"
	local myARCH="${ARCH}" myABI="${ABI}"
	ARCH="$(tc-arch-kernel)"
	ABI="${KERNEL_ABI}"
	./configure ${CONF_PARAMS} ${EXTRA_ECONF} \
		|| die "configure failed with options: ${CONF_PARAMS}"
	ARCH="${myARCH}"
	ABI="${myABI}"
	eend

	#sed -i '/DEPMOD.*=.*depmod/s/=.*/= :/' ./Makefile
	#grep DEPMOD Makefile

	make_target
}

src_install() {

	make_target DESTDIR="${D}" install

	insinto /usr/include/rdma
	doins "${S}/include/rdma/*.h"
	insinto /usr/include/scsi
	doins "${S}/include/scsi/*.h"

}

pkg_postinst() {

	linux-mod_pkg_postinst

}