/[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.98 Revision 1.107
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.98 2010/01/17 04:00:07 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.107 2012/08/30 23:52:59 mpagano 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#
122# documents for <modulename>. These files are installed in the live tree. 119# documents for <modulename>. These files are installed in the live tree.
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
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 124
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"
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
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}" ${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."
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
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
579 # If we are installing a binpkg, take a different path. 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 [[ $EMERGE_FROM == binary ]]; then 580 if [[ ${is_bin} == binary ]]; then
581 linux-mod_pkg_setup_binary 581 linux-mod_pkg_setup_binary
582 return 582 return
583 fi 583 fi
584 584
585 linux-info_pkg_setup; 585 linux-info_pkg_setup;
600# /proc/config.gz might not be present. Do not do anything that requires kernel 600# /proc/config.gz might not be present. Do not do anything that requires kernel
601# sources. 601# sources.
602linux-mod_pkg_setup_binary() { 602linux-mod_pkg_setup_binary() {
603 debug-print-function ${FUNCNAME} $* 603 debug-print-function ${FUNCNAME} $*
604 local new_CONFIG_CHECK 604 local new_CONFIG_CHECK
605 # ~ needs always to be quoted, else bash expands it.
605 for config in $CONFIG_CHECK ; do 606 for config in $CONFIG_CHECK ; do
606 case ${config:0:1} in 607 optional='~'
607 ~) optional="" ;; 608 [[ ${config:0:1} == "~" ]] && optional=''
608 *) optional="~" ;;
609 esac
610 new_CONFIG_CHECK="${new_CONFIG_CHECK} ${optional}${config}" 609 new_CONFIG_CHECK="${new_CONFIG_CHECK} ${optional}${config}"
611 done 610 done
612 export CONFIG_CHECK="${new_CONFIG_CHECK}" 611 export CONFIG_CHECK="${new_CONFIG_CHECK}"
613 linux-info_pkg_setup; 612 linux-info_pkg_setup;
614} 613}

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.107

  ViewVC Help
Powered by ViewVC 1.1.20