[packages/xorg-driver-video-nvidia-legacy-304xx] - yet another legacy driver for older nvidia cards (mainly NVIDIA Quadro FX)

baggins baggins at pld-linux.org
Mon Aug 26 09:38:41 CEST 2013


commit 33afafb099d6a3cc4d755df6e87e74fea08e9805
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon Aug 26 09:37:37 2013 +0200

    - yet another legacy driver for older nvidia cards (mainly NVIDIA Quadro FX)

 10-nvidia-modules.conf                     |   4 +
 10-nvidia.conf                             |   5 +
 X11-driver-nvidia-GL.patch                 |  10 +
 X11-driver-nvidia-desktop.patch            |  19 +
 conftest.h                                 | 470 ++++++++++++++++++
 conftest.sh                                |   7 +
 gl.pc.in                                   |  10 +
 linux-3.10-i2c.patch                       |  39 ++
 linux-3.10-procfs.patch                    | 752 +++++++++++++++++++++++++++++
 linux-3.11.patch                           |  18 +
 patches.h                                  |   5 +
 xinitrc.sh                                 |   5 +
 xorg-driver-video-nvidia-legacy-304xx.spec | 431 +++++++++++++++++
 13 files changed, 1775 insertions(+)
---
diff --git a/xorg-driver-video-nvidia-legacy-304xx.spec b/xorg-driver-video-nvidia-legacy-304xx.spec
new file mode 100644
index 0000000..afc3fce
--- /dev/null
+++ b/xorg-driver-video-nvidia-legacy-304xx.spec
@@ -0,0 +1,431 @@
+# TODO
+# - should -libs Require main package?
+# - drop binary-only nvidia-settings from here, and use nvidia-settings.spec for it?
+# - kernel-drm is required on never kernels. driver for kernel-longterm not requires drm
+#
+# Conditional build:
+%bcond_without	dist_kernel	# without distribution kernel
+%bcond_without	kernel		# without kernel packages
+%bcond_without	userspace	# don't build userspace programs
+%bcond_with	force_userspace # force userspace build (useful if alt_kernel is set)
+%bcond_with	settings	# package nvidia-settings here (GPL version of same packaged from nvidia-settings.spec)
+%bcond_with	verbose		# verbose build (V=1)
+
+%if "%{_alt_kernel}" != "%{nil}"
+%undefine	with_userspace
+%endif
+%if %{with force_userspace}
+%define		with_userspace 1
+%endif
+%if %{without userspace}
+# nothing to be placed to debuginfo package
+%define		_enable_debug_packages	0
+%endif
+%define		no_install_post_check_so 1
+
+%define		rel 1
+%define		pname	xorg-driver-video-nvidia-legacy-304xx
+Summary:	Linux Drivers for nVidia GeForce/Quadro Chips
+Summary(hu.UTF-8):	Linux meghajtók nVidia GeForce/Quadro chipekhez
+Summary(pl.UTF-8):	Sterowniki do kart graficznych nVidia GeForce/Quadro
+Name:		%{pname}%{_alt_kernel}
+# when updating version here, keep nvidia-settings.spec in sync as well
+Version:	304.88
+Release:	%{rel}
+Epoch:		1
+License:	nVidia Binary
+Group:		X11
+Source0:	http://us.download.nvidia.com/XFree86/Linux-x86/%{version}/NVIDIA-Linux-x86-%{version}.run
+# Source0-md5:	f60d4aef766029c98914ed665235029a
+Source1:	http://us.download.nvidia.com/XFree86/Linux-x86_64/%{version}/NVIDIA-Linux-x86_64-%{version}-no-compat32.run
+# Source1-md5:	35e0c7d30de795cccb6b95bda991fb77
+Source2:	xinitrc.sh
+Source3:	gl.pc.in
+Source4:	10-nvidia.conf
+Source5:	10-nvidia-modules.conf
+Source6:	patches.h
+Source7:	conftest.h
+Source8:	conftest.sh
+Patch0:		X11-driver-nvidia-GL.patch
+Patch1:		X11-driver-nvidia-desktop.patch
+Patch2:		linux-3.10-i2c.patch
+Patch3:		linux-3.10-procfs.patch
+Patch4:		linux-3.11.patch
+URL:		http://www.nvidia.com/object/unix.html
+%if %{with kernel}
+%{?with_dist_kernel:BuildRequires:	kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
+%endif
+BuildRequires:	%{kgcc_package}
+BuildRequires:	rpmbuild(macros) >= 1.379
+BuildRequires:	sed >= 4.0
+BuildConflicts:	XFree86-nvidia
+Requires:	%{pname}-libs = %{epoch}:%{version}-%{rel}
+Requires:	xorg-xserver-server
+Requires:	xorg-xserver-server(videodrv-abi) <= 14.1
+Requires:	xorg-xserver-server(videodrv-abi) >= 2.0
+Provides:	xorg-driver-video
+Provides:	xorg-xserver-module(glx)
+Obsoletes:	XFree86-driver-nvidia
+Obsoletes:	XFree86-nvidia
+Conflicts:	XFree86-OpenGL-devel <= 4.2.0-3
+ExclusiveArch:	%{ix86} %{x8664}
+BuildRoot:	%{tmpdir}/%{pname}-%{version}-root-%(id -u -n)
+
+%define		_noautoreqdep	libGL.so.1 libnvcuvid.so
+# libnvidia-encode.so.*.* links with libnvcuvid.so instead of libnvcuvid.so.1
+%define		_noautoreq	libnvcuvid.so
+
+%description
+This driver set adds improved 2D functionality to the Xorg X server as
+well as high performance OpenGL acceleration, AGP support, support for
+most flat panels, and 2D multiple monitor support. Supported hardware:
+modern NVIDIA GeForce (from GeForce2 MX) and Quadro (Quadro4 and up)
+based graphics accelerators.
+
+The older graphics chips are unsupported:
+- NV1 and RIVA 128/128ZX chips are supported in the base Xorg install
+  (nv driver)
+- TNT/TNT2/GeForce 256/GeForce2 Ultra/Quadro2 are suported by -legacy
+  drivers.
+
+%description -l hu.UTF-8
+Ez a meghajtó kibővíti az Xorg X szerver 2D működését OpenGL
+gyorsítással, AGP támogatással és támogatja a több monitort.
+Támogatott hardverek: modern NVIDIA GeForce (GeForce2 MX-től) és
+Quadro (Quadro4 és újabbak) alapú grafikai gyorsítók.
+
+A régekbbi grafikus chipek nem támogatottak:
+- NV1 és RIVA 128/128ZX chipek az alap Xorg telepítéssel (nv meghajtó)
+- TNT/TNT2/GeForce 256/GeForce2 Ultra/Quadro2 a -legacy driverekkel
+  támogatottak.
+
+%description -l pl.UTF-8
+Usprawnione sterowniki dla kart graficznych nVidia do serwera Xorg,
+dające wysokowydajną akcelerację OpenGL, obsługę AGP i wielu monitorów
+2D. Obsługują w miarę nowe karty NVIDIA GeForce (od wersji GeForce2
+MX) oraz Quadro (od wersji Quadro4).
+
+Starsze układy graficzne nie są obsługiwane przez ten pakiet:
+- NV1 i RIVA 128/128ZX są obsługiwane przez sterownik nv z Xorg
+- TNT/TNT2/GeForce 256/GeForce 2 Ultra/Quadro 2 są obsługiwane przez
+  sterowniki -legacy
+
+%package libs
+Summary:	OpenGL (GL and GLX) Nvidia libraries
+Summary(pl.UTF-8):	Biblioteki OpenGL (GL i GLX) Nvidia
+Group:		X11/Development/Libraries
+Requires(post,postun):	/sbin/ldconfig
+Requires:	libvdpau >= 0.3
+Provides:	OpenGL = 2.1
+Provides:	OpenGL-GLX = 1.4
+Obsoletes:	X11-OpenGL-core < 1:7.0.0
+Obsoletes:	X11-OpenGL-libGL < 1:7.0.0
+Obsoletes:	XFree86-OpenGL-core < 1:7.0.0
+Obsoletes:	XFree86-OpenGL-libGL < 1:7.0.0
+
+%description libs
+NVIDIA OpenGL (GL and GLX only) implementation libraries.
+
+%description libs -l pl.UTF-8
+Implementacja OpenGL (tylko GL i GLX) firmy NVIDIA.
+
+%package devel
+Summary:	OpenGL (GL and GLX) header files
+Summary(hu.UTF-8):	OpenGL (GL és GLX) fejléc fájlok
+Summary(pl.UTF-8):	Pliki nagłówkowe OpenGL (GL i GLX)
+Group:		X11/Development/Libraries
+Requires:	%{pname}-libs = %{epoch}:%{version}-%{rel}
+Provides:	OpenGL-GLX-devel = 1.4
+Provides:	OpenGL-devel = 2.1
+Obsoletes:	X11-OpenGL-devel-base
+Obsoletes:	XFree86-OpenGL-devel-base
+Obsoletes:	XFree86-driver-nvidia-devel
+Conflicts:	XFree86-OpenGL-devel < 4.3.99.902-0.3
+
+%description devel
+OpenGL header files (GL and GLX only) for NVIDIA OpenGL
+implementation.
+
+%description devel -l hu.UTF-8
+OpenGL fejléc fájlok (csak GL és GLX) NVIDIA OpenGL implementációhoz.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe OpenGL (tylko GL i GLX) dla implementacji OpenGL
+firmy NVIDIA.
+
+%package doc
+Summary:	Documentation for NVIDIA Graphics Driver
+Group:		Documentation
+
+%description doc
+NVIDIA Accelerated Linux Graphics Driver README and Installation
+Guide.
+
+%package progs
+Summary:	Tools for advanced control of nVidia graphic cards
+Summary(hu.UTF-8):	Eszközök az nVidia grafikus kártyák beállításához
+Summary(pl.UTF-8):	Narzędzia do zarządzania kartami graficznymi nVidia
+Group:		Applications/System
+Requires:	%{pname} = %{epoch}:%{version}
+Suggests:	pkgconfig
+Obsoletes:	XFree86-driver-nvidia-progs
+
+%description progs
+Tools for advanced control of nVidia graphic cards.
+
+%description progs -l hu.UTF-8
+Eszközök az nVidia grafikus kártyák beállításához.
+
+%description progs -l pl.UTF-8
+Narzędzia do zarządzania kartami graficznymi nVidia.
+
+%package -n kernel%{_alt_kernel}-video-nvidia
+Summary:	nVidia kernel module for nVidia Architecture support
+Summary(de.UTF-8):	Das nVidia-Kern-Modul für die nVidia-Architektur-Unterstützung
+Summary(hu.UTF-8):	nVidia Architektúra támogatás Linux kernelhez.
+Summary(pl.UTF-8):	Moduł jądra dla obsługi kart graficznych nVidia
+Release:	%{rel}@%{_kernel_ver_str}
+Group:		Base/Kernel
+Requires(post,postun):	/sbin/depmod
+Requires:	dev >= 2.7.7-10
+%if %{with dist_kernel}
+%requires_releq_kernel
+%if "%{_alt_kernel}" == "%{nil}"
+Requires:	%releq_kernel -n drm
+%endif
+%endif
+Requires:	%{pname} = %{epoch}:%{version}
+Provides:	X11-driver-nvidia(kernel)
+Obsoletes:	XFree86-nvidia-kernel
+
+%description -n kernel%{_alt_kernel}-video-nvidia
+nVidia Architecture support for Linux kernel.
+
+%description -n kernel%{_alt_kernel}-video-nvidia -l de.UTF-8
+Die nVidia-Architektur-Unterstützung für den Linux-Kern.
+
+%description -n kernel%{_alt_kernel}-video-nvidia -l hu.UTF-8
+nVidia Architektúra támogatás Linux kernelhez.
+
+%description -n kernel%{_alt_kernel}-video-nvidia -l pl.UTF-8
+Obsługa architektury nVidia dla jądra Linuksa. Pakiet wymagany przez
+sterownik nVidii dla Xorg/XFree86.
+
+%prep
+cd %{_builddir}
+rm -rf NVIDIA-Linux-x86*-%{version}*
+%ifarch %{ix86}
+/bin/sh %{SOURCE0} --extract-only
+%setup -qDT -n NVIDIA-Linux-x86-%{version}
+%else
+/bin/sh %{SOURCE1} --extract-only
+%setup -qDT -n NVIDIA-Linux-x86_64-%{version}-no-compat32
+%endif
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+
+install %{SOURCE6} kernel/
+install %{SOURCE7} kernel/
+install -m 755 %{SOURCE8} kernel/
+echo 'EXTRA_CFLAGS += -Wno-pointer-arith -Wno-sign-compare -Wno-unused' >> kernel/Makefile.kbuild
+
+%build
+%if %{with kernel}
+cd kernel
+ln -sf Makefile.kbuild Makefile
+#cat >> Makefile <<'EOF'
+#
+#$(obj)/nv-kernel.o: $(src)/nv-kernel.o.bin
+#	cp $< $@
+#EOF
+#mv nv-kernel.o{,.bin}
+#build_kernel_modules -m nvidia
+%{__make} SYSSRC=%{_kernelsrcdir} module
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with userspace}
+install -d $RPM_BUILD_ROOT%{_libdir}/{nvidia,xorg/modules/{drivers,extensions/nvidia}} \
+	$RPM_BUILD_ROOT{%{_includedir}/GL,%{_libdir}/vdpau,%{_bindir},%{_mandir}/man1} \
+	$RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/etc/X11/xinit/xinitrc.d} \
+	$RPM_BUILD_ROOT%{_sysconfdir}/{OpenCL/vendors,ld.so.conf.d,X11/xorg.conf.d}
+
+%if %{with settings}
+install -p nvidia-settings $RPM_BUILD_ROOT%{_bindir}
+cp -p nvidia-settings.1* $RPM_BUILD_ROOT%{_mandir}/man1
+cp -p nvidia-settings.desktop $RPM_BUILD_ROOT%{_desktopdir}
+cp -p nvidia-settings.png $RPM_BUILD_ROOT%{_pixmapsdir}
+install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/X11/xinit/xinitrc.d/nvidia-settings.sh
+%endif
+
+install -p nvidia-{smi,xconfig,bug-report.sh} $RPM_BUILD_ROOT%{_bindir}
+cp -p nvidia-{smi,xconfig}.1* $RPM_BUILD_ROOT%{_mandir}/man1
+install -p nvidia.icd $RPM_BUILD_ROOT%{_sysconfdir}/OpenCL/vendors
+
+install %{SOURCE4} $RPM_BUILD_ROOT/etc/X11/xorg.conf.d
+install %{SOURCE5} $RPM_BUILD_ROOT/etc/X11/xorg.conf.d
+sed -i -e 's|@@LIBDIR@@|%{_libdir}|g' $RPM_BUILD_ROOT/etc/X11/xorg.conf.d/10-nvidia-modules.conf
+
+for f in \
+	libGL.so.%{version}			\
+	libOpenCL.so.1.0.0			\
+	libcuda.so.%{version}			\
+	libnvcuvid.so.%{version}		\
+	libnvidia-cfg.so.%{version}		\
+	libnvidia-compiler.so.%{version}	\
+	libnvidia-glcore.so.%{version}		\
+	libnvidia-ml.so.%{version}		\
+	libnvidia-opencl.so.%{version}		\
+	tls/libnvidia-tls.so.%{version}		\
+; do
+	install -p $f $RPM_BUILD_ROOT%{_libdir}/nvidia
+done
+
+install -p libvdpau_nvidia.so.%{version} $RPM_BUILD_ROOT%{_libdir}/vdpau
+
+install -p libglx.so.%{version} $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/nvidia
+ln -s libglx.so.%{version} $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/nvidia/libglx.so
+install -p nvidia_drv.so $RPM_BUILD_ROOT%{_libdir}/xorg/modules/drivers/nvidia_drv.so.%{version}
+ln -s nvidia_drv.so.%{version} $RPM_BUILD_ROOT%{_libdir}/xorg/modules/drivers/nvidia_drv.so
+install -p libnvidia-wfb.so.%{version} $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/nvidia
+ln -s libnvidia-wfb.so.1 $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/nvidia/libnvidia-wfb.so
+
+/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}/nvidia
+/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/nvidia
+
+cp -p gl*.h $RPM_BUILD_ROOT%{_includedir}/GL
+
+ln -sf libvdpau_nvidia.so.%{version} $RPM_BUILD_ROOT%{_libdir}/vdpau/libvdpau_nvidia.so.1
+
+%ifarch %{x8664}
+echo %{_libdir}/nvidia >$RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/nvidia64.conf
+echo %{_libdir}/vdpau >>$RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/nvidia64.conf
+%else
+echo %{_libdir}/nvidia >$RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/nvidia.conf
+echo %{_libdir}/vdpau >>$RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/nvidia.conf
+%endif
+
+# OpenGL ABI for Linux compatibility
+ln -sf libGL.so.%{version} $RPM_BUILD_ROOT%{_libdir}/nvidia/libGL.so.1
+ln -sf libGL.so.1 $RPM_BUILD_ROOT%{_libdir}/nvidia/libGL.so
+ln -sf libOpenCL.so.1 $RPM_BUILD_ROOT%{_libdir}/nvidia/libOpenCL.so
+ln -sf libcuda.so.1 $RPM_BUILD_ROOT%{_libdir}/nvidia/libcuda.so
+ln -sf libnvcuvid.so.1 $RPM_BUILD_ROOT%{_libdir}/nvidia/libnvcuvid.so
+%endif
+
+%if %{with kernel}
+%install_kernel_modules -m kernel/nvidia -d misc
+%endif
+
+install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
+sed -e '
+	s|@@prefix@@|%{_prefix}|g;
+	s|@@libdir@@|%{_libdir}|g;
+	s|@@includedir@@|%{_includedir}|g;
+	s|@@version@@|%{version}|g' < %{SOURCE3} \
+	> $RPM_BUILD_ROOT%{_pkgconfigdir}/gl.pc
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+cat << 'EOF'
+NOTE: You must also install kernel module for this driver to work
+  kernel-video-nvidia-%{version}
+
+EOF
+
+%post libs -p /sbin/ldconfig
+%postun	libs -p /sbin/ldconfig
+
+%post	-n kernel%{_alt_kernel}-video-nvidia
+%depmod %{_kernel_ver}
+
+%postun	-n kernel%{_alt_kernel}-video-nvidia
+%depmod %{_kernel_ver}
+
+%if %{with userspace}
+%files
+%defattr(644,root,root,755)
+%doc LICENSE NVIDIA_Changelog README.txt
+%dir %{_libdir}/xorg/modules/extensions/nvidia
+%attr(755,root,root) %{_libdir}/xorg/modules/extensions/nvidia/libnvidia-wfb.so.*.*
+%attr(755,root,root) %{_libdir}/xorg/modules/extensions/nvidia/libnvidia-wfb.so.1
+%attr(755,root,root) %{_libdir}/xorg/modules/extensions/nvidia/libnvidia-wfb.so
+%attr(755,root,root) %{_libdir}/xorg/modules/extensions/nvidia/libglx.so.*
+%attr(755,root,root) %{_libdir}/xorg/modules/extensions/nvidia/libglx.so
+%attr(755,root,root) %{_libdir}/xorg/modules/drivers/nvidia_drv.so.*
+%attr(755,root,root) %{_libdir}/xorg/modules/drivers/nvidia_drv.so
+%{_sysconfdir}/X11/xorg.conf.d/10-nvidia.conf
+%{_sysconfdir}/X11/xorg.conf.d/10-nvidia-modules.conf
+
+%files libs
+%defattr(644,root,root,755)
+%dir %{_sysconfdir}/OpenCL
+%dir %{_sysconfdir}/OpenCL/vendors
+%{_sysconfdir}/OpenCL/vendors/nvidia.icd
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ld.so.conf.d/nvidia*.conf
+%dir %{_libdir}/nvidia
+%attr(755,root,root) %{_libdir}/nvidia/libGL.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/nvidia/libGL.so.1
+%attr(755,root,root) %{_libdir}/nvidia/libOpenCL.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/nvidia/libOpenCL.so.1
+%attr(755,root,root) %{_libdir}/nvidia/libOpenCL.so
+%attr(755,root,root) %{_libdir}/nvidia/libcuda.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/nvidia/libcuda.so.1
+%attr(755,root,root) %{_libdir}/nvidia/libcuda.so
+%attr(755,root,root) %{_libdir}/nvidia/libnvcuvid.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/nvidia/libnvcuvid.so.1
+%attr(755,root,root) %{_libdir}/nvidia/libnvcuvid.so
+%attr(755,root,root) %{_libdir}/nvidia/libnvidia-cfg.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/nvidia/libnvidia-cfg.so.1
+%attr(755,root,root) %{_libdir}/nvidia/libnvidia-compiler.so.*.*
+%attr(755,root,root) %{_libdir}/nvidia/libnvidia-glcore.so.*.*
+%attr(755,root,root) %{_libdir}/nvidia/libnvidia-ml.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/nvidia/libnvidia-ml.so.1
+%attr(755,root,root) %{_libdir}/nvidia/libnvidia-opencl.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/nvidia/libnvidia-opencl.so.1
+%attr(755,root,root) %{_libdir}/nvidia/libnvidia-tls.so.*.*
+%attr(755,root,root) %{_libdir}/vdpau/libvdpau_nvidia.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/vdpau/libvdpau_nvidia.so.1
+
+%files devel
+%defattr(644,root,root,755)
+%dir %{_includedir}/GL
+%{_includedir}/GL/gl.h
+%{_includedir}/GL/glext.h
+%{_includedir}/GL/glx.h
+%{_includedir}/GL/glxext.h
+%attr(755,root,root) %{_libdir}/nvidia/libGL.so
+%{_pkgconfigdir}/gl.pc
+
+%files doc
+%defattr(644,root,root,755)
+%doc html/*
+
+%files progs
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/nvidia-bug-report.sh
+%attr(755,root,root) %{_bindir}/nvidia-smi
+%attr(755,root,root) %{_bindir}/nvidia-xconfig
+%{_mandir}/man1/nvidia-smi.1*
+%{_mandir}/man1/nvidia-xconfig.1*
+%if %{with settings}
+%attr(755,root,root) /etc/X11/xinit/xinitrc.d/*.sh
+%attr(755,root,root) %{_bindir}/nvidia-settings
+%{_mandir}/man1/nvidia-settings.1*
+%{_desktopdir}/nvidia-settings.desktop
+%{_pixmapsdir}/nvidia-settings.png
+%endif
+%endif
+
+%if %{with kernel}
+%files -n kernel%{_alt_kernel}-video-nvidia
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/misc/*.ko*
+%endif
diff --git a/10-nvidia-modules.conf b/10-nvidia-modules.conf
new file mode 100644
index 0000000..33410b3
--- /dev/null
+++ b/10-nvidia-modules.conf
@@ -0,0 +1,4 @@
+Section "Files"
+	ModulePath   "@@LIBDIR@@/xorg/modules/extensions/nvidia"
+	ModulePath   "@@LIBDIR@@/xorg/modules"
+EndSection
diff --git a/10-nvidia.conf b/10-nvidia.conf
new file mode 100644
index 0000000..ac58200
--- /dev/null
+++ b/10-nvidia.conf
@@ -0,0 +1,5 @@
+Section "Device"
+	Identifier "NVIDIA"
+	Driver "nvidia"
+EndSection
+
diff --git a/X11-driver-nvidia-GL.patch b/X11-driver-nvidia-GL.patch
new file mode 100644
index 0000000..72f036e
--- /dev/null
+++ b/X11-driver-nvidia-GL.patch
@@ -0,0 +1,10 @@
+--- NVIDIA-Linux-x86-1.0-6111-pkg1/gl.h	2004-07-27 17:33:20.000000000 +0200
++++ NVIDIA-Linux-x86-1.0-6111-pkg1/gl.h	2004-09-13 13:23:24.188682536 +0200
+@@ -1620,6 +1620,7 @@
+ WINGDIAPI void APIENTRY glVertex4sv (const GLshort *v);
+ WINGDIAPI void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+ WINGDIAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
++#define GL_COLOR_INDEX8_EXT               0x80E5
+ 
+ #ifdef __DEFINED_GLAPI
+ # undef GLAPI
diff --git a/X11-driver-nvidia-desktop.patch b/X11-driver-nvidia-desktop.patch
new file mode 100644
index 0000000..dcf9ea5
--- /dev/null
+++ b/X11-driver-nvidia-desktop.patch
@@ -0,0 +1,19 @@
+--- NVIDIA-Linux-x86_64-270.30-no-compat32/nvidia-settings.desktop	2011-02-26 00:54:20.000000000 +0200
++++ NVIDIA-Linux-x86_64-270.30-no-compat32/nvidia-settings.desktop	2011-03-13 22:15:28.674244734 +0200
+@@ -1,9 +1,10 @@
+ [Desktop Entry]
+ Type=Application
+ Encoding=UTF-8
+-Name=NVIDIA X Server Settings
+-Comment=Configure NVIDIA X Server Settings
+-Exec=__UTILS_PATH__/nvidia-settings
+-Icon=__PIXMAP_PATH__/nvidia-settings.png
+-Categories=Application;Settings;
+-
++Name=nVidia X Server Settings
++Name[pl]=Ustawienia X serwera nVidii
++Comment=Configure nVidia X Server Settings
++Comment[pl]=Konfiguracja ustawień X serwera NVndii
++Exec=nvidia-settings
++Icon=nvidia-settings
++Categories=Settings;HardwareSettings;
diff --git a/conftest.h b/conftest.h
new file mode 100644
index 0000000..8013014
--- /dev/null
+++ b/conftest.h
@@ -0,0 +1,470 @@
+/* synchronized with conftest.sh from 325.15, 319.32, 313.30, 310.51, 304.108, 295.75, 173.14.37, 96.43.23, 71.86.15 */
+
+#ifndef LINUX_VERSION_CODE
+#include <linux/version.h>
+#endif
+
+#if !defined(IS_ENABLED) && LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
+#define __ARG_PLACEHOLDER_1 0,
+#define config_enabled(cfg) _config_enabled(cfg)
+#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
+#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
+#define ___config_enabled(__ignored, val, ...) val
+#define IS_ENABLED(option) (config_enabled(option) || config_enabled(option##_MODULE))
+#endif
+
+/* Implement conftest.sh function nvidiafb_sanity_check */
+#if IS_ENABLED(CONFIG_FB_NVIDIA)
+#warning "The nvidia module is incompatible with nvidiafb!"
+#endif
+
+/* Implement conftest.sh function xen_sanity_check */
+#if IS_ENABLED(CONFIG_XEN) && ! IS_ENABLED(CONFIG_PARAVIRT)
+#warning "Xen kernels are not supported!"
+#endif
+
+/* Implement conftest.sh function preempt_rt_sanity_check */
+#if IS_ENABLED(CONFIG_PREEMPT_RT) || IS_ENABLED(CONFIG_PREEMPT_RT_FULL)
+#warning "PREEMPT_RT kernels are not supported!"
+#endif
+
+/* Implement conftest.sh function remap_page_range */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+  #define NV_REMAP_PAGE_RANGE_PRESENT
+  #define NV_REMAP_PAGE_RANGE_ARGUMENT_COUNT 4
+ #else
+  #define NV_REMAP_PAGE_RANGE_PRESENT
+  #define NV_REMAP_PAGE_RANGE_ARGUMENT_COUNT 5
+ #endif
+#else
+ #undef NV_REMAP_PAGE_RANGE_PRESENT
+#endif
+
+/* Implement conftest.sh function set_memory_uc */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) && IS_ENABLED(CONFIG_X86)
+ #define NV_SET_MEMORY_UC_PRESENT
+#else
+ #undef NV_SET_MEMORY_UC_PRESENT
+#endif
+
+/* Implement conftest.sh function set_memory_array_uc */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) && IS_ENABLED(CONFIG_X86)
+ #define NV_SET_MEMORY_ARRAY_UC_PRESENT
+#else
+ #undef NV_SET_MEMORY_ARRAY_UC_PRESENT
+#endif
+
+/* Implement conftest.sh function set_pages_uc */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) && IS_ENABLED(CONFIG_X86)
+ #define NV_SET_PAGES_UC_PRESENT
+#else
+ #undef NV_SET_PAGES_UC_PRESENT
+#endif
+
+/* Implement conftest.sh function outer_flush_all */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34) && IS_ENABLED(CONFIG_ARM)
+ #define NV_OUTER_FLUSH_ALL_PRESENT
+#else
+ #undef NV_OUTER_FLUSH_ALL_PRESENT
+#endif
+
+/* Implement conftest.sh function change_page_attr */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && \
+               LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
+ #define NV_CHANGE_PAGE_ATTR_PRESENT
+#else
+ #undef NV_CHANGE_PAGE_ATTR_PRESENT
+#endif
+
+/* Implement conftest.sh function pci_get_class */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
+ #define NV_PCI_GET_CLASS_PRESENT
+#else
+ #undef NV_PCI_GET_CLASS_PRESENT
+#endif
+
+/* Implement conftest.sh function pci_get_domain_bus_and_slot */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ #define NV_PCI_GET_DOMAIN_BUS_AND_SLOT_PRESENT
+#else
+ #undef NV_PCI_GET_DOMAIN_BUS_AND_SLOT_PRESENT
+#endif
+
+/* Implement conftest.sh function remap_pfn_range */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
+ #define NV_REMAP_PFN_RANGE_PRESENT
+#else
+ #undef NV_REMAP_PFN_RANGE_PRESENT
+#endif
+
+/* Implement conftest.sh function agp_backend_acquire */
+/* Only kernels sometime before 2.4.0 don't have this function, and who */
+/* cares anymore */
+#define NV_AGP_BACKEND_ACQUIRE_PRESENT
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ #define NV_AGP_BACKEND_ACQUIRE_ARGUMENT_COUNT 1
+#else
+ #define NV_AGP_BACKEND_ACQUIRE_ARGUMENT_COUNT 0
+#endif
+
+/* Implement conftest.sh function vmap */
+/* I can not find any released kernel that uses the 2 argument variant */
+/* of vmap */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)
+ #define NV_VMAP_PRESENT
+ #define NV_VMAP_ARGUMENT_COUNT 4
+#else
+ #undef NV_VMAP_PRESENT
+#endif
+
+/* Implement conftest.sh function i2c_adapter */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ #define NV_I2C_ADAPTER_HAS_INC_USE
+ #define NV_I2C_ADAPTER_HAS_DEC_USE
+ #define NV_I2C_ADAPTER_HAS_CLIENT_REGISTER
+#else
+ #undef NV_I2C_ADAPTER_HAS_INC_USE
+ #undef NV_I2C_ADAPTER_HAS_DEC_USE
+ #undef NV_I2C_ADAPTER_HAS_CLIENT_REGISTER
+#endif
+
+/* Implement conftest.sh function pm_message_t */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
+ #define NV_PM_MESSAGE_T_PRESENT
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
+  #define NV_PM_MESSAGE_T_HAS_EVENT
+ #else
+  #undef NV_PM_MESSAGE_T_HAS_EVENT
+ #endif
+#else
+ #undef NV_PM_MESSAGE_T_PRESENT
+ #undef NV_PM_MESSAGE_T_HAS_EVENT
+#endif
+
+/* Implement conftest.sh function pci_choose_state */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
+ #define NV_PCI_CHOOSE_STATE_PRESENT
+#else
+ #undef NV_PCI_CHOOSE_STATE_PRESENT
+#endif
+
+/* Implement conftest.sh function vm_insert_page */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
+ #define NV_VM_INSERT_PAGE_PRESENT
+#else
+ #undef NV_VM_INSERT_PAGE_PRESENT
+#endif
+
+/* Implement conftest.sh function irq_handler_t */
+/* I can not find any released kernel that uses the 3 argument variant */
+/* of irq_handler_t */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+ #define NV_IRQ_HANDLER_T_PRESENT
+ #define NV_IRQ_HANDLER_T_ARGUMENT_COUNT 2
+#else
+ #undef NV_IRQ_HANDLER_T_PRESENT
+#endif
+
+/* Implement conftest.sh function acpi_device_ops */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) && \
+               LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
+ #define NV_ACPI_DEVICE_OPS_HAS_MATCH
+#else
+ #undef NV_ACPI_DEVICE_OPS_HAS_MATCH
+#endif
+
+/* Implement conftest.sh function acpi_device_id */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+ #define NV_ACPI_DEVICE_ID_HAS_DRIVER_DATA
+#else
+ #undef NV_ACPI_DEVICE_ID_HAS_DRIVER_DATA
+#endif
+
+/* Implement conftest.sh function acquire_console_sem */
+// 2.6.38 renamed {acquire,release}_console_sem() to console_{,un}lock()
+// but NVIDIA neither checks for these new names nor uses them
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10) && \
+    LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
+ #define NV_ACQUIRE_CONSOLE_SEM_PRESENT
+#else
+ #undef NV_ACQUIRE_CONSOLE_SEM_PRESENT
+#endif
+
+/* Implement conftest.sh function kmem_cache_create */
+/* Only kernels sometime before 2.4.0 don't have this function, and who */
+/* cares anymore */
+#define NV_KMEM_CACHE_CREATE_PRESENT
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+ #define NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT 5
+#else
+ #define NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT 6
+#endif
+
+/* Implement conftest.sh function smp_call_function */
+/* Only kernels sometime before 2.4.0 don't have this function, and who */
+/* cares anymore */
+#define NV_SMP_CALL_FUNCTION_PRESENT
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ #define NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT 3
+#else
+ #define NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT 4
+#endif
+
+/* Implement conftest.sh function on_each_cpu */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+ #define NV_ON_EACH_CPU_PRESENT
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+  #define NV_ON_EACH_CPU_ARGUMENT_COUNT 3
+ #else
+  #define NV_ON_EACH_CPU_ARGUMENT_COUNT 4
+ #endif
+#else
+ #undef NV_ON_EACH_CPU_PRESENT
+#endif
+
+/* Implement conftest.sh function vmm_support */
+/* nv-xen.h does not exist */
+#undef HAVE_NV_XEN
+
+/* Implement conftest.sh function nvmap_support */
+/* nv-android.h does not exist */
+#undef HAVE_NV_ANDROID
+
+/* Implement conftest.sh function acpi_evaluate_integer */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
+ #define NV_ACPI_EVALUATE_INTEGER_PRESENT
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
+  typedef unsigned long long nv_acpi_integer_t;
+ #else
+  typedef unsigned long nv_acpi_integer_t;
+ #endif
+#else
+ #undef NV_ACPI_EVALUATE_INTEGER_PRESENT
+ typedef unsigned long nv_acpi_integer_t;
+#endif
+
+/* Implement conftest.sh function acpi_walk_namespace */
+/* Only kernels sometime before 2.4.0 don't have this function, and who */
+/* cares anymore */
+#define NV_ACPI_WALK_NAMESPACE_PRESENT
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ #define NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT 7
+#else
+ #define NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT 6
+#endif
+
+/* Implement conftest.sh function acpi_os_wait_events_complete */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
+ #define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_PRESENT
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
+  #define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT 0
+ #else
+  #define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT 1
+ #endif
+#else
+ #undef NV_ACPI_OS_WAIT_EVENTS_COMPLETE_PRESENT
+#endif
+
+/* Implement conftest.sh function ioremap_cache */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) && IS_ENABLED(CONFIG_X86)
+ #define NV_IOREMAP_CACHE_PRESENT
+#else
+ #undef NV_IOREMAP_CACHE_PRESENT
+#endif
+
+/* Implement conftest.sh function ioremap_wc */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+ #define NV_IOREMAP_WC_PRESENT
+#else
+ #undef NV_IOREMAP_WC_PRESENT
+#endif
+
+/* Implement conftest.sh function proc_dir_entry */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+ #define NV_PROC_DIR_ENTRY_HAS_OWNER
+#else
+ #undef NV_PROC_DIR_ENTRY_HAS_OWNER
+#endif
+
+/* Implement conftest.sh function INIT_WORK */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
+ #define NV_INIT_WORK_PRESENT
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+  #define NV_INIT_WORK_ARGUMENT_COUNT 2
+ #else
+  #define NV_INIT_WORK_ARGUMENT_COUNT 3
+ #endif
+#else
+ #undef NV_INIT_WORK_PRESENT
+#endif
+
+/* Implement conftest.sh function pci_dma_mapping_error */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5)
+ #define NV_PCI_DMA_MAPPING_ERROR_PRESENT
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+  #define NV_PCI_DMA_MAPPING_ERROR_ARGUMENT_COUNT 2
+ #else
+  #define NV_PCI_DMA_MAPPING_ERROR_ARGUMENT_COUNT 1
+ #endif
+#else
+ #undef NV_PCI_DMA_MAPPING_ERROR_PRESENT
+#endif
+
+/* Implement conftest.sh function agp_memory */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ #define NV_AGP_MEMORY_HAS_PAGES
+#else
+ #undef NV_AGP_MEMORY_HAS_PAGES
+#endif
+
+/* Implement conftest.sh function scatterlist */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
+ #define NV_SCATTERLIST_HAS_PAGE
+#else
+ #undef NV_SCATTERLIST_HAS_PAGE
+#endif
+
+/* Implement conftest.sh function pci_domain_nr */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,71)
+ #define NV_PCI_DOMAIN_NR_PRESENT
+#else
+ #undef NV_PCI_DOMAIN_NR_PRESENT
+#endif
+
+/* Implement conftest.sh function file_operations */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
+ #define NV_FILE_OPERATIONS_HAS_IOCTL
+#else
+ #undef NV_FILE_OPERATIONS_HAS_IOCTL
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
+ #define NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL
+ #define NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL
+#else
+ #undef NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL
+ #undef NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL
+#endif
+
+/* Implement conftest.sh function efi_enabled */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,1)
+ #define NV_EFI_ENABLED_PRESENT
+#else
+ #undef NV_EFI_ENABLED_PRESENT
+#endif
+
+/* Implement conftest.sh function dom0_kernel_present */
+#if 0
+ #define NV_DOM0_KERNEL_PRESENT
+#else
+ #undef NV_DOM0_KERNEL_PRESENT
+#endif
+
+/* Implement conftest.sh function drm_available */
+#if 0
+ #define NV_DRM_AVAILABLE
+#else
+ #undef NV_DRM_AVAILABLE
+#endif
+
+/* Implement conftest.sh function proc_create_data */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+ #define NV_PROC_CREATE_DATA_PRESENT
+#else
+ #undef NV_PROC_CREATE_DATA_PRESENT
+#endif
+
+/* Implement conftest.sh function pde_data */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ #define NV_PDE_DATA_PRESENT
+#else
+ #undef NV_PDE_DATA_PRESENT
+#endif
+
+/* Implement conftest.sh function proc_remove */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ #define NV_PROC_REMOVE_PRESENT
+#else
+ #undef NV_PROC_REMOVE_PRESENT
+#endif
+
+/* Implement conftest.sh function sg_init_table */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+ #define NV_SG_INIT_TABLE_PRESENT
+#else
+ #undef NV_SG_INIT_TABLE_PRESENT
+#endif
+
+/* Check for linux/semaphore.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+ #define NV_LINUX_SEMAPHORE_H_PRESENT
+#else
+ #undef NV_LINUX_SEMAPHORE_H_PRESENT
+#endif
+
+/* Check for linux/cred.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ #define NV_LINUX_CRED_H_PRESENT
+#else
+ #undef NV_LINUX_CRED_H_PRESENT
+#endif
+
+/* Check for drm/drmP.h */
+#if 1
+ #define NV_DRM_DRMP_H_PRESENT
+#else
+ #undef NV_DRM_DRMP_H_PRESENT
+#endif
+
+/* Check for generated/autoconf.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ #define NV_GENERATED_AUTOCONF_H_PRESENT
+#else
+ #undef NV_GENERATED_AUTOCONF_H_PRESENT
+#endif
+
+/* Check for generated/compile.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ #define NV_GENERATED_COMPILE_H_PRESENT
+#else
+ #undef NV_GENERATED_COMPILE_H_PRESENT
+#endif
+
+/* Check for generated/utsrelease.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ #define NV_GENERATED_UTSRELEASE_H_PRESENT
+#else
+ #undef NV_GENERATED_UTSRELEASE_H_PRESENT
+#endif
+
+/* Check for asm/system.h */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+ #define NV_ASM_SYSTEM_H_PRESENT
+#else
+ #undef NV_ASM_SYSTEM_H_PRESENT
+#endif
+
+/* Check for linux/efi.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,33)
+ #define NV_LINUX_EFI_H_PRESENT
+#else
+ #undef NV_LINUX_EFI_H_PRESENT
+#endif
+
+/* Check for linux/kconfig.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
+ #define NV_LINUX_KCONFIG_H_PRESENT
+#else
+ #undef NV_LINUX_KCONFIG_H_PRESENT
+#endif
+
+/* Check for linux/screen_info.h */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+ #define NV_LINUX_SCREEN_INFO_H_PRESENT
+#else
+ #undef NV_LINUX_SCREEN_INFO_H_PRESENT
+#endif
+
+/* Check for linux/nvmap.h */
+// does not (yet) exist in kernel source
+ #undef NV_LINUX_NVMAP_H_PRESENT
diff --git a/conftest.sh b/conftest.sh
new file mode 100644
index 0000000..661cb4d
--- /dev/null
+++ b/conftest.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# This is a replacement for nvidia's conftest.sh
+#
+# We have a new conftest.h that works with kbuild that we don't want
+# overwritten or generated or anything else, so we want any call to
+# conftest.sh to do absolutely nothing.
+exit 0
diff --git a/gl.pc.in b/gl.pc.in
new file mode 100644
index 0000000..c6746ac
--- /dev/null
+++ b/gl.pc.in
@@ -0,0 +1,10 @@
+prefix=@@prefix@@
+exec_prefix=${prefix}
+libdir=@@libdir@@
+includedir=@@includedir@@
+
+Name: gl
+Description: NVIDIA OpenGL library
+Version: @@version@@
+Libs: -L${libdir} -lGL
+Cflags: -I${includedir} 
diff --git a/linux-3.10-i2c.patch b/linux-3.10-i2c.patch
new file mode 100644
index 0000000..8ff38d9
--- /dev/null
+++ b/linux-3.10-i2c.patch
@@ -0,0 +1,39 @@
+Author: Andreas Beckmann <anbe at debian.org>
+Bug-Debian: http://bugs.debian.org/717361
+Description: adjust for kernel 3.10 i2c interface changes
+ backported from 304.108
+
+diff --git a/kernel/nv-i2c.c b/kernel/nv-i2c.c
+index a702506..2aa0b77 100644
+--- a/kernel/nv-i2c.c
++++ b/kernel/nv-i2c.c
+@@ -311,8 +311,6 @@ void* NV_API_CALL nv_i2c_add_adapter(nv_state_t *nv, NvU32 port)
+ BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
+ {
+     struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data;
+-    int osstatus = 0;
+-    BOOL wasReleased = FALSE;
+ 
+ #if defined(KERNEL_2_4)
+     if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter))
+@@ -323,16 +321,11 @@ BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
+ 
+     if (!pI2cAdapter) return FALSE;
+ 
+-    // attempt release with the OS
+-    osstatus = i2c_del_adapter(pI2cAdapter);
+-
+-    if (!osstatus)
+-    {
+-        os_free_mem(pI2cAdapter);
+-        wasReleased = TRUE;
+-    }
++    // release with the OS
++    i2c_del_adapter(pI2cAdapter);
++    os_free_mem(pI2cAdapter);
+ 
+-    return wasReleased;
++    return TRUE;
+ }
+ 
+ #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
diff --git a/linux-3.10-procfs.patch b/linux-3.10-procfs.patch
new file mode 100644
index 0000000..1c56bcf
--- /dev/null
+++ b/linux-3.10-procfs.patch
@@ -0,0 +1,752 @@
+Author: Andreas Beckmann <anbe at debian.org>
+Bug-Debian: http://bugs.debian.org/717361
+Description: adjust for kernel 3.10 procfs interface changes
+ backported from 304.108
+
+diff --git a/kernel/nv-procfs.c b/kernel/nv-procfs.c
+index 3e05ef5..7a9fb70 100644
+--- a/kernel/nv-procfs.c
++++ b/kernel/nv-procfs.c
+@@ -51,69 +51,106 @@ static char nv_registry_keys[NV_MAX_REGISTRY_KEYS_LENGTH];
+ #define NV_SET_PROC_ENTRY_OWNER(entry)
+ #endif
+ 
+-#define NV_CREATE_PROC_ENTRY(name,mode,parent)            \
+-   ({                                                     \
+-        struct proc_dir_entry *__entry;                   \
+-        __entry = create_proc_entry(name, mode, parent);  \
+-        if (__entry != NULL)                              \
+-            NV_SET_PROC_ENTRY_OWNER(__entry);             \
+-        __entry;                                          \
++#if defined(NV_PROC_CREATE_DATA_PRESENT)
++# define NV_CREATE_PROC_ENTRY(name,mode,parent,fops,__data) \
++    proc_create_data(name, __mode, parent, fops, __data)
++#else
++# define NV_CREATE_PROC_ENTRY(name,mode,parent,fops,__data) \
++   ({                                                       \
++        struct proc_dir_entry *__entry;                     \
++        __entry = create_proc_entry(name, mode, parent);    \
++        if (__entry != NULL)                                \
++        {                                                   \
++            NV_SET_PROC_ENTRY_OWNER(__entry);               \
++            __entry->proc_fops = fops;                      \
++            __entry->data = (__data);                       \
++        }                                                   \
++        __entry;                                            \
++    })
++#endif
++
++#define NV_CREATE_PROC_FILE(filename,parent,__name,__data)               \
++   ({                                                                    \
++        struct proc_dir_entry *__entry;                                  \
++        int __mode = (S_IFREG | S_IRUGO);                                \
++        const struct file_operations *fops = &nv_procfs_##__name##_fops; \
++        if (fops->write != 0)                                            \
++            __mode |= S_IWUSR;                                           \
++        __entry = NV_CREATE_PROC_ENTRY(filename, __mode, parent, fops,   \
++            __data);                                                     \
++        __entry;                                                         \
+     })
+ 
+-#define NV_CREATE_PROC_FILE(name,parent,__read_proc,           \
+-    __write_proc,__fops,__data)                                \
++/*
++ * proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
++ * Use the older interface instead unless the newer interface is necessary.
++ */
++#if defined(NV_PROC_REMOVE_PRESENT)
++# define NV_PROC_MKDIR_MODE(name, mode, parent)                \
++    proc_mkdir_mode(name, mode, parent)
++#else
++# define NV_PROC_MKDIR_MODE(name, mode, parent)                \
+    ({                                                          \
+         struct proc_dir_entry *__entry;                        \
+-        int __mode = (S_IFREG | S_IRUGO);                      \
+-        if ((NvUPtr)(__write_proc) != 0)                       \
+-            __mode |= S_IWUSR;                                 \
+-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
++        __entry = create_proc_entry(name, mode, parent);       \
+         if (__entry != NULL)                                   \
+-        {                                                      \
+-            if ((NvUPtr)(__read_proc) != 0)                    \
+-                __entry->read_proc = (__read_proc);            \
+-            if ((NvUPtr)(__write_proc) != 0)                   \
+-            {                                                  \
+-                __entry->write_proc = (__write_proc);          \
+-                __entry->proc_fops = (__fops);                 \
+-            }                                                  \
+-            __entry->data = (__data);                          \
+-        }                                                      \
++            NV_SET_PROC_ENTRY_OWNER(__entry);                  \
+         __entry;                                               \
+     })
++#endif
+ 
+ #define NV_CREATE_PROC_DIR(name,parent)                        \
+    ({                                                          \
+         struct proc_dir_entry *__entry;                        \
+         int __mode = (S_IFDIR | S_IRUGO | S_IXUGO);            \
+-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
++        __entry = NV_PROC_MKDIR_MODE(name, __mode, parent);    \
+         __entry;                                               \
+     })
+ 
++#if defined(NV_PDE_DATA_PRESENT)
++# define NV_PDE_DATA(inode) PDE_DATA(inode)
++#else
++# define NV_PDE_DATA(inode) PDE(inode)->data
++#endif
++
++#define NV_DEFINE_PROCFS_SINGLE_FILE(__name)                                  \
++    static int nv_procfs_open_##__name(                                       \
++        struct inode *inode,                                                  \
++        struct file *filep                                                    \
++    )                                                                         \
++    {                                                                         \
++        return single_open(filep, nv_procfs_read_##__name,                    \
++            NV_PDE_DATA(inode));                                              \
++    }                                                                         \
++                                                                              \
++    static const struct file_operations nv_procfs_##__name##_fops = {         \
++        .owner      = THIS_MODULE,                                            \
++        .open       = nv_procfs_open_##__name,                                \
++        .read       = seq_read,                                               \
++        .llseek     = seq_lseek,                                              \
++        .release    = single_release,                                         \
++    };
++
++static int nv_procfs_read_registry(struct seq_file *s, void *v);
++
+ #define NV_PROC_WRITE_BUFFER_SIZE   (64 * RM_PAGE_SIZE)
+ 
+ static int
+ nv_procfs_read_gpu_info(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++    struct seq_file *s,
++    void *v
+ )
+ {
+-    nv_state_t *nv = data;
++    nv_state_t *nv = s->private;
+     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+     struct pci_dev *dev = nvl->dev;
+     char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH];
+-    int len = 0, status;
++    int status;
+     NvU8 *uuid;
+     NvU32 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5;
+     NvU32 fpga_rev1, fpga_rev2, fpga_rev3;
+     nv_stack_t *sp = NULL;
+ 
+-    *eof = 1;
+-
+     NV_KMEM_CACHE_ALLOC_STACK(sp);
+     if (sp == NULL)
+     {
+@@ -139,26 +176,26 @@ nv_procfs_read_gpu_info(
+         }
+     }
+ 
+-    len += sprintf(page+len, "Model: \t\t %s\n", tmpstr);
+-    len += sprintf(page+len, "IRQ:   \t\t %d\n", nv->interrupt_line);
++    seq_printf(s, "Model: \t\t %s\n", tmpstr);
++    seq_printf(s, "IRQ:   \t\t %d\n", nv->interrupt_line);
+ 
+     if (NV_IS_GVI_DEVICE(nv))
+     {
+         status = rm_gvi_get_firmware_version(sp, nv, &fpga_rev1, &fpga_rev2,
+                                              &fpga_rev3);
+         if (status != RM_OK)
+-            len += sprintf(page+len, "Firmware: \t ????.??.??\n");
++            seq_printf(s, "Firmware: \t ????.??.??\n");
+         else
+         {
+             fmt = "Firmware: \t %x.%x.%x\n";
+-            len += sprintf(page+len, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
++            seq_printf(s, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
+         }
+     }
+     else
+     {
+         if (rm_get_gpu_uuid(sp, nv, &uuid, NULL) == RM_OK)
+         {
+-            len += sprintf(page+len, "GPU UUID: \t %s\n", (char *)uuid);
++            seq_printf(s, "GPU UUID: \t %s\n", (char *)uuid);
+             os_free_mem(uuid);
+         }
+ 
+@@ -166,65 +203,62 @@ nv_procfs_read_gpu_info(
+                     &vbios_rev3, &vbios_rev4,
+                     &vbios_rev5) != RM_OK)
+         {
+-            len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n");
++            seq_printf(s, "Video BIOS: \t ??.??.??.??.??\n");
+         }
+         else
+         {
+             fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n";
+-            len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
+-                           vbios_rev4, vbios_rev5);
++            seq_printf(s, fmt, vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4,
++                       vbios_rev5);
+         }
+     }
+ 
+     if (nv_find_pci_capability(dev, PCI_CAP_ID_AGP))
+         type = "AGP";
+     else if (nv_find_pci_capability(dev, PCI_CAP_ID_EXP))
+-        type = "PCI-E";
++        type = "PCIe";
+     else
+         type = "PCI";
+-    len += sprintf(page+len, "Bus Type: \t %s\n", type);
++    seq_printf(s, "Bus Type: \t %s\n", type);
+ 
+-    len += sprintf(page+len, "DMA Size: \t %d bits\n",
++    seq_printf(s, "DMA Size: \t %d bits\n",
+      nv_count_bits(dev->dma_mask));
+-    len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
+-    len += sprintf(page+len, "Bus Location: \t %04x:%02x.%02x.%x\n",
+-                   nv->domain, nv->bus, nv->slot, PCI_FUNC(dev->devfn));
++    seq_printf(s, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
++    seq_printf(s, "Bus Location: \t %04x:%02x.%02x.%x\n",
++               nv->domain, nv->bus, nv->slot, PCI_FUNC(dev->devfn));
+ #if defined(DEBUG)
+     do
+     {
+         int j;
+         for (j = 0; j < NV_GPU_NUM_BARS; j++)
+         {
+-            len += sprintf(page+len, "BAR%u: \t\t 0x%llx (%lluMB)\n",
+-                           j, nv->bars[j].address, (nv->bars[j].size >> 20));
++            seq_printf(s, "BAR%u: \t\t 0x%llx (%lluMB)\n",
++                       j, nv->bars[j].address, (nv->bars[j].size >> 20));
+         }
+     } while (0);
+ #endif
+ 
+     NV_KMEM_CACHE_FREE_STACK(sp);
+ 
+-    return len;
++    return 0;
+ }
+ 
++NV_DEFINE_PROCFS_SINGLE_FILE(gpu_info);
++
+ static int
+ nv_procfs_read_version(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++    struct seq_file *s,
++    void *v
+ )
+ {
+-    int len = 0;
+-    *eof = 1;
++    seq_printf(s, "NVRM version: %s\n", pNVRM_ID);
++    seq_printf(s, "GCC version:  %s\n", NV_COMPILER);
+ 
+-    len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID);
+-    len += sprintf(page+len, "GCC version:  %s\n", NV_COMPILER);
+-
+-    return len;
++    return 0;
+ }
+ 
++NV_DEFINE_PROCFS_SINGLE_FILE(version);
++
+ static struct pci_dev *nv_get_agp_device_by_class(unsigned int class)
+ {
+     struct pci_dev *dev, *fdev;
+@@ -256,23 +290,16 @@ static struct pci_dev *nv_get_agp_device_by_class(unsigned int class)
+ 
+ static int
+ nv_procfs_read_agp_info(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++    struct seq_file *s,
++    void *v
+ )
+ {
+-    nv_state_t *nv = data;
++    nv_state_t *nv = s->private;
+     nv_linux_state_t *nvl = NULL;
+     struct pci_dev *dev;
+     char   *fw, *sba;
+     u8     cap_ptr;
+     u32    status, command, agp_rate;
+-    int    len = 0;
+-
+-    *eof = 1;
+ 
+     if (nv != NULL)
+     {
+@@ -285,13 +312,12 @@ nv_procfs_read_agp_info(
+         if (!dev)
+             return 0;
+ 
+-        len += sprintf(page+len, "Host Bridge: \t ");
++        seq_printf(s, "Host Bridge: \t ");
+ 
+ #if defined(CONFIG_PCI_NAMES)
+-        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
++        seq_printf(s, "%s\n", NV_PCI_DEVICE_NAME(dev));
+ #else
+-        len += sprintf(page+len, "PCI device %04x:%04x\n",
+-                dev->vendor, dev->device);
++        seq_printf(s, "PCI device %04x:%04x\n", dev->vendor, dev->device);
+ #endif
+     }
+ 
+@@ -303,48 +329,43 @@ nv_procfs_read_agp_info(
+     fw  = (status & 0x00000010) ? "Supported" : "Not Supported";
+     sba = (status & 0x00000200) ? "Supported" : "Not Supported";
+ 
+-    len += sprintf(page+len, "Fast Writes: \t %s\n", fw);
+-    len += sprintf(page+len, "SBA: \t\t %s\n", sba);
++    seq_printf(s, "Fast Writes: \t %s\n", fw);
++    seq_printf(s, "SBA: \t\t %s\n", sba);
+ 
+     agp_rate = status & 0x7;
+     if (status & 0x8)
+         agp_rate <<= 2;
+ 
+-    len += sprintf(page+len, "AGP Rates: \t %s%s%s%s\n",
+-            (agp_rate & 0x00000008) ? "8x " : "",
+-            (agp_rate & 0x00000004) ? "4x " : "",
+-            (agp_rate & 0x00000002) ? "2x " : "",
+-            (agp_rate & 0x00000001) ? "1x " : "");
++    seq_printf(s, "AGP Rates: \t %s%s%s%s\n",
++               (agp_rate & 0x00000008) ? "8x " : "",
++               (agp_rate & 0x00000004) ? "4x " : "",
++               (agp_rate & 0x00000002) ? "2x " : "",
++               (agp_rate & 0x00000001) ? "1x " : "");
+ 
+-    len += sprintf(page+len, "Registers: \t 0x%08x:0x%08x\n", status, command);
++    seq_printf(s, "Registers: \t 0x%08x:0x%08x\n", status, command);
+ 
+     if (nvl == NULL)
+         NV_PCI_DEV_PUT(dev);
+ 
+-    return len;
++    return 0;
+ }
+ 
++NV_DEFINE_PROCFS_SINGLE_FILE(agp_info);
++
+ static int
+ nv_procfs_read_agp_status(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++    struct seq_file *s,
++    void *v
+ )
+ {
+-    nv_state_t *nv = data;
++    nv_state_t *nv = s->private;
+     struct pci_dev *dev;
+     char   *fw, *sba, *drv;
+-    int    len = 0;
+     u8     cap_ptr;
+     u32    scratch;
+     u32    status, command, agp_rate;
+     nv_stack_t *sp = NULL;
+ 
+-    *eof = 1;
+-
+     dev = nv_get_agp_device_by_class(PCI_CLASS_BRIDGE_HOST);
+     if (!dev)
+         return 0;
+@@ -366,22 +387,22 @@ nv_procfs_read_agp_status(
+ 
+     if (NV_AGP_ENABLED(nv) && (command & 0x100))
+     {
+-        len += sprintf(page+len, "Status: \t Enabled\n");
++        seq_printf(s, "Status: \t Enabled\n");
+ 
+         drv = NV_OSAGP_ENABLED(nv) ? "AGPGART" : "NVIDIA";
+-        len += sprintf(page+len, "Driver: \t %s\n", drv);
++        seq_printf(s, "Driver: \t %s\n", drv);
+ 
+         agp_rate = command & 0x7;
+         if (status & 0x8)
+             agp_rate <<= 2;
+ 
+-        len += sprintf(page+len, "AGP Rate: \t %dx\n", agp_rate);
++        seq_printf(s, "AGP Rate: \t %dx\n", agp_rate);
+ 
+         fw = (command & 0x00000010) ? "Enabled" : "Disabled";
+-        len += sprintf(page+len, "Fast Writes: \t %s\n", fw);
++        seq_printf(s, "Fast Writes: \t %s\n", fw);
+ 
+         sba = (command & 0x00000200) ? "Enabled" : "Disabled";
+-        len += sprintf(page+len, "SBA: \t\t %s\n", sba);
++        seq_printf(s, "SBA: \t\t %s\n", sba);
+     }
+     else
+     {
+@@ -394,7 +415,7 @@ nv_procfs_read_agp_status(
+             return 0;
+         }
+ 
+-        len += sprintf(page+len, "Status: \t Disabled\n\n");
++        seq_printf(s, "Status: \t Disabled\n\n");
+ 
+         /*
+          * If we find AGP is disabled, but the RM registry indicates it
+@@ -409,7 +430,7 @@ nv_procfs_read_agp_status(
+ 
+         if (agp_config != NVOS_AGP_CONFIG_DISABLE_AGP && NV_AGP_FAILED(nv))
+         {
+-            len += sprintf(page+len,
++            seq_printf(s,
+                   "AGP initialization failed, please check the ouput  \n"
+                   "of the 'dmesg' command and/or your system log file \n"
+                   "for additional information on this problem.        \n");
+@@ -419,9 +440,11 @@ nv_procfs_read_agp_status(
+     }
+ 
+     NV_PCI_DEV_PUT(dev);
+-    return len;
++    return 0;
+ }
+ 
++NV_DEFINE_PROCFS_SINGLE_FILE(agp_status);
++
+ static int
+ nv_procfs_open_registry(
+     struct inode *inode,
+@@ -431,9 +454,6 @@ nv_procfs_open_registry(
+     nv_file_private_t *nvfp = NULL;
+     nv_stack_t *sp = NULL;
+ 
+-    if (0 == (file->f_mode & FMODE_WRITE))
+-        return 0;
+-
+     nvfp = nv_alloc_file_private();
+     if (nvfp == NULL)
+     {
+@@ -441,6 +461,11 @@ nv_procfs_open_registry(
+         return -ENOMEM;
+     }
+ 
++    nvfp->proc_data = NV_PDE_DATA(inode);
++
++    if (0 == (file->f_mode & FMODE_WRITE))
++        goto done;
++
+     NV_KMEM_CACHE_ALLOC_STACK(sp);
+     if (sp == NULL)
+     {
+@@ -449,19 +474,19 @@ nv_procfs_open_registry(
+         return -ENOMEM;
+     }
+ 
+-    NV_SET_FILE_PRIVATE(file, nvfp);
+-
+     if (RM_OK != os_alloc_mem((void **)&nvfp->data, NV_PROC_WRITE_BUFFER_SIZE))
+     {
+         nv_free_file_private(nvfp);
+         NV_KMEM_CACHE_FREE_STACK(sp);
+-        NV_SET_FILE_PRIVATE(file, NULL);
+         return -ENOMEM;
+     }
+ 
+     os_mem_set((void *)nvfp->data, 0, NV_PROC_WRITE_BUFFER_SIZE);
+     nvfp->fops_sp[NV_FOPS_STACK_INDEX_PROCFS] = sp;
+ 
++done:
++    single_open(file, nv_procfs_read_registry, nvfp);
++
+     return 0;
+ }
+ 
+@@ -471,6 +496,7 @@ nv_procfs_close_registry(
+     struct file  *file
+ )
+ {
++    struct seq_file *s = file->private_data;
+     nv_file_private_t *nvfp;
+     nv_state_t *nv;
+     nv_linux_state_t *nvl = NULL;
+@@ -481,9 +507,8 @@ nv_procfs_close_registry(
+     RM_STATUS rm_status;
+     int rc = 0;
+ 
+-    nvfp = NV_GET_FILE_PRIVATE(file);
+-    if (nvfp == NULL)
+-        return 0;
++    nvfp = s->private;
++    single_release(inode, file);
+ 
+     sp = nvfp->fops_sp[NV_FOPS_STACK_INDEX_PROCFS];
+ 
+@@ -538,56 +563,42 @@ done:
+         os_free_mem(nvfp->data);
+ 
+     nv_free_file_private(nvfp);
+-    NV_SET_FILE_PRIVATE(file, NULL);
+ 
+-    NV_KMEM_CACHE_FREE_STACK(sp);
++    if (sp != NULL)
++        NV_KMEM_CACHE_FREE_STACK(sp);
+ 
+     return rc;
+ }
+ 
+-static struct file_operations nv_procfs_registry_fops = {
+-    .open    = nv_procfs_open_registry,
+-    .release = nv_procfs_close_registry,
+-};
+-
+ static int
+ nv_procfs_read_params(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++    struct seq_file *s,
++    void *v
+ )
+ {
+     unsigned int i;
+-    int len = 0;
+     nv_parm_t *entry;
+ 
+-    *eof = 1;
+-
+     for (i = 0; (entry = &nv_parms[i])->name != NULL; i++)
+-        len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data);
++        seq_printf(s, "%s: %u\n", entry->name, *entry->data);
+ 
+-    len += sprintf(page+len, "RegistryDwords: \"%s\"\n",
++    seq_printf(s, "RegistryDwords: \"%s\"\n",
+                 (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : "");
+-    len += sprintf(page+len, "RmMsg: \"%s\"\n",
+-                (NVreg_RmMsg != NULL) ? NVreg_RmMsg : "");
++    seq_printf(s, "RmMsg: \"%s\"\n", (NVreg_RmMsg != NULL) ? NVreg_RmMsg : "");
+ 
+-    return len;
++    return 0;
+ }
+ 
++NV_DEFINE_PROCFS_SINGLE_FILE(params);
++
+ static int
+ nv_procfs_read_registry(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++    struct seq_file *s,
++    void *v
+ )
+ {
+-    nv_state_t *nv = data;
++    nv_file_private_t *nvfp = s->private;
++    nv_state_t *nv = nvfp->proc_data;
+     nv_linux_state_t *nvl = NULL;
+     char *registry_keys;
+ 
+@@ -596,20 +607,20 @@ nv_procfs_read_registry(
+     registry_keys = ((nvl != NULL) ?
+             nvl->registry_keys : nv_registry_keys);
+ 
+-    *eof = 1;
+-    return sprintf(page, "Binary: \"%s\"\n", registry_keys);
++    return seq_printf(s, "Binary: \"%s\"\n", registry_keys);
+ }
+ 
+-static int
++static ssize_t
+ nv_procfs_write_registry(
+     struct file   *file,
+-    const char    *buffer,
+-    unsigned long  count,
+-    void          *data
++    const char *buffer,
++    size_t count,
++    loff_t *pos
+ )
+ {
+     int status = 0;
+-    nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file);
++    struct seq_file *s = file->private_data;
++    nv_file_private_t *nvfp = s->private;
+     char *proc_buffer;
+     unsigned long bytes_left;
+ 
+@@ -637,30 +648,37 @@ nv_procfs_write_registry(
+     }
+     else
+     {
+-        nvfp->proc_data = data;
+         nvfp->off += count;
+     }
+ 
++    *pos = nvfp->off;
++
+ done:
+     up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+ 
+     return ((status < 0) ? status : (int)count);
+ }
+ 
++static struct file_operations nv_procfs_registry_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_registry,
++    .read    = seq_read,
++    .write   = nv_procfs_write_registry,
++    .llseek  = seq_lseek,
++    .release = nv_procfs_close_registry,
++};
++
+ static int
+ nv_procfs_read_text_file(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++    struct seq_file *s,
++    void *v
+ )
+ {
+-    *eof = 1;
+-    return sprintf(page, "%s", (char *)data);
++    return seq_puts(s, s->private);
+ }
+ 
++NV_DEFINE_PROCFS_SINGLE_FILE(text_file);
++
+ static void
+ nv_procfs_add_text_file(
+     struct proc_dir_entry *parent,
+@@ -668,12 +686,14 @@ nv_procfs_add_text_file(
+     const char *text
+ )
+ {
+-    NV_CREATE_PROC_FILE(filename, parent,
+-            nv_procfs_read_text_file, NULL, NULL, (void *)text);
++    NV_CREATE_PROC_FILE(filename, parent, text_file, (void *)text);
+ }
+ 
+ static void nv_procfs_unregister_all(struct proc_dir_entry *entry)
+ {
++#if defined(NV_PROC_REMOVE_PRESENT)
++    proc_remove(entry);
++#else
+     while (entry)
+     {
+         struct proc_dir_entry *next = entry->next;
+@@ -684,6 +704,7 @@ static void nv_procfs_unregister_all(struct proc_dir_entry *entry)
+             break;
+         entry = next;
+     }
++#endif
+ }
+ #endif
+ 
+@@ -713,26 +734,11 @@ int nv_register_procfs(void)
+     if (!proc_nvidia)
+         goto failed;
+ 
+-    entry = NV_CREATE_PROC_FILE("params", proc_nvidia,
+-        nv_procfs_read_params, NULL, NULL, NULL);
++    entry = NV_CREATE_PROC_FILE("params", proc_nvidia, params, NULL);
+     if (!entry)
+         goto failed;
+ 
+-    /*
+-     * entry->proc_fops originally points to a constant
+-     * structure, so to add more methods for the
+-     * binary registry write path, we need to replace the
+-     * said entry->proc_fops with a new fops structure.
+-     * However, in preparation for this, we need to preserve
+-     * the procfs read() and write() operations.
+-     */
+-    nv_procfs_registry_fops.read = entry->proc_fops->read;
+-    nv_procfs_registry_fops.write = entry->proc_fops->write;
+-
+-    entry = NV_CREATE_PROC_FILE("registry", proc_nvidia,
+-        nv_procfs_read_registry,
+-        nv_procfs_write_registry,
+-        &nv_procfs_registry_fops, NULL);
++    entry = NV_CREATE_PROC_FILE("registry", proc_nvidia, registry, NULL);
+     if (!entry)
+         goto failed;
+ 
+@@ -753,8 +759,7 @@ int nv_register_procfs(void)
+ 
+     nv_procfs_add_text_file(proc_nvidia_patches, "README", __README_patches);
+ 
+-    entry = NV_CREATE_PROC_FILE("version", proc_nvidia,
+-        nv_procfs_read_version, NULL, NULL, NULL);
++    entry = NV_CREATE_PROC_FILE("version", proc_nvidia, version, NULL);
+     if (!entry)
+         goto failed;
+ 
+@@ -771,15 +776,12 @@ int nv_register_procfs(void)
+         if (!proc_nvidia_gpu)
+             goto failed;
+ 
+-        entry = NV_CREATE_PROC_FILE("information", proc_nvidia_gpu,
+-            nv_procfs_read_gpu_info, NULL, NULL, nv);
++        entry = NV_CREATE_PROC_FILE("information", proc_nvidia_gpu, gpu_info,
++            nv);
+         if (!entry)
+             goto failed;
+ 
+-        entry = NV_CREATE_PROC_FILE("registry", proc_nvidia_gpu,
+-            nv_procfs_read_registry,
+-            nv_procfs_write_registry,
+-            &nv_procfs_registry_fops, nv);
++        entry = NV_CREATE_PROC_FILE("registry", proc_nvidia_gpu, registry, nv);
+         if (!entry)
+             goto failed;
+ 
+@@ -789,18 +791,17 @@ int nv_register_procfs(void)
+             if (!proc_nvidia_agp)
+                 goto failed;
+ 
+-            entry = NV_CREATE_PROC_FILE("status", proc_nvidia_agp,
+-                nv_procfs_read_agp_status, NULL, NULL, nv);
++            entry = NV_CREATE_PROC_FILE("status", proc_nvidia_agp, agp_status,
++                nv);
+             if (!entry)
+                 goto failed;
+ 
+             entry = NV_CREATE_PROC_FILE("host-bridge", proc_nvidia_agp,
+-                nv_procfs_read_agp_info, NULL, NULL, NULL);
++                agp_info, NULL);
+             if (!entry)
+                 goto failed;
+ 
+-            entry = NV_CREATE_PROC_FILE("gpu", proc_nvidia_agp,
+-                nv_procfs_read_agp_info, NULL, NULL, nv);
++            entry = NV_CREATE_PROC_FILE("gpu", proc_nvidia_agp, agp_info, nv);
+             if (!entry)
+                 goto failed;
+         }
diff --git a/linux-3.11.patch b/linux-3.11.patch
new file mode 100644
index 0000000..0f02fa8
--- /dev/null
+++ b/linux-3.11.patch
@@ -0,0 +1,18 @@
+Description: fix module build for kernel 3.11
+Author: Milos_SD
+Origin: other, https://devtalk.nvidia.com/default/topic/549532/linux/linux-3-10-solved-3-11-solved-incompatibility-in-function-lsquo-nv_i2c_del_adapter-rsquo-error/2/
+
+--- a/kernel/nv-linux.h
++++ b/kernel/nv-linux.h
+@@ -957,7 +957,11 @@ static inline int nv_execute_on_all_cpus
+ #endif
+ 
+ #if !defined(NV_VMWARE)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
++#define NV_NUM_PHYSPAGES                get_num_physpages()
++#else
+ #define NV_NUM_PHYSPAGES                num_physpages
++#endif
+ #define NV_GET_CURRENT_PROCESS()        current->tgid
+ #define NV_IN_ATOMIC()                  in_atomic()
+ #define NV_LOCAL_BH_DISABLE()           local_bh_disable()
diff --git a/patches.h b/patches.h
new file mode 100644
index 0000000..892d369
--- /dev/null
+++ b/patches.h
@@ -0,0 +1,5 @@
+static struct {
+	const char *short_description;
+	const char *description;
+} __nv_patches[] = {
+{ NULL, NULL } };
diff --git a/xinitrc.sh b/xinitrc.sh
new file mode 100644
index 0000000..a8243b1
--- /dev/null
+++ b/xinitrc.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ -r "${HOME}/.nvidia-settings-rc" ]; then
+	/usr/bin/nvidia-settings -l > /dev/null 2>&1
+fi
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/xorg-driver-video-nvidia-legacy-304xx.git/commitdiff/33afafb099d6a3cc4d755df6e87e74fea08e9805



More information about the pld-cvs-commit mailing list