/[gentoo-x86]/eclass/linux-mod.eclass
Gentoo

Diff of /eclass/linux-mod.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.6 Revision 1.85
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.6 2004/12/06 18:33:11 johnm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.85 2008/10/31 21:25:56 dsd Exp $
4 4
5# This eclass provides functions for compiling external kernel modules 5# Description: This eclass is used to interface with linux-info in such a way
6# from source. 6# to provide the functionality required and initial functions
7# required to install external modules against a kernel source
8# tree.
9#
10# Author(s): John Mylchreest <johnm@gentoo.org>,
11# Stefan Schweizer <genstef@gentoo.org>
12# Maintainer: kernel-misc@gentoo.org
13#
14# Please direct your bugs to the current eclass maintainer :)
7 15
8inherit linux-info 16# A Couple of env vars are available to effect usage of this eclass
9ECLASS=linux-mod 17# These are as follows:
10INHERITED="$INHERITED $ECLASS" 18#
11EXPORT_FUNCTIONS pkg_setup pkg_postinst src_compile 19# Env Var Option Default Description
20# KERNEL_DIR <string> /usr/src/linux The directory containing kernel
21# the target kernel sources.
22# ECONF_PARAMS <string> The parameters to pass to econf.
23# If this is not set, then econf
24# isn't run.
25# BUILD_PARAMS <string> The parameters to pass to emake.
26# BUILD_TARGETS <string> clean modules The build targets to pass to
27# make.
28# MODULE_NAMES <string> This is the modules which are
29# to be built automatically using
30# the default pkg_compile/install.
31# They are explained properly
32# below. It will only make
33# BUILD_TARGETS once in any
34# directory.
12 35
36# MODULE_NAMES - Detailed Overview
37#
38# The structure of each MODULE_NAMES entry is as follows:
39# modulename(libdir:srcdir:objdir)
40#
41# modulename = name of the module file excluding the .ko
42# libdir = place in system modules directory where module is installed:
43# srcdir = place for ebuild to cd to before running make
44# objdir = place the .ko and objects are located after make runs
45#
46# To get an idea of how these variables are used, here's a few lines
47# of code from around line 540 in this eclass:
48#
49# einfo "Installing ${modulename} module"
50# cd ${objdir} || die "${objdir} does not exist"
51# insinto /lib/modules/${KV_FULL}/${libdir}
52# doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
53#
54# for example:
55# MODULE_NAMES="module_pci(pci:${S}/pci:${S}) module_usb(usb:${S}/usb:${S})"
56#
57# what this would do is
58# cd ${S}/pci
59# make ${BUILD_PARAMS} ${BUILD_TARGETS}
60# cd ${S}
61# insinto /lib/modules/${KV_FULL}/pci
62# doins module_pci.${KV_OBJ}
63#
64# cd ${S}/usb
65# make ${BUILD_PARAMS} ${BUILD_TARGETS}
66# cd ${S}
67# insinto /lib/modules/${KV_FULL}/usb
68# doins module_usb.${KV_OBJ}
69#
70# if the srcdir isnt specified, it assumes ${S}
71# if the libdir isnt specified, it assumes misc.
72# if the objdir isnt specified, it assumes srcdir
73
74# There is also support for automated modprobe.d/modules.d(2.4) file generation.
75# This can be explicitly enabled by setting any of the following variables.
76#
77#
78# MODULESD_${modulename}_ENABLED This enables the modules.d file
79# generation even if we dont
80# specify any additional info.
81# MODULESD_${modulename}_EXAMPLES This is a bash array containing
82# a list of examples which should
83# be used. If you want us to try and
84# take a guess. Set this to "guess"
85# MODULESD_${modulename}_ALIASES This is a bash array containing
86# a list of associated aliases.
87# MODULESD_${modulename}_ADDITIONS This is a bash array containing
88# A list of additional things to
89# add to the bottom of the file.
90# This can be absolutely anything.
91# Each entry is a new line.
92# MODULES_${modulename}_DOCS This is a string list which contains
93# the full path to any associated
94# documents for $modulename
95
96# The order of these is important as both of linux-info and eutils contain
97# set_arch_to_kernel and set_arch_to_portage functions and the ones in eutils
98# are deprecated in favor of the ones in linux-info.
99# See http://bugs.gentoo.org/show_bug.cgi?id=127506
100
101inherit eutils linux-info multilib
102EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm
103
104IUSE="kernel_linux"
105SLOT="0"
13DESCRIPTION="Based on the $ECLASS eclass" 106DESCRIPTION="Based on the $ECLASS eclass"
14SLOT=0 107RDEPEND="kernel_linux? ( virtual/modutils )"
15DEPEND="virtual/linux-sources 108DEPEND="${RDEPEND}
16 sys-apps/sed" 109 sys-apps/sed"
17
18
19# This eclass is designed to help ease the installation of external kernel
20# modules into the kernel tree.
21
22 110
23# eclass utilities 111# eclass utilities
24# ---------------------------------- 112# ----------------------------------
25 113
114check_vermagic() {
115 debug-print-function ${FUNCNAME} $*
116
117 local curr_gcc_ver=$(gcc -dumpversion)
118 local tmpfile old_chost old_gcc_ver result=0
119
120 tmpfile=`find ${KV_DIR}/ -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit`
121 tmpfile=${tmpfile//*usr/lib}
122 tmpfile=${tmpfile//\/include*}
123 old_chost=${tmpfile//*gcc\/}
124 old_chost=${old_chost//\/*}
125 old_gcc_ver=${tmpfile//*\/}
126
127 if [[ -z ${old_gcc_ver} || -z ${old_chost} ]]; then
128 ewarn ""
129 ewarn "Unable to detect what version of GCC was used to compile"
130 ewarn "the kernel. Build will continue, but you may experience problems."
131 elif [[ ${curr_gcc_ver} != ${old_gcc_ver} ]]; then
132 ewarn ""
133 ewarn "The version of GCC you are using (${curr_gcc_ver}) does"
134 ewarn "not match the version of GCC used to compile the"
135 ewarn "kernel (${old_gcc_ver})."
136 result=1
137 elif [[ ${CHOST} != ${old_chost} ]]; then
138 ewarn ""
139 ewarn "The current CHOST (${CHOST}) does not match the chost"
140 ewarn "used when compiling the kernel (${old_chost})."
141 result=1
142 fi
143
144 if [[ ${result} -gt 0 ]]; then
145 ewarn ""
146 ewarn "Build will not continue, because you will experience problems."
147 ewarn "To fix this either change the version of GCC you wish to use"
148 ewarn "to match the kernel, or recompile the kernel first."
149 die "GCC Version Mismatch."
150 fi
151}
152
26use_m() { 153use_m() {
154 debug-print-function ${FUNCNAME} $*
155
27 # if we haven't determined the version yet, we need too. 156 # if we haven't determined the version yet, we need too.
28 get_version; 157 get_version;
29 158
30 # if the kernel version is greater than 2.6.6 then we should use 159 # if the kernel version is greater than 2.6.6 then we should use
31 # M= instead of SUBDIR= 160 # M= instead of SUBDIRS=
32 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ 161 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \
33 return 0 || return 1 162 return 0 || return 1
34} 163}
35 164
36convert_to_m() { 165convert_to_m() {
37 [ ! -f "${1}" ] && die "convert_to_m() requires a filename as an argument" 166 debug-print-function ${FUNCNAME} $*
167
38 if use_m 168 if use_m
39 then 169 then
170 [ ! -f "${1}" ] && \
171 die "convert_to_m() requires a filename as an argument"
40 ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIR=" 172 ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS="
41 sed -i 's:SUBDIRS=:M=:g' ${1} 173 sed -i 's:SUBDIRS=:M=:g' ${1}
42 eend $? 174 eend $?
43 fi 175 fi
44} 176}
45 177
46update_depmod() { 178update_depmod() {
179 debug-print-function ${FUNCNAME} $*
180
47 # if we haven't determined the version yet, we need too. 181 # if we haven't determined the version yet, we need too.
48 get_version; 182 get_version;
49 183
50 ebegin "Updating module dependencies for ${KV_FULL}" 184 ebegin "Updating module dependencies for ${KV_FULL}"
51 if [ -r ${KV_OUT_DIR}/System.map ] 185 if [ -r ${KV_OUT_DIR}/System.map ]
52 then 186 then
53 depmod -ae -F ${KV_OUT_DIR}/System.map -b ${ROOT} -r ${KV_FULL} 187 depmod -ae -F ${KV_OUT_DIR}/System.map -b ${ROOT} -r ${KV_FULL}
188 eend $?
54 else 189 else
55 ewarn 190 ewarn
56 ewarn "${KV_OUT_DIR}/System.map not found." 191 ewarn "${KV_OUT_DIR}/System.map not found."
57 ewarn "You must manually update the kernel module dependencies using depmod." 192 ewarn "You must manually update the kernel module dependencies using depmod."
193 eend 1
58 ewarn 194 ewarn
59 fi 195 fi
60 eend $?
61} 196}
62 197
63update_modules() { 198update_modules() {
64 if [ -x /sbin/modules-update ] ; 199 debug-print-function ${FUNCNAME} $*
65 then 200
201 if [ -x /sbin/update-modules ] && \
202 grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then
66 ebegin "Updating modules.conf" 203 ebegin "Updating modules.conf"
67 /sbin/modules-update 204 /sbin/update-modules
68 eend $? 205 eend $?
206 elif [ -x /sbin/update-modules ] && \
207 grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then
208 ebegin "Updating modules.conf"
209 /sbin/update-modules
210 eend $?
211 fi
212}
213
214move_old_moduledb() {
215 debug-print-function ${FUNCNAME} $*
216
217 local OLDDIR=${ROOT}/usr/share/module-rebuild/
218 local NEWDIR=${ROOT}/var/lib/module-rebuild/
219
220 if [[ -f ${OLDDIR}/moduledb ]]; then
221 [[ ! -d ${NEWDIR} ]] && mkdir -p ${NEWDIR}
222 [[ ! -f ${NEWDIR}/moduledb ]] && \
223 mv ${OLDDIR}/moduledb ${NEWDIR}/moduledb
224 rm -f ${OLDDIR}/*
225 rmdir ${OLDDIR}
226 fi
227}
228
229update_moduledb() {
230 debug-print-function ${FUNCNAME} $*
231
232 local MODULEDB_DIR=${ROOT}/var/lib/module-rebuild/
233 move_old_moduledb
234
235 if [[ ! -f ${MODULEDB_DIR}/moduledb ]]; then
236 [[ ! -d ${MODULEDB_DIR} ]] && mkdir -p ${MODULEDB_DIR}
237 touch ${MODULEDB_DIR}/moduledb
238 fi
239
240 if ! grep -qs ${CATEGORY}/${PN}-${PVR} ${MODULEDB_DIR}/moduledb ; then
241 einfo "Adding module to moduledb."
242 echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${MODULEDB_DIR}/moduledb
243 fi
244}
245
246remove_moduledb() {
247 debug-print-function ${FUNCNAME} $*
248
249 local MODULEDB_DIR=${ROOT}/var/lib/module-rebuild/
250 move_old_moduledb
251
252 if grep -qs ${CATEGORY}/${PN}-${PVR} ${MODULEDB_DIR}/moduledb ; then
253 einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb."
254 sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" ${MODULEDB_DIR}/moduledb
69 fi 255 fi
70} 256}
71 257
72set_kvobj() { 258set_kvobj() {
259 debug-print-function ${FUNCNAME} $*
260
73 if kernel_is 2 6 261 if kernel_is 2 6
74 then 262 then
75 KV_OBJ="ko" 263 KV_OBJ="ko"
76 else 264 else
77 KV_OBJ="o" 265 KV_OBJ="o"
78 fi 266 fi
267 # Do we really need to know this?
268 # Lets silence it.
79 einfo "Using KV_OBJ=${KV_OBJ}" 269 # einfo "Using KV_OBJ=${KV_OBJ}"
80} 270}
81 271
82display_postinst() { 272get-KERNEL_CC() {
83 # if we haven't determined the version yet, we need too. 273 debug-print-function ${FUNCNAME} $*
84 get_version;
85
86 local modulename moduledir sourcedir module_temp file i
87
88 file=${ROOT}/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}
89 file=${file/\/\///}
90 274
91 einfo "If you would like to load this module automatically upon boot" 275 if [[ -n ${KERNEL_CC} ]] ; then
92 einfo "please type the following as root:" 276 echo "${KERNEL_CC}"
277 return
278 fi
279
280 local kernel_cc
281 if [ -n "${KERNEL_ABI}" ]; then
282 # In future, an arch might want to define CC_$ABI
283 #kernel_cc="$(get_abi_CC)"
284 #[ -z "${kernel_cc}" ] &&
285 kernel_cc="$(tc-getCC $(ABI=${KERNEL_ABI} get_abi_CHOST))"
286 else
287 kernel_cc=$(tc-getCC)
288 fi
289 echo "${kernel_cc}"
290}
291
292generate_modulesd() {
293 debug-print-function ${FUNCNAME} $*
294
295 # This function will generate the neccessary modules.d file from the
296 # information contained in the modules exported parms
297
298 local currm_path currm currm_t t myIFS myVAR
299 local module_docs module_enabled module_aliases \
300 module_additions module_examples module_modinfo module_opts
301
302 for currm_path in ${@}
303 do
304 currm=${currm_path//*\/}
305 currm=$(echo ${currm} | tr '[:lower:]' '[:upper:]')
306 currm_t=${currm}
307 while [[ -z ${currm_t//*-*} ]]; do
308 currm_t=${currm_t/-/_}
309 done
310
311 module_docs="$(eval echo \${MODULESD_${currm_t}_DOCS})"
312 module_enabled="$(eval echo \${MODULESD_${currm_t}_ENABLED})"
313 module_aliases="$(eval echo \${#MODULESD_${currm_t}_ALIASES[*]})"
314 module_additions="$(eval echo \${#MODULESD_${currm_t}_ADDITIONS[*]})"
315 module_examples="$(eval echo \${#MODULESD_${currm_t}_EXAMPLES[*]})"
316
317 [[ ${module_aliases} -eq 0 ]] && unset module_aliases
318 [[ ${module_additions} -eq 0 ]] && unset module_additions
319 [[ ${module_examples} -eq 0 ]] && unset module_examples
320
321 # If we specify we dont want it, then lets exit, otherwise we assume
322 # that if its set, we do want it.
323 [[ ${module_enabled} == no ]] && return 0
324
325 # unset any unwanted variables.
326 for t in ${!module_*}
327 do
328 [[ -z ${!t} ]] && unset ${t}
329 done
330
331 [[ -z ${!module_*} ]] && return 0
332
333 # OK so now if we have got this far, then we know we want to continue
334 # and generate the modules.d file.
335 module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})"
336 module_config="${T}/modulesd-${currm}"
337
338 ebegin "Preparing file for modules.d"
339 #-----------------------------------------------------------------------
340 echo "# modules.d configuration file for ${currm}" >> ${module_config}
341 #-----------------------------------------------------------------------
342 [[ -n ${module_docs} ]] && \
343 echo "# For more information please read:" >> ${module_config}
344 for t in ${module_docs}
345 do
346 echo "# ${t//*\/}" >> ${module_config}
347 done
348 echo >> ${module_config}
349
350 #-----------------------------------------------------------------------
351 if [[ ${module_aliases} -gt 0 ]]
352 then
353 echo "# Internal Aliases - Do not edit" >> ${module_config}
354 echo "# ------------------------------" >> ${module_config}
355
356 for((t=0; t<${module_aliases}; t++))
357 do
358 echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \
359 >> ${module_config}
360 done
361 echo '' >> ${module_config}
362 fi
363
364 #-----------------------------------------------------------------------
365 if [[ -n ${module_modinfo} ]]
366 then
367 echo >> ${module_config}
368 echo "# Configurable module parameters" >> ${module_config}
369 echo "# ------------------------------" >> ${module_config}
370 myIFS="${IFS}"
371 IFS="$(echo -en "\n\b")"
372
373 for t in ${module_modinfo}
374 do
375 myVAR="$(echo ${t#*:} | grep -e " [0-9][ =]" | sed "s:.*\([01][= ]\).*:\1:")"
376 if [[ -n ${myVAR} ]]
377 then
378 module_opts="${module_opts} ${t%%:*}:${myVAR}"
379 fi
380 echo -e "# ${t%%:*}:\t${t#*:}" >> ${module_config}
381 done
382 IFS="${myIFS}"
383 echo '' >> ${module_config}
384 fi
385
386 #-----------------------------------------------------------------------
387 if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]]
388 then
389 # So lets do some guesswork eh?
390 if [[ -n ${module_opts} ]]
391 then
392 echo "# For Example..." >> ${module_config}
393 echo "# --------------" >> ${module_config}
394 for t in ${module_opts}
395 do
396 echo "# options ${currm} ${t//:*}=${t//*:}" >> ${module_config}
397 done
398 echo '' >> ${module_config}
399 fi
400 elif [[ ${module_examples} -gt 0 ]]
401 then
402 echo "# For Example..." >> ${module_config}
403 echo "# --------------" >> ${module_config}
404 for((t=0; t<${module_examples}; t++))
405 do
406 echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \
407 >> ${module_config}
408 done
409 echo '' >> ${module_config}
410 fi
411
412 #-----------------------------------------------------------------------
413 if [[ ${module_additions} -gt 0 ]]
414 then
415 for((t=0; t<${module_additions}; t++))
416 do
417 echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \
418 >> ${module_config}
419 done
420 echo '' >> ${module_config}
421 fi
422
423 #-----------------------------------------------------------------------
424
425 # then we install it
426 if kernel_is ge 2 6; then
427 insinto /etc/modprobe.d
428 else
429 insinto /etc/modules.d
430 fi
431 newins ${module_config} ${currm_path//*\/}
432
433 # and install any documentation we might have.
434 [[ -n ${module_docs} ]] && dodoc ${module_docs}
435 done
436 eend 0
437 return 0
438}
439
440find_module_params() {
441 debug-print-function ${FUNCNAME} $*
442
443 local matched_offset=0 matched_opts=0 test="${@}" temp_var result
444 local i=0 y=0 z=0
445
446 for((i=0; i<=${#test}; i++))
447 do
448 case ${test:${i}:1} in
449 \() matched_offset[0]=${i};;
450 \:) matched_opts=$((${matched_opts} + 1));
451 matched_offset[${matched_opts}]="${i}";;
452 \)) matched_opts=$((${matched_opts} + 1));
453 matched_offset[${matched_opts}]="${i}";;
454 esac
455 done
456
457 for((i=0; i<=${matched_opts}; i++))
458 do
459 # i = offset were working on
460 # y = last offset
461 # z = current offset - last offset
462 # temp_var = temporary name
463 case ${i} in
464 0) tempvar=${test:0:${matched_offset[0]}};;
465 *) y=$((${matched_offset[$((${i} - 1))]} + 1))
466 z=$((${matched_offset[${i}]} - ${matched_offset[$((${i} - 1))]}));
467 z=$((${z} - 1))
468 tempvar=${test:${y}:${z}};;
469 esac
470
471 case ${i} in
472 0) result="${result} modulename:${tempvar}";;
473 1) result="${result} libdir:${tempvar}";;
474 2) result="${result} srcdir:${tempvar}";;
475 3) result="${result} objdir:${tempvar}";;
476 esac
477 done
478
479 echo ${result}
480}
481
482# default ebuild functions
483# --------------------------------
484
485linux-mod_pkg_setup() {
486 debug-print-function ${FUNCNAME} $*
487
488 linux-info_pkg_setup;
489 require_configured_kernel
490 check_kernel_built;
491 strip_modulenames;
492 [[ -n ${MODULE_NAMES} ]] && check_modules_supported
493 set_kvobj;
494 # Commented out with permission from johnm until a fixed version for arches
495 # who intentionally use different kernel and userland compilers can be
496 # introduced - Jason Wever <weeve@gentoo.org>, 23 Oct 2005
497 #check_vermagic;
498}
499
500strip_modulenames() {
501 debug-print-function ${FUNCNAME} $*
502
503 local i
504 for i in ${MODULE_IGNORE}; do
505 MODULE_NAMES=${MODULE_NAMES//${i}(*}
506 done
507}
508
509linux-mod_src_compile() {
510 debug-print-function ${FUNCNAME} $*
511
512 local modulename libdir srcdir objdir i n myABI="${ABI}"
513 set_arch_to_kernel
514 ABI="${KERNEL_ABI}"
515
516 BUILD_TARGETS=${BUILD_TARGETS:-clean module}
517 strip_modulenames;
518 cd "${S}"
93 for i in ${MODULE_NAMES} 519 for i in ${MODULE_NAMES}
94 do 520 do
95 module_temp="$(echo ${i} | sed -e "s:.*(\(.*\)):\1:")" 521 unset libdir srcdir objdir
96 modulename="${i/(*/}" 522 for n in $(find_module_params ${i})
97 moduledir="${module_temp/:*/}" 523 do
98 moduledir="${moduledir:-misc}" 524 eval ${n/:*}=${n/*:/}
99 sourcedir="${module_temp/*:/}" 525 done
526 libdir=${libdir:-misc}
100 sourcedir="${sourcedir:-${S}}" 527 srcdir=${srcdir:-${S}}
101 528 objdir=${objdir:-${srcdir}}
102 einfo " # echo \"${modulename}\" >> ${file}" 529
530 if [ ! -f "${srcdir}/.built" ];
531 then
532 cd ${srcdir}
533 einfo "Preparing ${modulename} module"
534 if [[ -n ${ECONF_PARAMS} ]]
535 then
536 econf ${ECONF_PARAMS} || \
537 die "Unable to run econf ${ECONF_PARAMS}"
538 fi
539
540 # This looks messy, but it is needed to handle multiple variables
541 # being passed in the BUILD_* stuff where the variables also have
542 # spaces that must be preserved. If don't do this, then the stuff
543 # inside the variables gets used as targets for Make, which then
544 # fails.
545 eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
546 CROSS_COMPILE=${CHOST}- \
547 LDFLAGS=\"$(get_abi_LDFLAGS)\" \
548 ${BUILD_FIXES} \
549 ${BUILD_PARAMS} \
550 ${BUILD_TARGETS} " \
551 || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
552 touch ${srcdir}/.built
553 cd ${OLDPWD}
554 fi
103 done 555 done
104 echo
105}
106 556
107# default ebuild functions 557 set_arch_to_portage
108# -------------------------------- 558 ABI="${myABI}"
109
110linux-mod_pkg_setup() {
111 linux-info_pkg_setup;
112 check_kernel_built;
113 check_modules_supported;
114 check_extra_config;
115 set_kvobj;
116} 559}
117 560
118linux-mod_src_compile() { 561linux-mod_src_install() {
119 local modulename moduledir sourcedir module_temp xarch i 562 debug-print-function ${FUNCNAME} $*
120 xarch="${ARCH}"
121 unset ARCH
122 563
564 local modulename libdir srcdir objdir i n
565
566 strip_modulenames;
123 for i in "${MODULE_NAMES}" 567 for i in ${MODULE_NAMES}
124 do 568 do
125 module_temp="$(echo ${i} | sed -e "s:.*(\(.*\)):\1:")" 569 unset libdir srcdir objdir
126 modulename="${i/(*/}" 570 for n in $(find_module_params ${i})
127 moduledir="${module_temp/:*/}" 571 do
128 moduledir="${moduledir:-misc}" 572 eval ${n/:*}=${n/*:/}
129 sourcedir="${module_temp/*:/}" 573 done
574 libdir=${libdir:-misc}
130 sourcedir="${sourcedir:-${S}}" 575 srcdir=${srcdir:-${S}}
131 576 objdir=${objdir:-${srcdir}}
577
132 einfo "Preparing ${modulename} module" 578 einfo "Installing ${modulename} module"
133 cd ${sourcedir} 579 cd ${objdir} || die "${objdir} does not exist"
134 emake clean || die Unable to make clean. 580 insinto /lib/modules/${KV_FULL}/${libdir}
135 emake ${BUILD_PARAMS} module || die Unable to make ${BUILD_PARAMS} module. 581 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
582 cd ${OLDPWD}
583
584 generate_modulesd ${objdir}/${modulename}
136 done 585 done
137 ARCH="${xarch}"
138} 586}
139 587
140linux-mod_src_install() { 588linux-mod_pkg_preinst() {
141 local modulename moduledir sourcedir module_temp i 589 debug-print-function ${FUNCNAME} $*
142 590
143 for i in "${MODULE_NAMES}" 591 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
144 do 592 [ -d "${D}etc/modules.d" ] && UPDATE_MODULES=true || UPDATE_MODULES=false
145 module_temp="$(echo ${i} | sed -e "s:.*(\(.*\)):\1:")" 593 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
146 modulename="${i/(*/}"
147 moduledir="${module_temp/:*/}"
148 moduledir="${moduledir:-misc}"
149 sourcedir="${module_temp/*:/}"
150 sourcedir="${sourcedir:-${S}}"
151
152 einfo "Installing ${modulename} module"
153 cd ${sourcedir}
154 insinto /lib/modules/${KV_FULL}/${moduledir}
155 doins ${modulename}.${KV_OBJ}
156 done
157} 594}
158 595
159linux-mod_pkg_postinst() { 596linux-mod_pkg_postinst() {
160 update_depmod; 597 debug-print-function ${FUNCNAME} $*
161 update_modules; 598
162 display_postinst; 599 ${UPDATE_DEPMOD} && update_depmod;
600 ${UPDATE_MODULES} && update_modules;
601 ${UPDATE_MODULEDB} && update_moduledb;
163} 602}
603
604linux-mod_pkg_postrm() {
605 debug-print-function ${FUNCNAME} $*
606 remove_moduledb;
607}

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.85

  ViewVC Help
Powered by ViewVC 1.1.20