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

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.108

  ViewVC Help
Powered by ViewVC 1.1.20