View Single Post
Old 02-26-07, 06:52 PM   #5
dmonty
Registered User
 
Join Date: Apr 2006
Posts: 3
Smile Re: Multiple video libraries.

Ok I was able to get it going on the Debian diskless clients. Here is the code used:

/usr/src/nvidia/build-command-client
Code:
#!/bin/sh
# Author: Dean Montgomery
# Date: Feb 23, 2007
# Param: $1 = is the nvidia driver file from nvidia.
# Desc: Extract the proprietary nvidia drivers and configure them whithout breaking other video driver libraries or Debian packages.

if [ "x" == "x$1" ]; then
  echo "You must supply a nvidia package name: $0 NVIDIA-Linux-x86-1.0-9631-pkg1.run"
  exit 1
fi
# extract package
sh $1 --extract-only
FOLDER=`echo $1 | awk -F '.run' '{print $1}'`
echo "Extracted to: $FOLDER";

# build kernel module
CDIR=`pwd`;
cd $FOLDER/usr/src/nv
make module
make install

# copy nvidia driver files to the system.
cd $CDIR
rm -fr /usr/local/nvidia.bak
mv /usr/local/nvidia /usr/local/nvidia.bak
mv $FOLDER/usr /usr/local/nvidia

# copy bin files
cd /usr/local/nvidia/bin
cp -f nvidia-bug-report.sh nvidia-settings nvidia-xconfig /usr/local/bin/

# copy some driver files
cp -f /usr/local/nvidia/X11R6/lib/modules/drivers/nvidia_drv.so /usr/lib/xorg/modules/drivers/

# create library symlinks
ldconfig -n /usr/local/nvidia/lib
ldconfig -n /usr/local/nvidia/lib/tls
ldconfig -n /usr/local/nvidia/X11R6/lib
ldconfig -n /usr/local/nvidia/X11R6/lib/modules
ldconfig -n /usr/local/nvidia/X11R6/lib/modules/drivers
ldconfig -n /usr/local/nvidia/X11R6/lib/modules/extensions
/etc/init.d/sd73-nvidia
Code:
#! /bin/sh
#
# Author:       Dean Montgomery
#
### BEGIN INIT INFO
# Provides:          sd73-nvidia
# Required-Start:    mountvirtfs $local_fs
# Required-Stop:     mountvirtfs $local_fs
# Default-Start:     S 2
# Default-Stop:      0 6
# Short-Description: Configure xorg libraries for nvidia.
# Description: Nvidia drivers break via and other chipsets. So we bind mount only if nessesary.
### END INIT INFO

#set -e
. /lib/lsb/init-functions

setup_nvidia(){
  grep Driver /etc/X11/xorg.conf | grep nvidia 1>/dev/null
  if [ "$?" == "0" ]; then
    domounts
  fi
}

domounts(){
  NV="/usr/local/nvidia"
  VERS=`ls /usr/local/nvidia/lib/libGL.so.*.* | awk -F 'libGL.so.' '{print $2}' | tr -d '\n'`
  # xorg
  mount --bind $NV/X11R6/lib/modules/extensions/libglx.so.$VERS /usr/lib/xorg/modules/extensions/libglx.so


  # /usr/lib handled by ldconfig or LD_LIBRARY_PATH
  #export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib/tls:/usr/local/nvidia/X11R6/lib:/usr/local/nvidia/X11R6/lib/modules:/usr/local/nvidia/X11R6/lib/modules/extensions:/usr/local/nvidia/X11R6/lib/modules/drivers
  mount --bind $NV/lib/libGL.la /usr/lib/libGL.la
  mount --bind $NV/lib/libGL.so.$VERS /usr/lib/libGL.so.1
  mount --bind $NV/lib/libGLcore.so.$VERS /usr/lib/libGLcore.so.1
  mount --bind $NV/lib/tls/libnvidia-tls.so.$VERS /usr/lib/libnvidia-tls.so.1
  mount --bind $NV/lib/libGLcore.so.$VERS /usr/lib/xorg/modules/extensions/libGLcore.so
}

remove_nvidia(){
  umount /usr/lib/xorg/modules/extensions/libglx.so
  umount /usr/lib/libGL.la
  umount /usr/lib/libGL.so.1
  umount /usr/lib/libGLcore.so.1
  umount /usr/lib/libnvidia-tls.so.1
  umount /usr/lib/xorg/modules/extensions/libGLcore.so
}

case "$1" in
  start)
        log_begin_msg "Checking for nvidia chipset..."
        setup_nvidia || true
        log_end_msg 0
        exit 0
        ;;
  stop)
        log_begin_msg "Stopping nvidia chipset"
        remove_nvidia || true
        log_end_msg 0;
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop}" >&2
        exit 1
        ;;
esac

exit 0
dmonty is offline   Reply With Quote