Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 32737 | Differences between
and this patch

Collapse All | Expand All

(-)kernel-mod.eclass.bak (-1 / +97 lines)
Lines 8-13 Link Here
8
# This eclass differs from kmod.eclass because it doesn't require modules
8
# This eclass differs from kmod.eclass because it doesn't require modules
9
# to be added to the kernel source tree first.
9
# to be added to the kernel source tree first.
10
10
11
# Variables you can use to change behavior
12
#
13
# KERNEL_MOD_SOURCES - space seperated list of source to unpack in kernel-mod_src_unpack()
14
#					   if you don't want ${A} unpacked
15
# KERNEL_MOD_KOUTPUT_PATCH - Patch to apply in src_unpack() if a seperate output directory
16
#							 is detected
17
# KERNEL_MOD_NORMAL26_PATCH - Patch to fix 2.6 compilation if KV_OUTPUT is /usr/src/linux 
18
#							  2.6 kernel.
19
11
ECLASS=kernel-mod
20
ECLASS=kernel-mod
12
INHERITED="$INHERITED $ECLASS"
21
INHERITED="$INHERITED $ECLASS"
13
S=${WORKDIR}/${P}
22
S=${WORKDIR}/${P}
Lines 16-21 Link Here
16
SRC_URI="${SRC_URI:-unknown - please fix me!!}"
25
SRC_URI="${SRC_URI:-unknown - please fix me!!}"
17
KERNEL_DIR="${KERNEL_DIR:-/usr/src/linux}"
26
KERNEL_DIR="${KERNEL_DIR:-/usr/src/linux}"
18
27
28
# KERNEL_MOD_SOURCES is used if you don't want to unpack just ${A}
29
if [ -z "${KERNEL_MOD_SOURCES}" ]
30
then
31
	KERNEL_MOD_SOURCES=${A}
32
fi
33
19
kernel-mod_getmakefilevar ()
34
kernel-mod_getmakefilevar ()
20
{
35
{
21
	grep $1 $2 | head -n 1 | cut -d = -f 2- | awk '{ print $1 }'
36
	grep $1 $2 | head -n 1 | cut -d = -f 2- | awk '{ print $1 }'
Lines 61-66 Link Here
61
76
62
	KV_MK_VERSION_FULL="$KV_MK_MAJOR.$KV_MK_MINOR.$KV_MK_PATCH$KV_MK_TYPE"
77
	KV_MK_VERSION_FULL="$KV_MK_MAJOR.$KV_MK_MINOR.$KV_MK_PATCH$KV_MK_TYPE"
63
78
79
	KV_MK_OUTPUT="`kernel-mod_getmakefilevar ^KBUILD_OUTPUT $KV_MK_FILE`"
80
	
81
	# Fix for if we found the default KBUILD_OUTPUT instead of a set one
82
	if [ "${KV_MK_OUTPUT}" = "\$(shell" ]; then
83
		KV_MK_OUTPUT=""
84
	fi
85
64
	if [ "$KV_MK_VERSION_FULL" != "$KV_DIR_VERSION_FULL" ]; then
86
	if [ "$KV_MK_VERSION_FULL" != "$KV_DIR_VERSION_FULL" ]; then
65
		ewarn
87
		ewarn
66
		ewarn "The kernel Makefile says that this is a $KV_MK_VERSION_FULL kernel"
88
		ewarn "The kernel Makefile says that this is a $KV_MK_VERSION_FULL kernel"
Lines 82-88 Link Here
82
	KV_PATCH="$KV_MK_PATCH"
104
	KV_PATCH="$KV_MK_PATCH"
83
	KV_TYPE="$KV_MK_TYPE"
105
	KV_TYPE="$KV_MK_TYPE"
84
106
107
	# if we found an output location, use that. otherwise use KERNEL_DIR.
108
	if [ ! -z "${KV_MK_OUTPUT}" ]
109
	then
110
		einfo "Setting to MK_OUTPUT"
111
		KV_OUTPUT="$KV_MK_OUTPUT"
112
	else
113
		einfo "Setting to KERNEL_DIR"
114
		KV_OUTPUT="$KERNEL_DIR"
115
	fi
116
117
	if [ "${KV_MINOR}" -gt "4" ]
118
	then
119
		KV_OBJ="ko"
120
	else
121
		KV_OBJ="o"
122
	fi
123
124
	if [ "${KV_MINOR}" -gt 4 ] && [ "${KV_OUTPUT}" = "/usr/src/linux" ]
125
	then
126
		KV_BUILD="${S}/kernel-build"
127
	else
128
		KV_BUILD="/usr/src/linux"
129
	fi
130
85
	einfo "Building for Linux ${KV_VERSION_FULL} found in ${KERNEL_DIR}"
131
	einfo "Building for Linux ${KV_VERSION_FULL} found in ${KERNEL_DIR}"
132
133
	if [ "${KV_MINOR}" -gt "4" ]
134
	then
135
		einfo "which outputs to ${KV_OUTPUT}"
136
137
		# Warn them if they aren't using a different output directory
138
		if [ "${KV_OUTPUT}" = "/usr/src/linux" ]; then
139
			ewarn "By not using the kernel's ability to output to an alternative"
140
			ewarn "directory, some external module builds may fail."
141
			ewarn "See <insert link to user doc here>"
142
		fi
143
	fi
86
}
144
}
87
145
88
kernel-mod_checkzlibinflate_configured ()
146
kernel-mod_checkzlibinflate_configured ()
Lines 151-161 Link Here
151
	die "Kernel doesn't include zlib support"
209
	die "Kernel doesn't include zlib support"
152
}
210
}
153
211
212
kernel-mod_src_unpack ()
213
{
214
	check_KV
215
	kernel-mod_getversion
216
	unpack ${KERNEL_MOD_SOURCES}
217
	if [ "${KV_MINOR}" -gt 4 ] 
218
	then
219
		cd ${S}
220
		if [ "${KV_OUTPUT}" = "/usr/src/linux" ]; then
221
			# Setup our build directory
222
			einfo "Creating temporary build directory in ${KV_BUILD} using files in ${KV_OUTPUT}"
223
			mkdir -p ${KV_BUILD}
224
			cd ${KV_BUILD}
225
			for link in ${KV_OUTPUT}/.config \
226
						${KV_OUTPUT}/.version \
227
						${KV_OUTPUT}/.tmp_versions \
228
						${KV_OUTPUT}/*;
229
			do
230
				ln -s "${link}" .
231
			done
232
233
			# Patch as needed
234
			if [ -n "${KERNEL_MOD_NORMAL26_PATCH}" ]; then
235
				einfo "Patching to fix 2.6 module compilation"
236
				epatch "${KERNEL_MOD_NORMAL26_PATCH}"
237
			fi
238
		elif [ -n "${KERNEL_MOD_KOUTPUT_PATCH}" ]; then
239
			einfo "Patching to enable koutput compatibility"
240
			epatch ${KERNEL_MOD_KOUTPUT_PATCH}
241
		fi
242
	fi
243
}
244
154
kernel-mod_src_compile ()
245
kernel-mod_src_compile ()
155
{
246
{
156
	emake KERNEL_DIR=${KERNEL_DIR} || die
247
	emake KERNEL_DIR=${KERNEL_DIR} || die
157
}
248
}
158
249
250
kernel-mod_pkg_postinst()
251
{
252
	depmod -a
253
}
254
159
kernel-mod_is_2_4_kernel() {
255
kernel-mod_is_2_4_kernel() {
160
	kernel-mod_getversion
256
	kernel-mod_getversion
161
257
Lines 189-192 Link Here
189
    fi
285
    fi
190
}
286
}
191
287
192
EXPORT_FUNCTIONS src_compile
288
EXPORT_FUNCTIONS src_unpack src_compile pkg_postinst

Return to bug 32737