3.4. Install Nvidia OpenGL drivers

3.4.1. Install NVIDIA kernel driver package

First, unpack the kernel driver source.


	cd /usr/src
	tar -xvzf NVIDIA_kernel-1.0-2314.tar.gz
	tar -xvzf NVIDIA_GLX-1.0-2313.tar.gz
	cd NVIDIA_kernel-1.0-2314
	
Now, before building and installing this kernel driver, it has some AGP options that can affect performance. You shouldn't really attempt to use these options during your first attempt at getting your card working and not unless you are using a very recent 2.4 kernel and the lastest nvidia drivers.

The Linux kernel source can be compiled with an AGP character device that the Nvidia driver can use to get better performance. If your kernel does not have the AGP driver for your motherboard chipset compiled in, then the Nvidia kernel driver uses its own built-in AGP support if your video card is an AGP card. If you want to experiment with the Linux kernel AGP support, you should be able to rebuild and install your kernel with the appropriate support:

	cd /usr/src/linux
	make menuconfig
	# Go to Character devices and put a * by /dev/agpgart support
	# and also put a * by your motherboard chipset type.
	# Go to the Processor type and features and put a * by
	# MTTR support.
	# Save the config.
	make
	make modules
	make install
	make modules_install
	reboot
	

Futher tweaking can be done to the file os-registry.c in the NVIDIA kernel source. Looking though this file, you will see many flag variables (they can be set to 0 or 1) to control options that affect performance and stability! You should try your configuration with this file unmodified first to see that your system works. If it does, you can try these options. Among the options you can try here are:

Tip

If you experience problems starting X, see the files TNT_USERS_README and M64_USERS_README. These files explain how to tweak the kernel driver. They were written to fix problems with TNT and TNT2 M64 cards but these tweaks are reported to help the GeForce2 MX also. Try bypassing the BIOS as explained in M64_USERS_README.

After you have tweaked (or not tweaked) your Linux kernel and os-registry.c file, you can build and install the kernel module.

	# The make command will build and install the driver:
	make
	
After the driver is loaded, you can see the driver configuration with cat /proc/nv/card0

3.4.2. Install NVIDIA GLX package

Installing the Nvidia OpenGL library package is nothing too special. First you need to clean up some old files.


	# delete the libGL.* files that come with XFree86 / Mesa ...
	# the nvidia libGL.* should replace them
	# The more recent Nvidia Makefile installer does this for you.

	cd /usr/X11R6/lib
	rm libGL.*
	cd modules/extensions
	rm libGL*
	rm libglx*
	cd /usr/lib
	rm libGL.*
	

With the conflicting old files gone, you can begin the installation.


	cd ..
	cd NVIDIA_GLX-1.0-2313
	make
	ldconfig

	# make might not install the C header files that come with
	# the libraries in the NVIDIA_GLX package so, do this:
	cd usr/include/GL
	cp *.h /usr/include/GL
	# usr/include/GL is a subdirectory in the NVIDIA_GLX package.
	# /usr/include/GL should be a symlink to /usr/X11R6/include/GL
	# so you could copy to there instead if you want.

	# Make a basic XF86Config file using the "nv" driver:
	cd /etc/X11
	xf86config
	# Follow the prompts and fill in the information xf86config asks for.
	# Select the Nvidia GeForce or appropriate name.
	# You can test X with this XF86Config file, or continue for OpenGL:

	# You must edit XF86Config and set the following:
	vi XF86Config
	#	Load "glx"
	#	Replace 'driver "nv"' with 'driver "nvidia"'
	#	Put "1600x1200" first (or your preferred screen resolution)
	#	Copy ttf fonts from Windows into a font directory and add a font path.
    #            Use ttmkfdir (check freshmeat.net) to a fonts.dir file.
	#	A good place to keep your own fonts is /usr/local/share/fonts ...

	# Nvidia drivers do NOT use the dri module - don't load it.

        # You may like to edit /etc/X11/xinit/xinitrc to have run "startkde"
        # or "gnome-session" instead of twm.

	# Note: /usr/include/GL should be a symlink to /usr/X11R6/include/GL
	

Specifying "nvidia" for the driver in the XF86Config makes that take effect each time you startx. But the NVdriver kernel driver will have to be loaded before you startx. It can be loaded with:

		# to load it
		insmod NVdriver
		# If you need to unload it:
		rmmod NVdriver
	
You should not have to use insmod manually. The NVdriver installation should have inserted a line into /etc/modules.conf (or conf.modules) that looks something like:

                alias char-major-195 NVdriver
        
If this line is present, NVdriver is loaded automatically when X is started. You can check if its loaded using the command, lsmod.

In my experience, your video system will become unstable if you compile, load, and unload the NVdriver module. You should reboot your system after rebuilding this module to help make sure your system doesn't lock inside X. Its possible that your screen will go black and the keyboard will become unresponsive after switching NVdriver. It is advisable to always have another computer with telnet or ssh that you can use to get into your Linux box to shut it down properly if this happens.