summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2004-02-01 15:13:47 +0000
committerMartin Schlemmer <azarah@gentoo.org>2004-02-01 15:13:47 +0000
commit6bf30528db691357347c5f594467664b5a2c9451 (patch)
tree6d8bb7ef0f533df52ffa4ae2e8b1802056c591ca /media-video
parentUpdated HOMEPAGE (diff)
downloadhistorical-6bf30528db691357347c5f594467664b5a2c9451.tar.gz
historical-6bf30528db691357347c5f594467664b5a2c9451.tar.bz2
historical-6bf30528db691357347c5f594467664b5a2c9451.zip
Add basic sysfs support for 2.6 and udev; patch by myself.
Diffstat (limited to 'media-video')
-rw-r--r--media-video/nvidia-kernel/ChangeLog10
-rw-r--r--media-video/nvidia-kernel/Manifest7
-rw-r--r--media-video/nvidia-kernel/files/1.0.5336/Makefile4
-rw-r--r--media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch171
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r11
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r1.ebuild158
6 files changed, 348 insertions, 3 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog
index c2c353a36c9d..a9b845887de6 100644
--- a/media-video/nvidia-kernel/ChangeLog
+++ b/media-video/nvidia-kernel/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for media-video/nvidia-kernel
# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.60 2004/02/01 02:47:43 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.61 2004/02/01 15:13:47 azarah Exp $
+
+*nvidia-kernel-1.0.5336-r1 (01 Feb 2004)
+
+ 01 Feb 2004; Martin Schlemmer <azarah@gentoo.org>
+ nvidia-kernel-1.0.5336-r1.ebuild,
+ files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch,
+ files/1.0.5336/Makefile:
+ Add basic sysfs support for 2.6 and udev. Patch donated by myself.
*nvidia-kernel-1.0.5336 (01 Feb 2004)
diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest
index 34cc676733ad..eff026c876df 100644
--- a/media-video/nvidia-kernel/Manifest
+++ b/media-video/nvidia-kernel/Manifest
@@ -2,7 +2,8 @@ MD5 ad9be703f3ba183bf2b5d9a9765619fa nvidia-kernel-1.0.5328-r1.ebuild 4562
MD5 d12e78297c403467ea2e4144729ece91 nvidia-kernel-1.0.3123-r2.ebuild 3118
MD5 a2954410aed3b91f7f5324169e43ab3f nvidia-kernel-1.0.4349-r2.ebuild 3543
MD5 ca0e848e813d3fc1fce83e51f35e34f7 nvidia-kernel-1.0.5332.ebuild 4431
-MD5 21132091054872f3cb52a1cb1b052b3a ChangeLog 13230
+MD5 d20a88f4148bf957270dd6c9fcc219d4 nvidia-kernel-1.0.5336-r1.ebuild 4329
+MD5 4dd5a981e04cbf31e3653b4b7c72ae36 ChangeLog 13525
MD5 6a0f2239670a3c0d900f6c410d54073a nvidia-kernel-1.0.5336.ebuild 4379
MD5 d07c7e8805ac45db9ec99be3e86dee70 nvidia-kernel-1.0.2960-r1.ebuild 1987
MD5 6c62870aa5220d0967df5827dca75563 nvidia-kernel-1.0.4180.ebuild 3714
@@ -27,6 +28,7 @@ MD5 854b5c292ec300d7105dbd54385840f6 files/digest-nvidia-kernel-1.0.4191-r2 74
MD5 b6a9c4bdd3961980af4a70f57485d708 files/nvidia-1.1 441
MD5 046ed3744551619863faea8c5c83db02 files/digest-nvidia-kernel-1.0.4499 74
MD5 a88479c177f936b6ef19fc73bb39d149 files/digest-nvidia-kernel-1.0.4496-r3 80
+MD5 1316f73c0eecd8832bb362a3d5ca4892 files/digest-nvidia-kernel-1.0.5336-r1 80
MD5 a31ceab3377afe2286673e74ddf89468 files/digest-nvidia-kernel-1.0.4496-r4 80
MD5 441b29e8f10b6620c4dd4fc01528f172 files/NVIDIA_kernel-1.0-3123-2.5-module.diff 5569
MD5 497ffcbd6a91ed9447dfdf7b736925bd files/digest-nvidia-kernel-1.0.5328-r1 80
@@ -49,4 +51,5 @@ MD5 6d98825a3cf78f4a5ce42d4f4decab89 files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-2
MD5 c0f21cb76a7471671ec9665968dfaafb files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff 81900
MD5 183b64f528e98221291072f12db5859d files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff 608
MD5 4c7749ca72483547e15031a2af560415 files/1.0.5332/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff 7216
-MD5 6215d802b88e2c395098cf80480aa40f files/1.0.5336/Makefile 4166
+MD5 47c9fa6dcf3b912e4d4864dbd9b36f18 files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch 5700
+MD5 2f5bab1a9c9fb0d7f29ed9c677ccbdcb files/1.0.5336/Makefile 4267
diff --git a/media-video/nvidia-kernel/files/1.0.5336/Makefile b/media-video/nvidia-kernel/files/1.0.5336/Makefile
index 177ca4759569..e120c77ff2cd 100644
--- a/media-video/nvidia-kernel/files/1.0.5336/Makefile
+++ b/media-video/nvidia-kernel/files/1.0.5336/Makefile
@@ -64,6 +64,10 @@ ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
DEFINES += -DREMAP_PAGE_RANGE_4
endif
+ifeq ($(shell sh conftest.sh class_simple $(INCLUDES)), yes)
+ DEFINES += -DHAVE_CLASS_SIMPLE
+endif
+
DEFINES+=$(EXTRA_DEFINES)
# allow build parameters to be passed in through the environment
diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch
new file mode 100644
index 000000000000..a10db7f43c14
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch
@@ -0,0 +1,171 @@
+diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild
+--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild 2004-01-15 05:29:12.000000000 +0200
++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild 2004-02-01 16:15:55.529582488 +0200
+@@ -146,6 +146,10 @@ ifeq ($(shell sh $(src)/conftest.sh rema
+ EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
+ endif
+
++ifeq ($(shell sh $(src)/conftest.sh class_simple $(KERNEL_HEADERS)), yes)
++ EXTRA_CFLAGS += -DHAVE_CLASS_SIMPLE
++endif
++
+ #
+ # NVIDIA binary object file includes .common section.
+ #
+diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/built-in.o NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/built-in.o
+--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/built-in.o 1970-01-01 02:00:00.000000000 +0200
++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/built-in.o 2004-02-01 16:11:27.428340072 +0200
+@@ -0,0 +1 @@
++!<arch>
+diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh
+--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh 2004-01-15 05:29:11.000000000 +0200
++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh 2004-02-01 16:19:19.079638176 +0200
+@@ -42,6 +42,29 @@ case "$1" in
+ fi
+ ;;
+
++ class_simple)
++ shift
++ #
++ # Determine if we have struct class_simple needed for limited sysfs
++ # support in 2.6
++ #
++ echo "#include <linux/device.h>
++ struct class_simple *test_class;
++ int add_test_class() {
++ test_class = class_simple_create(THIS_MODULE, \"test\");
++ }" > conftest.c
++
++ gcc -c conftest.c -o conftest.o $* -D__KERNEL__ > /dev/null 2>&1
++
++ if test -f conftest.o; then
++ echo "yes"
++ else
++ echo "no"
++ fi
++
++ rm -f conftest.{c,o}
++ ;;
++
+ cc_sanity_check)
+ shift
+ #
+diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h
+--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h 2004-01-15 05:29:11.000000000 +0200
++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h 2004-02-01 16:54:14.850032648 +0200
+@@ -448,6 +448,33 @@ typedef struct agp_memory agp_memory;
+ # endif // defined(KERNEL_2_4)
+ #endif // defined(CONFIG_DEVFS_FS)
+
++#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE)
++# define NV_SYSFS_REGISTER \
++ nvidia_class = class_simple_create(THIS_MODULE, "nvidia");
++
++# define NV_SYSFS_ADD_CONTROL \
++ class_simple_device_add(nvidia_class, \
++ MKDEV(NV_MAJOR_DEVICE_NUMBER, 255), \
++ NULL, "nvidiactl");
++
++# define NV_SYSFS_ADD_DEVICE(_name, _minor) \
++ class_simple_device_add(nvidia_class, \
++ MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor), \
++ &nv_linux_devices[_minor].dev->dev, _name);
++
++# define NV_SYSFS_REMOVE_DEVICE(i) \
++ class_simple_device_remove(MKDEV(NV_MAJOR_DEVICE_NUMBER, i));
++
++# define NV_SYSFS_UNREGISTER \
++ class_simple_destroy(nvidia_class);
++#else
++# define NV_SYSFS_REGISTER
++# define NV_SYSFS_ADD_CONTROL
++# define NV_SYSFS_ADD_DEVICE(_name, _minor)
++# define NV_SYSFS_REMOVE_DEVICE(i)
++# define NV_SYSFS_UNREGISTER
++#endif
++
+
+ /*
+ * Linux 2.5 introduced the five argument version of remap_page_range, all
+diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c
+--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c 2004-01-15 05:29:11.000000000 +0200
++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c 2004-02-01 16:58:03.429283320 +0200
+@@ -47,6 +47,10 @@ struct proc_dir_entry *proc_nvidia;
+ devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
+ #endif
+
++#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE)
++struct class_simple *nvidia_class;
++#endif
++
+ // #define NV_DBG_MEM 1
+ #undef NV_DBG_MEM
+
+@@ -874,23 +878,31 @@ static int __init nvidia_init_module(voi
+ rc = register_chrdev(nv_major, "nvidia", &nv_fops);
+ #endif
+
++ NV_SYSFS_REGISTER;
++
+ if (rc < 0)
+ {
+ nv_printf(NV_DBG_ERRORS, "nvidia_init_module: register failed\n");
+ return rc;
+ }
+
+-#ifdef CONFIG_DEVFS_FS
++#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6)
+ do
+ {
+ char name[10];
+
++# if defined(CONFIG_DEVFS_FS)
+ nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
++# endif
++ NV_SYSFS_ADD_CONTROL;
+
+ for (i = 0; i < num_nv_devices; i++)
+ {
+ sprintf(name, "nvidia%d", i);
++# if defined(CONFIG_DEVFS_FS)
+ nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
++# endif
++ NV_SYSFS_ADD_DEVICE(name, i);
+ }
+ } while(0);
+ #endif
+@@ -951,6 +963,7 @@ static int __init nvidia_init_module(voi
+ #else
+ unregister_chrdev(nv_major, "nvidia");
+ #endif
++ NV_SYSFS_UNREGISTER;
+ return rc;
+ }
+
+@@ -1011,15 +1024,24 @@ static void __exit nvidia_exit_module(vo
+ nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
+ }
+
+-#ifdef CONFIG_DEVFS_FS
++#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6)
+ do {
+ int i;
++# if defined(CONFIG_DEVFS_FS)
+ NV_DEVFS_REMOVE_CONTROL();
+- for (i = 0; i < num_nv_devices; i++)
++# endif
++ NV_SYSFS_REMOVE_DEVICE(255);
++ for (i = 0; i < num_nv_devices; i++) {
++# if defined(CONFIG_DEVFS_FS)
+ NV_DEVFS_REMOVE_DEVICE(i);
++# endif
++ NV_SYSFS_REMOVE_DEVICE(i);
++ }
+ } while (0);
+ #endif
+
++ NV_SYSFS_UNREGISTER;
++
+ #if NV_ENABLE_MEM_TRACKING
+ nv_list_mem(vm_list);
+ nv_list_mem(km_list);
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r1
new file mode 100644
index 000000000000..56ddf0d273b7
--- /dev/null
+++ b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r1
@@ -0,0 +1 @@
+MD5 6d7361347ebbef5dfdbe6bdcb560fda8 NVIDIA-Linux-x86-1.0-5336-pkg1.run 6821193
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r1.ebuild
new file mode 100644
index 000000000000..f3b78219ed19
--- /dev/null
+++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r1.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r1.ebuild,v 1.1 2004/02/01 15:13:47 azarah Exp $
+
+inherit eutils
+
+PKG_V="pkg1"
+NV_V="${PV/1.0./1.0-}"
+NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
+S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
+DESCRIPTION="Linux kernel module for the NVIDIA's X driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}-${PKG_V}.run"
+
+# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
+LICENSE="NVIDIA"
+SLOT="${KV}"
+KEYWORDS="-* ~x86"
+RESTRICT="nostrip"
+
+DEPEND="virtual/linux-sources"
+export _POSIX2_VERSION="199209"
+
+
+pkg_setup() {
+ if [ ! -f /proc/mtrr ]
+ then
+ eerror "This version needs MTRR support for most chipsets!"
+ eerror "Please enable MTRR support in your kernel config, found at:"
+ eerror
+ eerror " Processor type and features -> [*] MTRR (Memory Type Range Register) support"
+ eerror
+ eerror "and recompile your kernel ..."
+ die "MTRR support not detected!"
+ fi
+
+ check_version_h
+}
+
+check_version_h() {
+ if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ]
+ then
+ eerror "Please verify that your /usr/src/linux symlink is pointing"
+ eerror "to your current kernel sources, and that you did run:"
+ eerror
+ eerror " # make dep"
+ die "/usr/src/linux symlink not setup!"
+ fi
+}
+
+get_KV_info() {
+ check_version_h
+
+ # Get the kernel version of sources in /usr/src/linux ...
+ export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
+ "${ROOT}/usr/src/linux/include/linux/version.h")"
+ export KV_major="$(echo "${KV_full}" | cut -d. -f1)"
+ export KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
+ export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
+}
+
+is_kernel() {
+ [ -z "$1" -o -z "$2" ] && return 1
+
+ get_KV_info
+
+ if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ]
+ then
+ return 0
+ else
+ return 1
+ fi
+}
+
+src_unpack() {
+ cd ${WORKDIR}
+ bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
+
+ # Next section applies patches for linux-2.5 kernel, and/or
+ # bugfixes for linux-2.4. All these are from:
+ #
+ # http://www.minion.de/nvidia/
+ #
+ # Many thanks to Christian Zander <zander@minion.de> for bringing
+ # these to us, and being so helpful to select which to use.
+
+ get_KV_info
+
+ cd ${S}
+ einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
+
+ if is_kernel 2 5 || is_kernel 2 6
+ then
+ EPATCH_SINGLE_MSG="Applying basic sysfs patch ..." \
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-basic-sysfs-support.patch
+
+ # Kbuild have issues currently (sandbox related).
+# ln -snf Makefile.nvidia Makefile
+ cp -f ${FILESDIR}/${PV}/Makefile ${S}/makefile
+ fi
+
+ # if you set this then it's your own fault when stuff breaks :)
+ [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile
+}
+
+src_compile() {
+ # Portage should determine the version of the kernel sources
+ check_KV
+
+ # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
+ # updated but the running kernel is still compiled with an older gcc. This is
+ # needed for chrooted building, where the sanity check detects the gcc of the
+ # kernel outside the chroot rather than within.
+ make IGNORE_CC_MISMATCH="yes" KERNDIR="/usr/src/linux" \
+ clean nvidia.o || die
+}
+
+src_install() {
+ # The driver goes into the standard modules location
+ insinto /lib/modules/${KV}/video
+ if is_kernel 2 5 || is_kernel 2 6
+ then
+ newins nvidia.o nvidia.ko
+ else
+ doins nvidia.o
+ fi
+
+ # Add the aliases
+ insinto /etc/modules.d
+ newins ${FILESDIR}/nvidia-1.1 nvidia
+
+ # Docs
+ dodoc ${S}/README
+
+ # The device creation script
+ into /
+ newsbin ${S}/makedevices.sh NVmakedevices.sh
+}
+
+pkg_postinst() {
+ if [ "${ROOT}" = "/" ]
+ then
+ # Update module dependency
+ [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
+ if [ ! -e /dev/.devfsd ] && [ -x /sbin/NVmakedevices.sh ]
+ then
+ /sbin/NVmakedevices.sh >/dev/null 2>&1
+ fi
+ fi
+
+ echo
+ einfo "If you are not using devfs, loading the module automatically at"
+ einfo "boot up, you need to add \"nvidia\" to your /etc/modules.autoload."
+ echo
+ ewarn "Please note that the driver name changed from \"NVdriver\""
+ ewarn "to \"nvidia.o\"."
+ echo
+}