summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorJohn Mylchreest <johnm@gentoo.org>2004-12-14 18:56:46 +0000
committerJohn Mylchreest <johnm@gentoo.org>2004-12-14 18:56:46 +0000
commit1311eda0469b99bffc4c6f07187c22cd71ba8cdd (patch)
treeb7b8bad51de25cf8e78973e21158ecf3c7b4837e /eclass
parentVersion bump. (Manifest recommit) (diff)
downloadgentoo-2-1311eda0469b99bffc4c6f07187c22cd71ba8cdd.tar.gz
gentoo-2-1311eda0469b99bffc4c6f07187c22cd71ba8cdd.tar.bz2
gentoo-2-1311eda0469b99bffc4c6f07187c22cd71ba8cdd.zip
adding documentation, and changing the MODULE_NAMES parsing slightly
Diffstat (limited to 'eclass')
-rw-r--r--eclass/linux-info.eclass50
-rw-r--r--eclass/linux-mod.eclass97
2 files changed, 119 insertions, 28 deletions
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 96b73bfb63e0..b0e20d8a6f68 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -1,10 +1,53 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.9 2004/12/10 22:43:03 johnm Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.10 2004/12/14 18:56:46 johnm Exp $
#
-# This eclass provides functions for querying the installed kernel
-# source version, selected kernel options etc.
+# Description: This eclass is used as a central eclass for accessing kernel
+# related information for sources already installed.
+# It is vital for linux-mod to function correctly, and is split
+# out so that any ebuild behaviour "templates" are abstracted out
+# using additional eclasses.
#
+# Maintainer: John Mylchreest <johnm@gentoo.org>
+# Copyright 2004 Gentoo Linux
+#
+# Please direct your bugs to the current eclass maintainer :)
+
+# A Couple of env vars are available to effect usage of this eclass
+# These are as follows:
+#
+# Env Var Option Description
+# KERNEL_DIR <string> The directory containing kernel the target kernel
+# sources.
+# CONFIG_CHECK <string> a list of .config options to check for before
+# proceeding with the install. ie: CONFIG_CHECK="MTRR"
+# You can also check that an option doesn't exist by
+# prepending it with an exclamation mark (!).
+# ie: CONFIG_CHECK="!MTRR"
+# <CFG>_ERROR <string> The error message to display when the above check
+# fails. <CFG> should reference the appropriate option
+# as above. ie: MTRR_ERROR="MTRR exists in the .config
+# but shouldn't!!"
+# KBUILD_OUTPUT <string> This is passed on commandline, or can be set from
+# the kernel makefile. This contains the directory
+# which is to be used as the kernel object directory.
+
+# There are also a couple of variables which are set by this, and shouldn't be
+# set by hand. These are as follows:
+#
+# Env Var Option Description
+# KV_FULL <string> The full kernel version. ie: 2.6.9-gentoo-johnm-r1
+# KV_MAJOR <integer> The kernel major version. ie: 2
+# KV_MINOR <integer> The kernel minor version. ie: 6
+# KV_PATCH <integer> The kernel patch version. ie: 9
+# KV_EXTRA <string> The kernel EXTRAVERSION. ie: -gentoo
+# KV_LOCAL <string> The kernel LOCALVERSION concatenation. ie: -johnm
+# KV_DIR <string> The kernel source directory, will be null if
+# KERNEL_DIR is invalid.
+# KV_OUT_DIR <string> The kernel object directory. will be KV_DIR unless
+# koutput is used. This should be used for referencing
+# .config.
+
ECLASS=linux-info
INHERITED="$INHERITED $ECLASS"
@@ -388,4 +431,5 @@ local DEFLATE
linux-info_pkg_setup() {
get_version;
+ [ -n "${CONFIG_CHECK}" ] && check_extra_config;
}
diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
index d7b9ea6b79a9..96a984a66582 100644
--- a/eclass/linux-mod.eclass
+++ b/eclass/linux-mod.eclass
@@ -1,9 +1,52 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.9 2004/12/06 22:23:17 johnm Exp $
-
-# This eclass provides functions for compiling external kernel modules
-# from source.
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.10 2004/12/14 18:56:46 johnm Exp $
+
+# Description: This eclass is used to interface with linux-info in such a way
+# to provide the functionality required and initial functions
+# required to install external modules against a kernel source
+# tree.
+#
+# Maintainer: John Mylchreest <johnm@gentoo.org>
+# Copyright 2004 Gentoo Linux
+#
+# Please direct your bugs to the current eclass maintainer :)
+
+# A Couple of env vars are available to effect usage of this eclass
+# These are as follows:
+#
+# Env Var Option Default Description
+# KERNEL_DIR <string> /usr/src/linux The directory containing kernel
+# the target kernel sources.
+# BUILD_PARAMS <string> The parameters to pass to make.
+# BUILD_TARGETS <string> clean modules The build targets to pass to make.
+# MODULE_NAMES <string> This is the modules which are
+# to be built automatically using the
+# default pkg_compile/install. They
+# are explained properly below.
+
+
+# MODULE_NAMES - Detailed Overview
+#
+# The structure of each MODULE_NAMES entry is as follows:
+# modulename(libmodulesdir:modulesourcedir)
+# for example:
+# MODULE_NAMES="module_pci(pci:${S}/pci) module_usb(usb:${S}/usb)"
+#
+# what this would do is
+# cd ${S}/pci
+# make ${BUILD_PARAMS} ${BUILD_TARGETS}
+# insinto /lib/modules/${KV_FULL}/pci
+# doins module_pci.${KV_OBJ}
+#
+# cd ${S}/usb
+# make ${BUILD_PARAMS} ${BUILD_TARGETS}
+# insinto /lib/modules/${KV_FULL}/usb
+# doins module_usb.${KV_OBJ}
+#
+# if the modulessourcedir isnt specified, it assumes ${S}
+# if the libmodulesdir isnt specified, it assumes misc.
+# if no seperator is defined ":" then it assumes the argument is modulesourcedir
inherit linux-info
ECLASS=linux-mod
@@ -15,11 +58,6 @@ SLOT=0
DEPEND="virtual/linux-sources
sys-apps/sed"
-
-# This eclass is designed to help ease the installation of external kernel
-# modules into the kernel tree.
-
-
# eclass utilities
# ----------------------------------
@@ -83,7 +121,7 @@ display_postinst() {
# if we haven't determined the version yet, we need too.
get_version;
- local modulename moduledir sourcedir module_temp file i
+ local modulename moduledir sourcedir moduletemp file i
file=${ROOT}/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}
file=${file/\/\///}
@@ -92,11 +130,14 @@ display_postinst() {
einfo "please type the following as root:"
for i in ${MODULE_NAMES}
do
- module_temp="$(echo ${i} | sed -e "s:.*(\(.*\)):\1:")"
- modulename="${i/(*/}"
- moduledir="${module_temp/:*/}"
+ moduletemp="$(echo ${i} | sed -e "s:\(.*\)(\(.*\)):\1 \2:")"
+ modulename="${moduletemp/ */}"
+ moduletemp="${moduletemp/* /}"
+ # if we specify two args, then we can set moduledir
+ [ -z "${moduletemp/*:*/}" ] && moduledir="${moduletemp/:*/}"
+ # if we didnt pass the brackets, then we shouldnt accept anything
+ [ -n "${moduletemp/${modulename}/}" ] && sourcedir="${moduletemp/*:/}"
moduledir="${moduledir:-misc}"
- sourcedir="${module_temp/*:/}"
sourcedir="${sourcedir:-${S}}"
einfo " # echo \"${modulename}\" >> ${file}"
@@ -116,19 +157,22 @@ linux-mod_pkg_setup() {
}
linux-mod_src_compile() {
- local modulename moduledir sourcedir module_temp xarch i
+ local modulename moduledir sourcedir moduletemp xarch i
xarch="${ARCH}"
unset ARCH
for i in ${MODULE_NAMES}
do
- module_temp="$(echo ${i} | sed -e "s:.*(\(.*\)):\1:")"
- modulename="${i/(*/}"
- moduledir="${module_temp/:*/}"
+ moduletemp="$(echo ${i} | sed -e "s:\(.*\)(\(.*\)):\1 \2:")"
+ modulename="${moduletemp/ */}"
+ moduletemp="${moduletemp/* /}"
+ # if we specify two args, then we can set moduledir
+ [ -z "${moduletemp/*:*/}" ] && moduledir="${moduletemp/:*/}"
+ # if we didnt pass the brackets, then we shouldnt accept anything
+ [ -n "${moduletemp/${modulename}/}" ] && sourcedir="${moduletemp/*:/}"
moduledir="${moduledir:-misc}"
- sourcedir="${module_temp/*:/}"
sourcedir="${sourcedir:-${S}}"
-
+
einfo "Preparing ${modulename} module"
cd ${sourcedir}
emake ${BUILD_PARAMS} ${BUILD_TARGETS:-clean module} || die Unable to make ${BUILD_PARAMS} ${BUILD_TARGETS:-clean module}.
@@ -137,15 +181,18 @@ linux-mod_src_compile() {
}
linux-mod_src_install() {
- local modulename moduledir sourcedir module_temp i
+ local modulename moduledir sourcedir moduletemp i
for i in ${MODULE_NAMES}
do
- module_temp="$(echo ${i} | sed -e "s:.*(\(.*\)):\1:")"
- modulename="${i/(*/}"
- moduledir="${module_temp/:*/}"
+ moduletemp="$(echo ${i} | sed -e "s:\(.*\)(\(.*\)):\1 \2:")"
+ modulename="${moduletemp/ */}"
+ moduletemp="${moduletemp/* /}"
+ # if we specify two args, then we can set moduledir
+ [ -z "${moduletemp/*:*/}" ] && moduledir="${moduletemp/:*/}"
+ # if we didnt pass the brackets, then we shouldnt accept anything
+ [ -n "${moduletemp/${modulename}/}" ] && sourcedir="${moduletemp/*:/}"
moduledir="${moduledir:-misc}"
- sourcedir="${module_temp/*:/}"
sourcedir="${sourcedir:-${S}}"
einfo "Installing ${modulename} module"