|
List Archive: gentoo-kernel
Hi,
As suggested by cyfred, I've written some code to allow /etc/modules.d files
to be created automatically.
I have attached an updated version of the nvidia-kernel ebuild that uses this,
also the nvidia source had to be patched to export parameter descriptions
(but any well written module will not require this).
Here is the /etc/modules.d/nvidia file which gets produced (it has linewrapped
in this mail, but hopefully you get the picture)
----------
# Configuration file for nvidia module
# Internal aliases, do not edit
alias char-major-195 nvidia
alias /dev/nvidiactl char-major-195
# Configurable module parameters
# For more details, see /usr/share/doc/nvidia-kernel-1.0.6629/README.gz
#
# silence_nvidia_output - Silence output: 0 (default, verbose) or 1 (silent)
# NVreg_EnableVia4x - Enable AGP4x on VIA chipsets (default disabled)
# NVreg_EnableALiAGP - Enable AGP on ALi1541/1647 chipsets (default disabled)
# NVreg_NvAGP - Select which AGPGART is used if unspecified by X - 0
(disable), 1 (use nvidia), 2 (use kernel), 3 (try 2 then 1, default)
# NVreg_EnableAGPSBA - Enable AGP Side Band Addressing
# NVreg_EnableAGPFW - Enable AGP Fast Writes (default disabled)
# NVreg_SoftEDIDs - Enable dynamic generation of EDID info (default enabled)
# NVreg_Mobile - Select Mobile registry key when SoftEDIDs is disabled - 0
(auto, default), 1 (Dell), 2 (Toshiba), 3 (other), 4 (Compal/Toshiba), 5 (Gateway)
# To enable Side Band Adressing and Fast Writes, uncomment the example below:
# options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1
-----------
I have also attached an eclass diff which implements this. I'm looking for
comments on the ebuild interface to this as much as anything else.
I have also added a CONFIG_CHECK_ERROR variable which can be used to specify a
custom message when support for required components is not detected - the
attached nvidia module has been converted to using this too.
Daniel
|
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.6629.ebuild,v 1.9 2004/11/30 01:25:56 cyfred Exp $
inherit eutils linux-mod
X86_PKG_V="pkg1"
AMD64_PKG_V="pkg2"
NV_V="${PV/1.0./1.0-}"
X86_NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${NV_V}"
DESCRIPTION="Linux kernel module for the NVIDIA X11 driver"
HOMEPAGE="http://www.nvidia.com/"
SRC_URI="x86? (ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${X86_NV_PACKAGE}-${X86_PKG_V}.run)
amd64? (http://download.nvidia.com/XFree86/Linux-x86_64/${NV_V}/${AMD64_NV_PACKAGE}-${AMD64_PKG_V}.run)"
if use x86; then
PKG_V="${X86_PKG_V}"
NV_PACKAGE="${X86_NV_PACKAGE}"
elif use amd64; then
PKG_V="${AMD64_PKG_V}"
NV_PACKAGE="${AMD64_NV_PACKAGE}"
fi
S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
LICENSE="NVIDIA"
SLOT="0"
KEYWORDS="-* ~x86 ~amd64"
RESTRICT="nostrip"
IUSE=""
DEPEND="virtual/linux-sources"
export _POSIX2_VERSION="199209"
MODULE_NAMES="nvidia(video:${S})"
BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} SYSOUT=${KV_OUT_DIR}"
CONFIG_CHECK="MTRR"
CONFIG_CHECK_ERROR="This version needs MTRR support for most chipsets!
Please enable MTRR support in your kernel config, found at:
Processor type and features -> [*] MTRR (Memory Type Range Register) support
and recompile your kernel"
MODCONFIG_nvidia_README="/usr/share/doc/${PF}/README.gz"
MODCONFIG_nvidia_ALIASES=(
"char-major-195 nvidia"
"/dev/nvidiactl char-major-195"
)
MODCONFIG_nvidia_OPTSTEXT="To enable Side Band Adressing and Fast Writes, uncomment the example below:"
MODCONFIG_nvidia_OPTS="NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1"
MODCONFIG_nvidia_OPTSEXAMPLEONLY=yes
src_unpack() {
# 2.6.10_rc1-mm{1,2,3} all EXPORT_SYMBOL_GPL the udev functions, this breaks loading
CS="$(grep -c EXPORT_SYMBOL\(class_simple_create\)\; ${KV_DIR}/drivers/base/class_simple.c)"
if [ "${CS}" == "0" ]
then
ewarn "Your current kernel uses EXPORT_SYMBOL_GPL() on some methods required by nvidia-kernel."
ewarn "This probably means you are using 2.6.10_rc1-mm*. Please change away from mm-sources until this is"
ewarn "revised and a solution released into the mm branch, development-sources will work."
die "Incompatible kernel export."
fi
if [ ${KV_MINOR} -ge 6 -a ${KV_PATCH} -lt 7 ]
then
echo
ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
ewarn "This is not officially supported for ${P}. It is likely you"
ewarn "will not be able to compile or use the kernel module."
ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
echo
ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
fi
cd ${WORKDIR}
bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
# Add patches below, with a breif description.
cd ${S}
# Any general patches should go here
# Shutup pointer arith warnings
use x86 && epatch ${FILESDIR}/${PV}/nv-shutup-warnings.patch
use amd64 && epatch ${FILESDIR}/${PV}/nv-amd64-shutup-warnings.patch
# Fix a limitation on available video memory bug #71684
epatch ${FILESDIR}/${PV}/nv-fix-memory-limit.patch
# Fix the vm_flags to only have VM_IO, and not VM_LOCKED as well
epatch ${FILESDIR}/${PV}/nv-vm_flags-no-VM_LOCKED.patch
# Give descriptions to module parameters
epatch ${FILESDIR}/${PV}/nv-parm-descriptions.patch
# Now any patches specific to the 2.6 kernel should go here
if kernel_is 2 6
then
einfo "Applying 2.6 kernel patches"
# Fix the /usr/src/linux/include/asm not existing on koutput issue #58294
epatch ${FILESDIR}/${PV}/conftest_koutput_includes.patch
# Fix pgd_offset() -> pml4_pgd_offset() for >=2.6.10-rc1-mm3
epatch ${FILESDIR}/${PV}/nv-pgd_offset.patch
# Speedup driver for 2.6 kernel to be on par with 2.4 kernel
epatch ${FILESDIR}/${PV}/nv-pgprot-speedup.patch
# Fix calling of smp_processor_id() when preempt is enabled
epatch ${FILESDIR}/${PV}/nv-disable-preempt-on-smp_processor_id.patch
fi
# if you set this then it's your own fault when stuff breaks :)
[ -n "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile.*
# if greater than 2.6.5 use M= instead of SUBDIR=
convert_to_m ${S}/Makefile.kbuild
}
src_install() {
linux-mod_src_install
# Docs
dodoc ${S}/../../share/doc/README
# The device creation script
into /
newsbin ${S}/makedevices.sh NVmakedevices.sh
}
pkg_postinst() {
if [ "${ROOT}" = "/" ] && \
[ ! -e /dev/.devfsd ] && \
[ ! -e /dev/.udev ] && \
[ -x /sbin/NVmakedevices.sh ]
then
/sbin/NVmakedevices.sh >/dev/null 2>&1
fi
linux-mod_pkg_postinst
}
|
--- NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-registry.c.orig 2004-12-05 14:00:55.266756864 +0000
+++ NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-registry.c 2004-12-05 14:28:46.819642200 +0000
@@ -112,6 +112,8 @@
static int NVreg_EnableVia4x = 0;
NV_MODULE_PARAMETER(NVreg_EnableVia4x);
+MODULE_PARM_DESC(NVreg_EnableVia4x, "Enable AGP4x on VIA chipsets "
+ "(default disabled)");
/*
* Option: EnableALiAGP
@@ -135,6 +137,8 @@
static int NVreg_EnableALiAGP = 0;
NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
+MODULE_PARM_DESC(NVreg_EnableALiAGP, "Enable AGP on ALi1541/1647 chipsets "
+ "(default disabled)");
/*
* Option: ReqAGPRate
@@ -188,7 +192,9 @@
static int NVreg_NvAGP = 3;
NV_MODULE_PARAMETER(NVreg_NvAGP);
-
+MODULE_PARM_DESC(NVreg_NvAGP, "Select which AGPGART is used if unspecified "
+ "by X - 0 (disable), 1 (use nvidia), 2 (use kernel), "
+ "3 (try 2 then 1, default)");
/*
* Option: EnableAGPSBA
@@ -222,6 +228,7 @@
#endif
NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
+MODULE_PARM_DESC(NVreg_EnableAGPSBA, "Enable AGP Side Band Addressing");
/*
* Option: EnableAGPFW
@@ -239,13 +246,12 @@
*
* 0 = disable Fast Writes (default)
* 1 = enable Fast Writes (if supported)
- *
- * This option is disabled by default, see below for information on how
- * to enable it.
*/
static int NVreg_EnableAGPFW = 0;
NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
+MODULE_PARM_DESC(NVreg_EnableAGPFW, "Enable AGP Fast Writes "
+ "(default disabled)");
/*
* Option: SoftEDIDs
@@ -265,6 +271,8 @@
static int NVreg_SoftEDIDs = 1;
NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
+MODULE_PARM_DESC(NVreg_SoftEDIDs, "Enable dynamic generation of EDID info "
+ "(default enabled)");
/*
* Option: Mobile
@@ -289,6 +297,9 @@
static int NVreg_Mobile = ~0;
NV_MODULE_PARAMETER(NVreg_Mobile);
+MODULE_PARM_DESC(NVreg_Mobile, "Select Mobile registry key when SoftEDIDs is "
+ "disabled - 0 (auto, default), 1 (Dell), 2 (Toshiba), 3 (other), "
+ "4 (Compal/Toshiba), 5 (Gateway)");
static int NVreg_ResmanDebugLevel = ~0;
--- NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-interface.c.orig 2004-12-05 13:54:32.544939424 +0000
+++ NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-interface.c 2004-12-05 14:00:41.740813120 +0000
@@ -725,7 +725,8 @@
static int silence_nvidia_output = 0;
NV_MODULE_PARAMETER(silence_nvidia_output);
-
+MODULE_PARM_DESC(silence_nvidia_output, "Silence output: 0 (default, verbose) "
+ " or 1 (silent)");
//
// this is what actually outputs the data.
|
Index: linux-info.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v
retrieving revision 1.7
diff -u -b -B -r1.7 linux-info.eclass
--- linux-info.eclass 5 Dec 2004 12:46:58 -0000 1.7
+++ linux-info.eclass 5 Dec 2004 15:25:03 -0000
@@ -304,6 +304,15 @@
if [ -n "${error}" ] ;
then
+ if [ ! -z "${CONFIG_CHECK_ERROR}" ] ;
+ then
+ echo
+ IFS="$(echo -en "\n\b")"
+ for i in ${CONFIG_CHECK_ERROR}
+ do eerror ${i}
+ done
+ echo
+ fi
eerror "Please check to make sure these options are set correctly."
eerror "Once you have satisfied these options, please try merging"
eerror "this package again."
Index: linux-mod.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v
retrieving revision 1.5
diff -u -b -B -r1.5 linux-mod.eclass
--- linux-mod.eclass 28 Nov 2004 09:47:31 -0000 1.5
+++ linux-mod.eclass 5 Dec 2004 15:25:03 -0000
@@ -104,6 +104,65 @@
echo
}
+# produce /etc/modules.d file
+modconfig_generate() {
+local modulename conf i params readme numaliases opts optsexample opttext
+
+ modulename="$1"
+
+ [ -z "$(eval echo \$\{!MODCONFIG_${modulename}_*\})" ] && return
+
+ conf="${WORKDIR}/modconf-${modulename}"
+ readme="$(eval echo \$\{MODCONFIG_${modulename}_README\})"
+ opts="$(eval echo \$\{MODCONFIG_${modulename}_OPTS\})"
+ opttext="$(eval echo \$\{MODCONFIG_${modulename}_OPTSTEXT\})"
+ optsexample="$(eval echo \$\{MODCONFIG_${modulename}_OPTSEXAMPLEONLY\})"
+ numaliases="$(eval echo \$\{#MODCONFIG_${modulename}_ALIASES[*]\})"
+
+ einfo "Installing ${modulename} module config file"
+
+ echo "# Configuration file for ${modulename} module" > ${conf}
+ echo >> ${conf}
+
+ if [ ${numaliases} > 0 ]
+ then
+ echo "# Internal aliases, do not edit" >> ${conf}
+ (( numaliases-- ))
+ for i in $(seq 0 ${numaliases})
+ do
+ echo "alias $(eval echo \$\{MODCONFIG_${modulename}_ALIASES[$i]\})" >> ${conf}
+ done
+ echo >> ${conf}
+ fi
+
+ params="$(modinfo -p ${modulename}.${KV_OBJ})"
+ if [ ! -z "${params}" ]
+ then
+ echo "# Configurable module parameters" >> ${conf}
+ [ ! -z "$readme" ] && echo "# For more details, see $readme" >> ${conf}
+ echo "#" >> ${conf}
+
+ IFS="$(echo -en "\n\b")"
+ for i in ${params}
+ do
+ echo "# ${i%%:*} - ${i#*:}" >> ${conf}
+ done
+ echo >> ${conf}
+ fi
+
+ if [ ! -z "${opts}" ]
+ then
+ [ ! -z ${opttext} ] && echo "# ${opttext}" >> ${conf} \
+ || echo "# For example:" >> ${conf}
+ [ ! -z "${optsexample}" ] && echo "# options ${modulename} ${opts}" >> ${conf} \
+ || echo "options ${modulename} ${opts}" >> ${conf}
+ fi
+
+ insinto /etc/modules.d
+ newins ${WORKDIR}/modconf-${modulename} ${modulename}
+
+}
+
# default ebuild functions
# --------------------------------
@@ -153,6 +212,8 @@
cd ${sourcedir}
insinto /lib/modules/${KV_FULL}/${moduledir}
doins ${modulename}.${KV_OBJ}
+
+ modconfig_generate ${modulename}
done
}
|
--
gentoo-kernel@g.o mailing list |
|
|
|