LTSP + NVidia Binary Drivers How-to
June 13, 2001

Byron Poland
wpoland@speakeasy.net

Introduction

This is a brief description of what I did to get the NVidia binary video
drivers to work on a LTSP diskless workstation.  I am running a server
with Linux Mandrake 8.0 and LTSP 2.08-pre2, this should work on other
distributions and LTSP versions greater than 2.08-pre2.  I am no expert
I just fumble around until things work.  This document assumes that you
have a working LTSP setup and XFree4 on your server or another accessible
computer.

Part 1 XFree 4.0

These directions were developed after following the ones in the LTSP
errata section, and some trial and error.

First copy the XFree86 binary from /usr/X11R6/bin/
to /tftpboot/lts/ltsroot/ltsbin/

	$ cp /usr/X11R6/bin/XFree86 /tftpboot/lts/ltsroot/ltsbin/

Next copy over the needed libs.  you need libz.so.1 and libpam.so.0.
On my Mandrake 8.0 system, these libs are symbolic links, so I copied the
actual libs and recreated the links in the ../ltsroot/lib/ directory

  $ cp /lib/libz.so.1.1.3 /tftpboot/lts/ltsroot/lib/
  $ ln -s /tftpboot/lts/ltsroot/lib/libz.so.1.1.3    \
          /tftpboot/lts/ltsroot/lib/libz.so.1

  $ cp /lib/libpam.so.0.74 /tftpboot/lts/ltsroot/lib/
  $ ln -s /tftpboot/lts/ltsroot/lib/libpam.so.0.74   \
          /tftpboot/lts/ltsroot/lib/libpam.so.0

I found also that I needed the XFree4 modules on the exported filesystem.

  $ cp -R /usr/X11R6/lib/modules/ /tftpboot/lts/ltsroot/usr/X11R6/lib/modules/

Next download the XF86Config-4 file from the LTSP errata page
(http://www.ltsp.org/XF86Config-4)  and put it in the
/tftpboot/lts/ltsroot/etc/ directory, and modify it for your workstation.
(at this point just change the driver to nv and save it this will test
your XFree4 setup before we move onto the NVidia drivers.

Edit your lts.conf file to use the XFree86 server and the XF86Config-4
file you can do this at the top of the file to use XFree4 on all
workstations, or under a workstation name to just use it on that one system.

  XSERVER            = XFree86
  XF86CONFIG_FILE    = XF86Config-4

Save your files and boot your workstation, if all went well your
workstation should be using XFree4.

Part 2:  NVidia Binary Drivers: Kernel Driver

If you've used the NVidia drivers before you probably know that there is a
kernel module and and XFree module. to start download the NVidia Kernel
driver tar.gz file:

  http://www.nvidia.com/docs/lo/200/SUPP/NVIDIA_kernel-1.0-1251.tar.gz

uncompress:

  $ tar -zxvf NVIDIA_kernel-1.0-1251.tar.gz

Kernel include files:  You will need the kernel include files for the
kernel running on your workstation.  There are a couple options here,
first would be to download the source for the kernels include with the
LTSP distribution and use that, or compile your own kernel for the
workstation, and use that source.  (I used the second option but either
way it should be the similar). 

If you decide to build a kernel using the source included with your
distribution (in /usr/src/linux/) then you don't need this option.  If
you downloaded source for the LTSP kernels or complied a new one from
a different source (I use the 2.4.5 kernel source) then you will need
to read the README that came with the NVidia kernel module.

If you want to build NVdriver for a system other than the compiling
system, then you?ll need to run the make as:

  $ make SYSINCLUDE=/src/kern/my-smp-kernel/include

The make command should create a file called NVdriver in the
NVIDIA_kernel directory.  Copy th NVdirver to your exported file
system.  (I put all my modules in /tftpboot/lts/ltsroot/lib/modules the
LTSP install has an ../ltsroot/modules directory where they could also
go I believe).  You also need to rename it with to NVdriver.o so the
LTSP module loader script in the rc.local file can find it.

  $ cp NVdriver /tftpboot/lts/ltsroot/modules/NVdriver.o

next edit your lts.conf file to load the NVdriver module for the workstation:

  MODULE_01       = NVdriver

Next you need to create the nvidia device files.  in the files extracted
from the tarball you will find a file called makedevices.sh edit it so
it looks like the following, or copy the following to a new script
(between the lines):

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    #!/bin/sh
    major=195
    for i in 0 1 2 3; do
        devfile="/tftpboot/lts/ltsroot/dev/nvidia$i?
        rm -f $devfile
        if ! mknod $devfile c $major $i || ! chmod 0666 $devfile; then
            echo ?Couldn?t create device \"$devfile\?.?
            exit 1
        fi
    done
    devfile=/tftpboot/lts/ltsroot/dev/nvidiactl              
    rm -f $devfile        
    mknod $devfile c $major 255
    chmod 0666 $devfile

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Make sure the file an executable, and run it, it should creade 4 device
files called nvidia0 nvidia1 nvidia2 and nvidia3 in /tftpboot/lts/ltsboot/dev/



Part 3: NVidia Binary Drivers: GLX Driver

Download the GLX tar ball from NVidia:

  http://www.nvidia.com/docs/lo/201/SUPP/NVIDIA_GLX-1.0-1251.tar.gz

uncompress:

  $ tar -zxvf NVIDIA_GLX-1.0-1251.tar.gz

go into the created directory
	
  $ cd NVIDIA_GLX-1.0-1251

The directory is actually just a directory tree with the XFree module and
the GL libs.  so just copy them over.

  $ cp NVIDIA_GLX-1.0-1251/usr/X11R6/lib/modules/drivers/nvidia_drv.o   \
       /tftpboot/lts/ltsroot/usr/X11R6/lib/modules/drivers/

  $ cp NVIDIA_GLX-1.0-1251/usr/X11R6/lib/modules/extensions/libglx.so.1.0.1251 \
       /tftpboot/lts/ltsroot/usr/X11R6/lib/modules/extensions/

  $ cp NVIDIA_GLX-1.0-1251/usr/lib/libGLcore.so.1.0.1251  \
       /tftpboot/lts/ltsroot/lib/

  $ cp NVIDIA_GLX-1.0-1251/usr/lib/libGLcore.so.1.0.1251  \
       /tftpboot/lts/ltsroot/usr/lib/

  $ cp NVIDIA_GLX-1.0-1251/usr/lib/libGL.so.1.0.1251      \
       /tftpboot/lts/ltsroot/lib/

  $ cp NVIDIA_GLX-1.0-1251/usr/lib/libGL.so.1.0.1251      \
       /tftpboot/lts/ltsroot/usr/lib/

Change into the /tftpboot/lts/ltsroot/usr/X11R6/lib/modules/extensions/
directory

  $ cd  /tftpboot/lts/ltsroot/usr/X11R6/lib/modules/extensions/

Rename the mesa libs:

  $ mv libGLcore.a libGLcore.a.mesa

  $ mv libglx.a libglx.a.mesa

Create the symbolic link:

  $ ln -fs libglx.so.1.0.1251 libglx.so

Change into the /tftpboot/lts/ltsroot/usr/lib/ directory

  $ cd /tftpboot/lts/ltsroot/usr/lib/

Create the symbolic links:

  $ ln -fs libGL.so.1.0.1251 libGL.so.1

  $ ln -fs libGL.so.1 libGL.so

  $ ln -fs libGLcore.so.1.0.1251 libGLcore.so.1

and repeat in the /tftpboot/lts/ltsroot/lib/ directory  (Note:  the libs
probably only need to be in one place, but I'm not sure which and can't
remember why I put them in both)

  $ cd /tftpboot/lts/ltsroot/lib/

  $ ln -fs libGL.so.1.0.1251 libGL.so.1

  $ ln -fs libGL.so.1 libGL.so

  $ ln -fs libGLcore.so.1.0.1251 libGLcore.so.1


Part 4: Configureing your XF86Config-4

open /tftpboot/lts/ltsroot/etc/XF86Config-4 in your favorite text editor:

edit it to use the nvidia driver instead of the nv driver, also make sure
it loads the glx module, and that is won?t load the dri and GLcore modules,
and that should be it.  My config file is attached for referrence.

Example XF86-Config-4 file for NVidia drivers (make sure you edit for
your monitors etc. ):

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Section "ServerLayout"
        Identifier "XFree86 Configured"
        Screen        "Screen0" 
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        RgbPath    "/usr/X11R6/lib/X11/rgb"
        FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
        FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
        FontPath   "/usr/X11R6/lib/X11/fonts/Speedo/"
        FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
        FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

# This loads all the modules...

Section "Module"
#        Load  "GLcore"
        Load  "dbe"
#        Load  "dri"
        Load  "extmod"
        Load  "glx"
#        Load  "pex5"
#        Load  "record"
#        Load  "xie"
#        Load  "v4l"
	Load "type1"
	Load "freetype"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "keyboard"
	Option 	    "AutoRepeat"  "250 30"
    	Option      "XkbRules" "xfree86"
    	Option      "XkbModel" "pc105"
        Option      "XkbLayout" "us"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Device" "/dev/psaux"
        Option      "Protocol" "IMPS/2"
#        Option      "Emulate3Buttons" "on"
        Option      "ZAxisMapping" "4 5"
EndSection

Section "Monitor"
        Identifier "flatpanel"
        VendorName "samsung"
        ModelName  "570V"
        HorizSync  30-61
        VertRefresh 50-75
EndSection

Section "Device"
        Identifier "My Video Card"
        Driver "nvidia"
        BoardName "Unknown"
        Option "DPMS" 
EndSection

Section "Screen"
        Identifier "Screen0"
        Device "My Video Card"
        Monitor "flatpanel"
        DefaultDepth 16
    Subsection "Display"
        Depth       16
        Modes       "1024x768" "800x600" "640x480"
        ViewPort   0 0
    EndSubsection
EndSection

Section "DRI"
EndSection


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

That should be the nvidia drivers should work, add in other NVidia features
like tv out to your workstation as you please.   This is what I did to
successfully get the NVidia drivers to work for me.  I hope it is useful
to others.
