/[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.86 Revision 1.104
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2011 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.86 2008/10/31 22:24:55 dsd Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.104 2011/08/22 04:46:32 vapier Exp $
4
5# Author(s): John Mylchreest <johnm@gentoo.org>,
6# Stefan Schweizer <genstef@gentoo.org>
7# Maintainer: kernel-misc@gentoo.org
8#
9# Please direct your bugs to the current eclass maintainer :)
10 4
11# @ECLASS: linux-mod.eclass 5# @ECLASS: linux-mod.eclass
12# @MAINTAINER: 6# @MAINTAINER:
13# kernel-misc@gentoo.org 7# kernel-misc@gentoo.org
8# @AUTHOR:
9# John Mylchreest <johnm@gentoo.org>,
10# Stefan Schweizer <genstef@gentoo.org>
14# @BLURB: It provides the functionality required to install external modules against a kernel source tree. 11# @BLURB: It provides the functionality required to install external modules against a kernel source tree.
15# @DESCRIPTION: 12# @DESCRIPTION:
16# This eclass is used to interface with linux-info.eclass in such a way 13# This eclass is used to interface with linux-info.eclass in such a way
17# to provide the functionality and initial functions 14# to provide the functionality and initial functions
18# required to install external modules against a kernel source 15# required to install external modules against a kernel source
41 38
42# @ECLASS-VARIABLE: MODULE_NAMES 39# @ECLASS-VARIABLE: MODULE_NAMES
43# @DESCRIPTION: 40# @DESCRIPTION:
44# It's a string containing the modules to be built automatically using the default 41# It's a string containing the modules to be built automatically using the default
45# src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory. 42# src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory.
46
47# 43#
48# The structure of each MODULE_NAMES entry is as follows: 44# The structure of each MODULE_NAMES entry is as follows:
49# 45#
50# modulename(libdir:srcdir:objdir) 46# modulename(libdir:srcdir:objdir)
51# 47#
52# where: 48# where:
53# 49#
54# modulename = name of the module file excluding the .ko 50# modulename = name of the module file excluding the .ko
55# libdir = place in system modules directory where module is installed: 51# libdir = place in system modules directory where module is installed (by default it's misc)
56# srcdir = place for ebuild to cd to before running make 52# srcdir = place for ebuild to cd to before running make (by default it's ${S})
57# objdir = place the .ko and objects are located after make runs 53# objdir = place the .ko and objects are located after make runs (by default it's set to srcdir)
58# 54#
59# To get an idea of how these variables are used, here's a few lines 55# To get an idea of how these variables are used, here's a few lines
60# of code from around line 540 in this eclass: 56# of code from around line 540 in this eclass:
61# 57#
62# einfo "Installing ${modulename} module" 58# einfo "Installing ${modulename} module"
63# cd ${objdir} || die "${objdir} does not exist" 59# cd ${objdir} || die "${objdir} does not exist"
64# insinto /lib/modules/${KV_FULL}/${libdir} 60# insinto /lib/modules/${KV_FULL}/${libdir}
65# doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" 61# doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
66# 62#
124 120
125# @ECLASS-VARIABLE: KV_OBJ 121# @ECLASS-VARIABLE: KV_OBJ
126# @DESCRIPTION: 122# @DESCRIPTION:
127# It's a read-only variable. It contains the extension of the kernel modules. 123# It's a read-only variable. It contains the extension of the kernel modules.
128 124
129# The order of these is important as both of linux-info and eutils contain
130# set_arch_to_kernel and set_arch_to_portage functions and the ones in eutils
131# are deprecated in favor of the ones in linux-info.
132# See http://bugs.gentoo.org/show_bug.cgi?id=127506
133
134inherit eutils linux-info multilib 125inherit eutils linux-info multilib
135EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm 126EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm
136 127
137IUSE="kernel_linux" 128IUSE="kernel_linux"
138SLOT="0" 129SLOT="0"
139DESCRIPTION="Based on the $ECLASS eclass" 130DESCRIPTION="Based on the $ECLASS eclass"
140RDEPEND="kernel_linux? ( virtual/modutils )" 131RDEPEND="kernel_linux? ( sys-apps/module-init-tools )"
141DEPEND="${RDEPEND} 132DEPEND="${RDEPEND}
142 sys-apps/sed" 133 sys-apps/sed
134 kernel_linux? ( virtual/linux-sources )"
143 135
144# eclass utilities 136# eclass utilities
145# ---------------------------------- 137# ----------------------------------
146 138
147check_vermagic() { 139check_vermagic() {
148 debug-print-function ${FUNCNAME} $* 140 debug-print-function ${FUNCNAME} $*
149 141
150 local curr_gcc_ver=$(gcc -dumpversion) 142 local curr_gcc_ver=$(gcc -dumpversion)
151 local tmpfile old_chost old_gcc_ver result=0 143 local tmpfile old_chost old_gcc_ver result=0
152 144
153 tmpfile=`find ${KV_DIR}/ -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` 145 tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit`
154 tmpfile=${tmpfile//*usr/lib} 146 tmpfile=${tmpfile//*usr/lib}
155 tmpfile=${tmpfile//\/include*} 147 tmpfile=${tmpfile//\/include*}
156 old_chost=${tmpfile//*gcc\/} 148 old_chost=${tmpfile//*gcc\/}
157 old_chost=${old_chost//\/*} 149 old_chost=${old_chost//\/*}
158 old_gcc_ver=${tmpfile//*\/} 150 old_gcc_ver=${tmpfile//*\/}
193 # if we haven't determined the version yet, we need too. 185 # if we haven't determined the version yet, we need too.
194 get_version; 186 get_version;
195 187
196 # if the kernel version is greater than 2.6.6 then we should use 188 # if the kernel version is greater than 2.6.6 then we should use
197 # M= instead of SUBDIRS= 189 # M= instead of SUBDIRS=
190 [ ${KV_MAJOR} -eq 3 ] && return 0
198 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ 191 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \
199 return 0 || return 1 192 return 0 || return 1
200} 193}
201 194
202# @FUNCTION: convert_to_m 195# @FUNCTION: convert_to_m
209 if use_m 202 if use_m
210 then 203 then
211 [ ! -f "${1}" ] && \ 204 [ ! -f "${1}" ] && \
212 die "convert_to_m() requires a filename as an argument" 205 die "convert_to_m() requires a filename as an argument"
213 ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS=" 206 ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS="
214 sed -i 's:SUBDIRS=:M=:g' ${1} 207 sed -i 's:SUBDIRS=:M=:g' "${1}"
215 eend $? 208 eend $?
216 fi 209 fi
217} 210}
218 211
219# internal function 212# internal function
226 219
227 # if we haven't determined the version yet, we need too. 220 # if we haven't determined the version yet, we need too.
228 get_version; 221 get_version;
229 222
230 ebegin "Updating module dependencies for ${KV_FULL}" 223 ebegin "Updating module dependencies for ${KV_FULL}"
231 if [ -r ${KV_OUT_DIR}/System.map ] 224 if [ -r "${KV_OUT_DIR}"/System.map ]
232 then 225 then
233 depmod -ae -F ${KV_OUT_DIR}/System.map -b ${ROOT} -r ${KV_FULL} 226 depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r ${KV_FULL}
234 eend $? 227 eend $?
235 else 228 else
236 ewarn 229 ewarn
237 ewarn "${KV_OUT_DIR}/System.map not found." 230 ewarn "${KV_OUT_DIR}/System.map not found."
238 ewarn "You must manually update the kernel module dependencies using depmod." 231 ewarn "You must manually update the kernel module dependencies using depmod."
248# It calls the update-modules utility. 241# It calls the update-modules utility.
249update_modules() { 242update_modules() {
250 debug-print-function ${FUNCNAME} $* 243 debug-print-function ${FUNCNAME} $*
251 244
252 if [ -x /sbin/update-modules ] && \ 245 if [ -x /sbin/update-modules ] && \
253 grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then 246 grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then
254 ebegin "Updating modules.conf" 247 ebegin "Updating modules.conf"
255 /sbin/update-modules 248 /sbin/update-modules
256 eend $? 249 eend $?
257 elif [ -x /sbin/update-modules ] && \ 250 elif [ -x /sbin/update-modules ] && \
258 grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then 251 grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then
259 ebegin "Updating modules.conf" 252 ebegin "Updating modules.conf"
260 /sbin/update-modules 253 /sbin/update-modules
261 eend $? 254 eend $?
262 fi 255 fi
263} 256}
268# DESCRIPTION: 261# DESCRIPTION:
269# It updates the location of the database used by the module-rebuild utility. 262# It updates the location of the database used by the module-rebuild utility.
270move_old_moduledb() { 263move_old_moduledb() {
271 debug-print-function ${FUNCNAME} $* 264 debug-print-function ${FUNCNAME} $*
272 265
273 local OLDDIR=${ROOT}/usr/share/module-rebuild/ 266 local OLDDIR="${ROOT}"/usr/share/module-rebuild/
274 local NEWDIR=${ROOT}/var/lib/module-rebuild/ 267 local NEWDIR="${ROOT}"/var/lib/module-rebuild/
275 268
276 if [[ -f ${OLDDIR}/moduledb ]]; then 269 if [[ -f "${OLDDIR}"/moduledb ]]; then
277 [[ ! -d ${NEWDIR} ]] && mkdir -p ${NEWDIR} 270 [[ ! -d "${NEWDIR}" ]] && mkdir -p "${NEWDIR}"
278 [[ ! -f ${NEWDIR}/moduledb ]] && \ 271 [[ ! -f "${NEWDIR}"/moduledb ]] && \
279 mv ${OLDDIR}/moduledb ${NEWDIR}/moduledb 272 mv "${OLDDIR}"/moduledb "${NEWDIR}"/moduledb
280 rm -f ${OLDDIR}/* 273 rm -f "${OLDDIR}"/*
281 rmdir ${OLDDIR} 274 rmdir "${OLDDIR}"
282 fi 275 fi
283} 276}
284 277
285# internal function 278# internal function
286# 279#
288# DESCRIPTION: 281# DESCRIPTION:
289# It adds the package to the /var/lib/module-rebuild/moduledb database used by the module-rebuild utility. 282# It adds the package to the /var/lib/module-rebuild/moduledb database used by the module-rebuild utility.
290update_moduledb() { 283update_moduledb() {
291 debug-print-function ${FUNCNAME} $* 284 debug-print-function ${FUNCNAME} $*
292 285
293 local MODULEDB_DIR=${ROOT}/var/lib/module-rebuild/ 286 local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/
294 move_old_moduledb 287 move_old_moduledb
295 288
296 if [[ ! -f ${MODULEDB_DIR}/moduledb ]]; then 289 if [[ ! -f "${MODULEDB_DIR}"/moduledb ]]; then
297 [[ ! -d ${MODULEDB_DIR} ]] && mkdir -p ${MODULEDB_DIR} 290 [[ ! -d "${MODULEDB_DIR}" ]] && mkdir -p "${MODULEDB_DIR}"
298 touch ${MODULEDB_DIR}/moduledb 291 touch "${MODULEDB_DIR}"/moduledb
299 fi 292 fi
300 293
301 if ! grep -qs ${CATEGORY}/${PN}-${PVR} ${MODULEDB_DIR}/moduledb ; then 294 if ! grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then
302 einfo "Adding module to moduledb." 295 einfo "Adding module to moduledb."
303 echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${MODULEDB_DIR}/moduledb 296 echo "a:1:${CATEGORY}/${PN}-${PVR}" >> "${MODULEDB_DIR}"/moduledb
304 fi 297 fi
305} 298}
306 299
307# internal function 300# internal function
308# 301#
311# It removes the package from the /var/lib/module-rebuild/moduledb database used by 304# It removes the package from the /var/lib/module-rebuild/moduledb database used by
312# the module-rebuild utility. 305# the module-rebuild utility.
313remove_moduledb() { 306remove_moduledb() {
314 debug-print-function ${FUNCNAME} $* 307 debug-print-function ${FUNCNAME} $*
315 308
316 local MODULEDB_DIR=${ROOT}/var/lib/module-rebuild/ 309 local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/
317 move_old_moduledb 310 move_old_moduledb
318 311
319 if grep -qs ${CATEGORY}/${PN}-${PVR} ${MODULEDB_DIR}/moduledb ; then 312 if grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then
320 einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb." 313 einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb."
321 sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" ${MODULEDB_DIR}/moduledb 314 sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" "${MODULEDB_DIR}"/moduledb
322 fi 315 fi
323} 316}
324 317
325# @FUNCTION: set_kvobj 318# @FUNCTION: set_kvobj
326# @DESCRIPTION: 319# @DESCRIPTION:
327# It sets the KV_OBJ variable. 320# It sets the KV_OBJ variable.
328set_kvobj() { 321set_kvobj() {
329 debug-print-function ${FUNCNAME} $* 322 debug-print-function ${FUNCNAME} $*
330 323
331 if kernel_is 2 6 324 if kernel_is ge 2 6
332 then 325 then
333 KV_OBJ="ko" 326 KV_OBJ="ko"
334 else 327 else
335 KV_OBJ="o" 328 KV_OBJ="o"
336 fi 329 fi
414 module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})" 407 module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})"
415 module_config="${T}/modulesd-${currm}" 408 module_config="${T}/modulesd-${currm}"
416 409
417 ebegin "Preparing file for modules.d" 410 ebegin "Preparing file for modules.d"
418 #----------------------------------------------------------------------- 411 #-----------------------------------------------------------------------
419 echo "# modules.d configuration file for ${currm}" >> ${module_config} 412 echo "# modules.d configuration file for ${currm}" >> "${module_config}"
420 #----------------------------------------------------------------------- 413 #-----------------------------------------------------------------------
421 [[ -n ${module_docs} ]] && \ 414 [[ -n ${module_docs} ]] && \
422 echo "# For more information please read:" >> ${module_config} 415 echo "# For more information please read:" >> "${module_config}"
423 for t in ${module_docs} 416 for t in ${module_docs}
424 do 417 do
425 echo "# ${t//*\/}" >> ${module_config} 418 echo "# ${t//*\/}" >> "${module_config}"
426 done 419 done
427 echo >> ${module_config} 420 echo >> "${module_config}"
428 421
429 #----------------------------------------------------------------------- 422 #-----------------------------------------------------------------------
430 if [[ ${module_aliases} -gt 0 ]] 423 if [[ ${module_aliases} -gt 0 ]]
431 then 424 then
432 echo "# Internal Aliases - Do not edit" >> ${module_config} 425 echo "# Internal Aliases - Do not edit" >> "${module_config}"
433 echo "# ------------------------------" >> ${module_config} 426 echo "# ------------------------------" >> "${module_config}"
434 427
435 for((t=0; t<${module_aliases}; t++)) 428 for((t=0; t<${module_aliases}; t++))
436 do 429 do
437 echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \ 430 echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \
438 >> ${module_config} 431 >> "${module_config}"
439 done 432 done
440 echo '' >> ${module_config} 433 echo '' >> "${module_config}"
441 fi 434 fi
442 435
443 #----------------------------------------------------------------------- 436 #-----------------------------------------------------------------------
444 if [[ -n ${module_modinfo} ]] 437 if [[ -n ${module_modinfo} ]]
445 then 438 then
446 echo >> ${module_config} 439 echo >> "${module_config}"
447 echo "# Configurable module parameters" >> ${module_config} 440 echo "# Configurable module parameters" >> "${module_config}"
448 echo "# ------------------------------" >> ${module_config} 441 echo "# ------------------------------" >> "${module_config}"
449 myIFS="${IFS}" 442 myIFS="${IFS}"
450 IFS="$(echo -en "\n\b")" 443 IFS="$(echo -en "\n\b")"
451 444
452 for t in ${module_modinfo} 445 for t in ${module_modinfo}
453 do 446 do
454 myVAR="$(echo ${t#*:} | grep -e " [0-9][ =]" | sed "s:.*\([01][= ]\).*:\1:")" 447 myVAR="$(echo ${t#*:} | grep -e " [0-9][ =]" | sed "s:.*\([01][= ]\).*:\1:")"
455 if [[ -n ${myVAR} ]] 448 if [[ -n ${myVAR} ]]
456 then 449 then
457 module_opts="${module_opts} ${t%%:*}:${myVAR}" 450 module_opts="${module_opts} ${t%%:*}:${myVAR}"
458 fi 451 fi
459 echo -e "# ${t%%:*}:\t${t#*:}" >> ${module_config} 452 echo -e "# ${t%%:*}:\t${t#*:}" >> "${module_config}"
460 done 453 done
461 IFS="${myIFS}" 454 IFS="${myIFS}"
462 echo '' >> ${module_config} 455 echo '' >> "${module_config}"
463 fi 456 fi
464 457
465 #----------------------------------------------------------------------- 458 #-----------------------------------------------------------------------
466 if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]] 459 if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]]
467 then 460 then
468 # So lets do some guesswork eh? 461 # So lets do some guesswork eh?
469 if [[ -n ${module_opts} ]] 462 if [[ -n ${module_opts} ]]
470 then 463 then
471 echo "# For Example..." >> ${module_config} 464 echo "# For Example..." >> "${module_config}"
472 echo "# --------------" >> ${module_config} 465 echo "# --------------" >> "${module_config}"
473 for t in ${module_opts} 466 for t in ${module_opts}
474 do 467 do
475 echo "# options ${currm} ${t//:*}=${t//*:}" >> ${module_config} 468 echo "# options ${currm} ${t//:*}=${t//*:}" >> "${module_config}"
476 done 469 done
477 echo '' >> ${module_config} 470 echo '' >> "${module_config}"
478 fi 471 fi
479 elif [[ ${module_examples} -gt 0 ]] 472 elif [[ ${module_examples} -gt 0 ]]
480 then 473 then
481 echo "# For Example..." >> ${module_config} 474 echo "# For Example..." >> "${module_config}"
482 echo "# --------------" >> ${module_config} 475 echo "# --------------" >> "${module_config}"
483 for((t=0; t<${module_examples}; t++)) 476 for((t=0; t<${module_examples}; t++))
484 do 477 do
485 echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \ 478 echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \
486 >> ${module_config} 479 >> "${module_config}"
487 done 480 done
488 echo '' >> ${module_config} 481 echo '' >> "${module_config}"
489 fi 482 fi
490 483
491 #----------------------------------------------------------------------- 484 #-----------------------------------------------------------------------
492 if [[ ${module_additions} -gt 0 ]] 485 if [[ ${module_additions} -gt 0 ]]
493 then 486 then
494 for((t=0; t<${module_additions}; t++)) 487 for((t=0; t<${module_additions}; t++))
495 do 488 do
496 echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \ 489 echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \
497 >> ${module_config} 490 >> "${module_config}"
498 done 491 done
499 echo '' >> ${module_config} 492 echo '' >> "${module_config}"
500 fi 493 fi
501 494
502 #----------------------------------------------------------------------- 495 #-----------------------------------------------------------------------
503 496
504 # then we install it 497 # then we install it
505 if kernel_is ge 2 6; then 498 if kernel_is ge 2 6; then
506 insinto /etc/modprobe.d 499 insinto /etc/modprobe.d
507 else 500 else
508 insinto /etc/modules.d 501 insinto /etc/modules.d
509 fi 502 fi
510 newins ${module_config} ${currm_path//*\/} 503 newins "${module_config}" "${currm_path//*\/}.conf"
511 504
512 # and install any documentation we might have. 505 # and install any documentation we might have.
513 [[ -n ${module_docs} ]] && dodoc ${module_docs} 506 [[ -n ${module_docs} ]] && dodoc ${module_docs}
514 done 507 done
515 eend 0 508 eend 0
574# configured, verifies that the sources are prepared, verifies that the modules support is builtin 567# configured, verifies that the sources are prepared, verifies that the modules support is builtin
575# in the kernel and sets the object extension KV_OBJ. 568# in the kernel and sets the object extension KV_OBJ.
576linux-mod_pkg_setup() { 569linux-mod_pkg_setup() {
577 debug-print-function ${FUNCNAME} $* 570 debug-print-function ${FUNCNAME} $*
578 571
572 local is_bin="${MERGE_TYPE}"
573
574 # If we are installing a binpkg, take a different path.
575 # use MERGE_TYPE if available (eapi>=4); else use non-PMS EMERGE_FROM (eapi<4)
576 if has ${EAPI} 0 1 2 3; then
577 is_bin=${EMERGE_FROM}
578 fi
579
580 if [[ ${is_bin} == binary ]]; then
581 linux-mod_pkg_setup_binary
582 return
583 fi
584
579 linux-info_pkg_setup; 585 linux-info_pkg_setup;
580 require_configured_kernel 586 require_configured_kernel
581 check_kernel_built; 587 check_kernel_built;
582 strip_modulenames; 588 strip_modulenames;
583 [[ -n ${MODULE_NAMES} ]] && check_modules_supported 589 [[ -n ${MODULE_NAMES} ]] && check_modules_supported
586 # who intentionally use different kernel and userland compilers can be 592 # who intentionally use different kernel and userland compilers can be
587 # introduced - Jason Wever <weeve@gentoo.org>, 23 Oct 2005 593 # introduced - Jason Wever <weeve@gentoo.org>, 23 Oct 2005
588 #check_vermagic; 594 #check_vermagic;
589} 595}
590 596
597# @FUNCTION: linux-mod_pkg_setup_binary
598# @DESCRIPTION:
599# Perform all kernel option checks non-fatally, as the .config and
600# /proc/config.gz might not be present. Do not do anything that requires kernel
601# sources.
602linux-mod_pkg_setup_binary() {
603 debug-print-function ${FUNCNAME} $*
604 local new_CONFIG_CHECK
605 # ~ needs always to be quoted, else bash expands it.
606 for config in $CONFIG_CHECK ; do
607 optional='~'
608 [[ ${config:0:1} == "~" ]] && optional=''
609 new_CONFIG_CHECK="${new_CONFIG_CHECK} ${optional}${config}"
610 done
611 export CONFIG_CHECK="${new_CONFIG_CHECK}"
612 linux-info_pkg_setup;
613}
614
591strip_modulenames() { 615strip_modulenames() {
592 debug-print-function ${FUNCNAME} $* 616 debug-print-function ${FUNCNAME} $*
593 617
594 local i 618 local i
595 for i in ${MODULE_IGNORE}; do 619 for i in ${MODULE_IGNORE}; do
613 ABI="${KERNEL_ABI}" 637 ABI="${KERNEL_ABI}"
614 638
615 BUILD_TARGETS=${BUILD_TARGETS:-clean module} 639 BUILD_TARGETS=${BUILD_TARGETS:-clean module}
616 strip_modulenames; 640 strip_modulenames;
617 cd "${S}" 641 cd "${S}"
642 touch Module.symvers
618 for i in ${MODULE_NAMES} 643 for i in ${MODULE_NAMES}
619 do 644 do
620 unset libdir srcdir objdir 645 unset libdir srcdir objdir
621 for n in $(find_module_params ${i}) 646 for n in $(find_module_params ${i})
622 do 647 do
626 srcdir=${srcdir:-${S}} 651 srcdir=${srcdir:-${S}}
627 objdir=${objdir:-${srcdir}} 652 objdir=${objdir:-${srcdir}}
628 653
629 if [ ! -f "${srcdir}/.built" ]; 654 if [ ! -f "${srcdir}/.built" ];
630 then 655 then
631 cd ${srcdir} 656 cd "${srcdir}"
657 ln -s "${S}"/Module.symvers Module.symvers
632 einfo "Preparing ${modulename} module" 658 einfo "Preparing ${modulename} module"
633 if [[ -n ${ECONF_PARAMS} ]] 659 if [[ -n ${ECONF_PARAMS} ]]
634 then 660 then
635 econf ${ECONF_PARAMS} || \ 661 econf ${ECONF_PARAMS} || \
636 die "Unable to run econf ${ECONF_PARAMS}" 662 die "Unable to run econf ${ECONF_PARAMS}"
646 LDFLAGS=\"$(get_abi_LDFLAGS)\" \ 672 LDFLAGS=\"$(get_abi_LDFLAGS)\" \
647 ${BUILD_FIXES} \ 673 ${BUILD_FIXES} \
648 ${BUILD_PARAMS} \ 674 ${BUILD_PARAMS} \
649 ${BUILD_TARGETS} " \ 675 ${BUILD_TARGETS} " \
650 || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}" 676 || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
677 cd "${OLDPWD}"
651 touch ${srcdir}/.built 678 touch "${srcdir}"/.built
652 cd ${OLDPWD}
653 fi 679 fi
654 done 680 done
655 681
656 set_arch_to_portage 682 set_arch_to_portage
657 ABI="${myABI}" 683 ABI="${myABI}"
684 libdir=${libdir:-misc} 710 libdir=${libdir:-misc}
685 srcdir=${srcdir:-${S}} 711 srcdir=${srcdir:-${S}}
686 objdir=${objdir:-${srcdir}} 712 objdir=${objdir:-${srcdir}}
687 713
688 einfo "Installing ${modulename} module" 714 einfo "Installing ${modulename} module"
689 cd ${objdir} || die "${objdir} does not exist" 715 cd "${objdir}" || die "${objdir} does not exist"
690 insinto /lib/modules/${KV_FULL}/${libdir} 716 insinto /lib/modules/${KV_FULL}/${libdir}
691 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" 717 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
692 cd ${OLDPWD} 718 cd "${OLDPWD}"
693 719
694 generate_modulesd ${objdir}/${modulename} 720 generate_modulesd "${objdir}/${modulename}"
695 done 721 done
696} 722}
697 723
698# @FUNCTION: linux-mod_pkg_preinst 724# @FUNCTION: linux-mod_pkg_preinst
699# @DESCRIPTION: 725# @DESCRIPTION:

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.104

  ViewVC Help
Powered by ViewVC 1.1.20