You are not logged in.

#1 2004-10-17 20:09:40

forest76
Member
From: Poland
Registered: 2004-01-31
Posts: 32

Nvidia Arch-style instaler

Last time I created (for my friend, I haven't nvidia card) Nvidia installer in Arch style (no magic, only regular PKGBUILD).
Install instruction (strange, because nvidia install script overwriting some xorg files and some files are not be removed after uninstall):
0) Exit with X
1) Uninstall driver (pacman -R nvidia) and change all modification in config files (/etc/rc.conf, /etc/modprobe.conf OR /etc/modules.conf /etc/X11/XF86Config OR /etc/X11/xorg.conf)
2) Install and uninstall this version nvidia driver (with -f option)
3) Uninstall and install xorg package
4) Install this driver (with -f option, backup was created) and enjoy.
For my friend everything works fine (GForce MX-400) but please be carefully. Please hack it when something wrong occured.

Greetings,

Miroslaw

PKGBUILD:

# $Id:  $
# Contributor: forest76 <forestt@poczta.onet.pl>
pkgname=nvidia
pkgver=1.0
pkgrel=6111
pkgdesc="The Nvidia drivers for XFree86"
url="http://www.nvidia.com"
depends=('bash')
source=(http://download.nvidia.com/XFree86/Linux-x86/$pkgver-$pkgrel/NVIDIA-Linux-x86-$pkgver-$pkgrel-pkg1.run)
install="nvidia.install"
build() {
   #
   # Unpack and extract
   #
   cd $startdir/src
   chmod +x NVIDIA-Linux-x86-$pkgver-$pkgrel-pkg1.run
   sh NVIDIA-Linux-x86-$pkgver-$pkgrel-pkg1.run -x
   #
   # Make kernel modules
   #
   cd $startdir/src/NVIDIA-Linux-x86-$pkgver-$pkgrel-pkg1/usr/src/nv
   make clean
   make module SYSSRC=/lib/modules/`uname -r`/build || return 1
   #
   # Prepare dirs
   #
   mkdir -p $startdir/pkg/lib/modules/`uname -r`/kernel/drivers/video
   mkdir -p $startdir/pkg/usr/lib
   mkdir -p $startdir/pkg/usr/X11R6/lib/modules/drivers
   mkdir -p $startdir/pkg/usr/X11R6/lib/modules/extensions
   mkdir -p $startdir/pkg/usr/lib/tls
   mkdir -p $startdir/pkg/usr/X11R6/lib
   mkdir -p $startdir/pkg/usr/include
   mkdir -p $startdir/pkg/usr/bin
   #
   # Copy files
   #
   rootdir=$startdir/src/NVIDIA-Linux-x86-$pkgver-$pkgrel-pkg1
   drvname=$pkgver.$pkgrel
   #
   install -m644 $rootdir/usr/src/nv/nvidia.ko $startdir/pkg/lib/modules/`uname -r`/kernel/drivers/video
   #
   install -m644 $rootdir/usr/lib/libGL.so.$drvname $startdir/pkg/usr/lib
   install -m644 $rootdir/usr/lib/libGLcore.so.$drvname $startdir/pkg/usr/lib
   install -m644 $rootdir/usr/lib/libGL.la $startdir/pkg/usr/lib
   install -m644 $rootdir/usr/lib/libnvidia-tls.so.$drvname $startdir/pkg/usr/lib
   install -m644 $rootdir/usr/lib/tls/libnvidia-tls.so.$drvname $startdir/pkg/usr/lib/tls
   #
   install -m644 $rootdir/usr/X11R6/lib/libXvMCNVIDIA.a $startdir/pkg/usr/X11R6/lib
   install -m644 $rootdir/usr/X11R6/lib/libXvMCNVIDIA.so.$drvname $startdir/pkg/usr/X11R6/lib
   install -m644 $rootdir/usr/X11R6/lib/modules/drivers/nvidia_drv.o $startdir/pkg/usr/X11R6/lib/modules/drivers
   install -m644 $rootdir/usr/X11R6/lib/modules/extensions/libglx.so.$drvname $startdir/pkg/usr/X11R6/lib/modules/extensions
   #
   for i in $rootdir/usr/include/*
   do
   cp -rf $i $startdir/pkg/usr/include
   done
   #
   install -m755 $rootdir/usr/bin/nvidia-settings $startdir/pkg/usr/bin
   install -m755 $rootdir/usr/bin/nvidia-bug-report.sh $startdir/pkg/usr/bin
   install -m755 $rootdir/nvidia-installer $startdir/pkg/usr/bin
   #
   # Make links
   #
   ( cd $startdir/pkg/usr/lib && ln -fs libGL.so.$drvname libGL.so && ln -fs libGL.so.$drvname libGL.so.1 )
   ( cd $startdir/pkg/usr/lib && ln -fs libGLcore.so.$drvname libGLcore.so && ln -fs libGLcore.so.$drvname libGLcore.so.1 )
   ( cd $startdir/pkg/usr/X11R6/lib/modules/extensions && ln -fs libglx.so.$drvname libglx.so && ln -fs libglx.so.$drvname libglx.so.1 )
   ( cd $startdir/pkg/usr/X11R6/lib && ln -fs libXvMCNVIDIA.so.$drvname libXvMCNVIDIA_dynamic.so && ln -fs libXvMCNVIDIA.so.$drvname libXvMCNVIDIA_dynamic.so.1 )
}

nvidia.install

pre_install() {
   echo 'Backup files...'
   mv -f /usr/include/GL/glext.h /usr/include/GL/glext.h.pacbak
   mv -f /usr/include/GL/gl.h /usr/include/GL/gl.h.pacbak
   mv -f /usr/include/GL/glx.h /usr/include/GL/glx.h.pacbak
   mv -f /usr/include/GL/glxtokens.h /usr/include/GL/glxtokens.h.pacbak
   mv -f /usr/lib/libGL.la /usr/lib/libGL.la.pacbak
   mv -f /usr/lib/libGL.so /usr/lib/libGL.so.pacbak
   mv -f /usr/lib/libGL.so.1 /usr/lib/libGL.so.1.pacbak
}
post_install() {
#
# Inserting modules...
#
echo "Inserting modules..."
depmod -ae
modprobe nvidia
echo "...DONE"
echo
#
# Change config files...
#
echo "Change config files..."
echo
echo ".../etc/XF86Config..."
echo
sed -i "s:"nv":"nvidia":g" /etc/X11/XF86Config
sed -i "s:Load  "GLcore":#Load  "GLcore":g" /etc/X11/XF86Config
sed -i "s:Load  "dri":#Load  "dri":g" /etc/X11/XF86Config
echo
echo ".../etc/modules.conf or /etc/modprobe.conf..."
echo
if [ `uname -r | awk -F . '{print $2}'` = "4" ]; then
cat << EOF >> /etc/modules.conf
alias /dev/nvidia* nvidia
EOF
elif [ `uname -r | awk -F . '{print $2}'` = "6" ]; then
cat << EOF >> /etc/modprobe.conf
alias char-major-195* nvidia
EOF
fi
echo
echo ".../etc/rc.conf..."
echo
sed -i "s:MODULES=(:MODULES=(nvidia :g" /etc/rc.conf
echo "...DONE"
echo
}

pre_upgrade() {
   pre_install
}

post_upgrade() {
   post_install
}

pre_remove() {
#
# Remove modules...
#
echo "Remove modules..."
rmmod nvidia
depmod -ae
echo "...DONE"
#
# Restoring config files...
#
echo "Restoring config files..."
echo ".../etc/XF86Config..."
echo
sed -i "s:"nvidia":"nv":g" /etc/X11/XF86Config
sed -i "s:#Load  "GLcore":Load  "GLcore":g" /etc/X11/XF86Config
sed -i "s:#Load  "dri":Load  "dri":g" /etc/X11/XF86Config
echo
echo ".../etc/modules.conf or /etc/modprobe.conf..."
echo
if [ `uname -r | awk -F . '{print $2}'` = "4" ]; then
sed -i "s:alias /dev/nvidia* nvidia::g" /etc/modules.conf
sed -i '/^$/d' /etc/modules.conf
echo '' >> /etc/modules.conf
elif [ `uname -r | awk -F . '{print $2}'` = "6" ]; then
sed -i "s:alias char-major-195* nvidia::g" /etc/modprobe.conf
sed -i '/^$/d' /etc/modprobe.conf
echo '' >> /etc/modprobe.conf
fi
echo
echo ".../etc/rc.conf..."
echo
sed -i "s:nvidia ::g" /etc/rc.conf
echo
echo "Post install clean"
echo
rm /var/log/nvidia-installer.log
rm -rf /var/lib/nvidia
rm -f /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko
rmdir /lib/modules/`uname -r`/kernel/drivers/video
echo
echo "...DONE"
echo
}

post_remove() {
   echo 'Restore files...'
   mv -f /usr/include/GL/glext.h.pacbak /usr/include/GL/glext.h
   mv -f /usr/include/GL/gl.h.pacbak /usr/include/GL/gl.h
   mv -f /usr/include/GL/glx.h.pacbak /usr/include/GL/glx.h
   mv -f /usr/include/GL/glxtokens.h.pacbak /usr/include/GL/glxtokens.h
   mv -f /usr/lib/libGL.la.pacbak /usr/lib/libGL.la
   mv -f /usr/lib/libGL.so.pacbak /usr/lib/libGL.so
   mv -f /usr/lib/libGL.so.1.pacbak /usr/lib/libGL.so.1
}

op=$1
shift

$op $* 

Offline

#2 2004-10-17 22:36:08

paranoos
Member
From: thornhill.on.ca
Registered: 2004-07-22
Posts: 442

Re: Nvidia Arch-style instaler

An nVidia installer already exists in Staging. smile

Offline

Board footer

Powered by FluxBB