View Single Post
Old 12-14-05, 09:39 AM   #4
pezza
Registered User
 
Join Date: Dec 2005
Posts: 1
Default Re: Problem installing my Geforce 4 mx440 on linux

You have to stop the xserver to install the driver. If you get stuck, try this.................

The script below installs Nvidia 1.0-7676 drivers for you, and makes the changes to your XF86Config-4 file. These aren't the latest drivers, but they're stable. Paste the text from the first # to the end into a text editor, save as nvidia.sh in your home directory.

Stop the x-server with cfrl-alt-F1. As root, cd to the home directory you saved the file in, and type sh nvidia.sh. Sit back and watch it install.

Ignore the Knoppix references in the script.





#!/bin/sh
UNSUPPORTED=1
LEGACY=0
#CARDS=$(lspci -n|gawk '{sub("Class","")} $2 == "0300:" {print$3}')
CARDS=$(lspci -n|perl -e 'while(<>){(push(@cards,$_)) if (s/^.+?\s*0300\:\s+(.+?)\s+.*$/$1/)} print join(" ",@cards);')
for card in $CARDS; do
VENDOR=${card%:*}
DEVICE=${card#*:}
case $VENDOR in
10de|12d2)
case $DEVICE in
0008|0009|0010|0018|0019) UNSUPPORTED=1 ;;
0020|0028|0029|002c|002d|00a0|0100|0101|0103|0150| 0151|0152|0153) LEGACY=1;UNSUPPORTED=0 ;;
0170) LEGACY=1;UNSUPPORTED=0 ;; # GeForce4 MX 460 workaround
*) UNSUPPORTED=0 ;;
esac
;;
esac
done
if [ "$UNSUPPORTED" == "1" ]; then
echo Error: No supported nVidia VGA adapter found.
exit 3
fi
if test $(id -u) != 0; then
echo Error: You must be root to run this script!
exit 4
fi
INSTALLED=""
[ -d /KNOPPIX ] || INSTALLED="yes"
if [ -n "$INSTALLED" ]; then
if test -n "$DISPLAY"; then
echo Error: Can\`t be run within X! Use a text console \(ALT-CTRL-F1\)
exit 5
fi
else
if grep -q unionfs /proc/mounts; then
echo Unionfs found.
else
echo Activating Unionfs now.
mkdir -p /tmp/union
mount -t unionfs -o dirs=/tmp/union/:/KNOPPIX /none /KNOPPIX/ 2>&1 >/dev/null
fi
fi
X_CONF=XF86Config-4
if which Xorg >/dev/null; then
[ -e /etc/X11/xorg.conf ] && X_CONF=xorg.conf
fi
#VER=1.0-4620
#URL=http://www.sh.nu/download/nvidia/linux-2.4/
#VER=1.0-5328
#VER=1.0-5336
#VER=1.0-6106
#VER=1.0-6111
#VER=1.0-6629
#VER=1.0-7167
#VER=1.0-7174
#VER=1.0-7664
#VER=1.0-7667
VER=1.0-7676
[ "$VER" == "1.0-7664" -o "$VER" == "1.0-7667" -o "$VER" == "1.0-7676" -a "$LEGACY" == "1" ] && VER=1.0-7174
ARCH=""
[ "$(uname -m)" == "x86_64" ] && ARCH="_64"
[ "$VER" == "1.0-7664" -a "$ARCH" == "_64" ] && VER=1.0-7174
DVER=1.0.${VER#1.0-}
URL=ftp://download.nvidia.com/XFree86/Linux-x86$ARCH/$VER/
EURL=ftp://download.nvidia.com/XFree86/Linux-x86/$VER/
PKG=0
PATCH=0
HACK=0
FW=1
EMUL=1
KVER=$(uname -r)
KV=${KVER:0:3}
cd /usr/src
[ -f NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run ] || wget -Nc "$URL"NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run
rm -rf NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG
sh NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run --extract-only &>/dev/null || (
rm -f NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run
echo NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run could not be extracted
echo and has been deleted. Please restart this script.
exit 1
) || exit $?
if [ "$ARCH" == "_64" -a "$EMUL" = "1" ]; then
[ -f NVIDIA-Linux-x86-$VER-pkg$PKG.run ] || wget -Nc "$EURL"NVIDIA-Linux-x86-$VER-pkg$PKG.run
rm -rf NVIDIA-Linux-x86-$VER-pkg$PKG
sh NVIDIA-Linux-x86-$VER-pkg$PKG.run --extract-only &>/dev/null || (
rm -f NVIDIA-Linux-x86-$VER-pkg$PKG.run
echo NVIDIA-Linux-x86-$VER-pkg$PKG.run could not be extracted
echo and has been deleted. Please restart this script.
exit 2
) || exit $?
fi
if test "$KV" == "2.6" -a "$PATCH" == "1"; then
wget -Nc http://www.minion.de/files/NVIDIA_kernel-$VER-2.6.diff
fi
if test -f /etc/modutils/1alsa; then
mv /lib/modules/extra/alsa /lib/modules/`uname -r`/
rm -f /etc/modutils/1alsa
update-modules
fi
if [ -n "$INSTALLED" ]; then
DM=`cat /etc/X11/default-display-manager 2>/dev/null`
DM=`basename $DM 2>/dev/null`
if test -z "$DM"; then
test -e /etc/init.d/kdm && /etc/init.d/kdm stop
else
test -e /etc/init.d/$DM && /etc/init.d/$DM stop
fi
fi
rmmod nvidia &>/dev/null
rm -f /lib/modules/`uname -r`/kernel/drivers/video/nvidia.*o
cd NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG
if test -x usr/bin/nvidia-settings; then
rm -f /usr/bin/nvidia-settings
rm -f /usr/local/bin/nvidia-settings
cp usr/bin/nvidia-settings /usr/local/bin
fi
if test "$KV" == "2.6"; then
if test "$PATCH" == "1"; then
cd usr/src/nv
patch -p1 < ../../../../NVIDIA_kernel-$VER-2.6.diff
ln -s Makefile.kbuild Makefile
cd ../../..
fi
else
# fix NVIDIA's stupid error in Makefile
perl -pi -e 's/"\$\$\?"/"\$\?"/' Makefile
fi
[ "$(uname -r|cut -d- -f1)" == "2.6.10" ] && perl -pi -e s/pci_find_class/pci_get_class/ usr/src/nv/nv.c
if [ "$(uname -r|grep -E '2.6.11')" != "" -a "$VER" == "1.0-6629" ]; then
#PATCH_BASE_URL="http://www.minion.de/files/1.0-6629/"
PATCH_BASE_URL="http://kanotix.com/files/1.0-6629/"
PATCHES="NVIDIA_kernel-1.0-6629-1155389.diff NVIDIA_kernel-1.0-6629-1161283.diff NVIDIA_kernel-1.0-6629-1165235.diff NVIDIA_kernel-1.0-6629-1171869.diff NVIDIA_kernel-1.0-6629-1175225.diff NVIDIA_kernel-1.0-6629-1182399.diff NVIDIA_kernel-1.0-6629-1189413.diff NVIDIA_kernel-1.0-6629-1201042.diff"
for p in $PATCHES; do
#wget -qO- $PATCH_BASE_URL$p|patch -p0
[ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p
patch -p0 </usr/src/$p || rm -f /usr/src/$p
done
fi
if [ "$VER" == "1.0-7167" ]; then
PATCH_BASE_URL="http://kanotix.com/files/1.0-7167/"
PATCHES="NVIDIA_kernel-1.0-7167-1233959.diff NVIDIA_kernel-1.0-7167-1237815.diff"
for p in $PATCHES; do
#wget -qO- $PATCH_BASE_URL$p|patch -p0
[ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p
patch -p0 </usr/src/$p || rm -f /usr/src/$p
done
fi
if [ "$VER" == "1.0-7174" -a "$ARCH" == "_64" ]; then
PATCH_BASE_URL="http://kanotix.com/files/1.0-7174/"
PATCHES="NVIDIA_kernel-1.0-7174-1258475.diff NVIDIA_kernel-1.0-7174-1296092.diff NVIDIA_kernel-1.0-7174-1386866.diff"
for p in $PATCHES; do
#wget -qO- $PATCH_BASE_URL$p|patch -p0
[ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p
patch -p0 </usr/src/$p || rm -f /usr/src/$p
done
fi
if [ "$VER" == "1.0-7676" -a "$ARCH" == "_64" ]; then
PATCH_BASE_URL="http://kanotix.com/files/1.0-7676/"
PATCHES="NVIDIA_kernel-1.0-7676-1386866.diff"
for p in $PATCHES; do
#wget -qO- $PATCH_BASE_URL$p|patch -p0
[ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p
patch -p0 </usr/src/$p || rm -f /usr/src/$p
done
fi
if test "$FW" = "1"; then
perl -pi -e 's/(NVreg_EnableAGPFW =) .*/\1 1;/' usr/src/nv/os-registry.c
fi
CC=gcc-$(perl -pe '($_)=/gcc.[Vv]ersion\s(4\.\d|3\.\d|2\.\d+)/;' /proc/version)
if test -e /usr/bin/$CC; then
make install CC=/usr/bin/$CC IGNORE_CC_MISMATCH=1
else
make install IGNORE_CC_MISMATCH=1
fi
cd ..
rm -rf NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG
rm -f /etc/modutils/nvidia
perl -pi -e 's|.*char-major-195.*[\n]?||' /etc/modutils/aliases
perl -pi -e 's|[\n]?$|\n|' /etc/modutils/aliases
echo alias char-major-195 nvidia >> /etc/modutils/aliases
update-modules
if ! test -e /etc/X11/$X_CONF.1st; then
cp /etc/X11/$X_CONF /etc/X11/$X_CONF.1st
fi
perl -p -e 's/^[\s]*Load\s*"GLcore"/#\tLoad "GLcore"/;
s/^[\s]*Load\s*"dri"/#\tLoad "dri"/;
s/^[\s]*#*[\s]*Load\s*"glx"/\tLoad "glx"/;
s/^[\s]*Driver\s*"nv"/\tDriver "nvidia"/g;
s/^[\s]*Driver\s*"fbdev"/\tDriver "nvidia"/g;
s/^[\s]*Driver\s*"vesa"/\tDriver "nvidia"/g;
s/DefaultColorDepth.*/DefaultColorDepth 24/;
s/^[\s]*Option\s*"sw_cursor"/\t#Option "sw_cursor"/;
s/^.*IgnoreDisplayDevices.*\n?//g;
s/^.*Coolbits.*\n?//g;
s/^([\s]*Driver\s*"nvidia")/\1\n\tOption "IgnoreDisplayDevices"\t"TV"\n\tOption "Coolbits"\t"1"/g' \
< /etc/X11/$X_CONF.1st > /etc/X11/$X_CONF
if which Xorg >/dev/null; then
perl -pi -e 's/^.*RenderAccel.*\n?//g;s/^.*AllowGLXWithComposite.*\n?//g;s/^.*RandRRotation.*\n?//g;
s/^([\s]*Driver\s*"nvidia")/\1\n\tOption "RenderAccel"\t"1"\n\tOption "AllowGLXWithComposite"\t"1"\n\tOption "RandRRotation"\t"1"/g' /etc/X11/$X_CONF
if ! grep -q Extensions /etc/X11/$X_CONF; then
echo -e '\nSection "Extensions"' >> /etc/X11/$X_CONF
echo -e '\tOption\t"Composite"\t"1"' >> /etc/X11/$X_CONF
echo -e '#\tOption\t"RENDER"\t"1"' >> /etc/X11/$X_CONF
echo 'EndSection' >> /etc/X11/$X_CONF
fi
# disable composite for cards without dx9 support
for card in $CARDS; do
DEVICE=${card#*:}
case $DEVICE in
0020|0028|0029|002c|002d|00a0|00ff|0100|0101|0103| 0110|0111|0112|0113|0150|0151|0152|0153|0170|0171| 0172|0173|0174|0175|0176|0177|0179|017a|017d|0178| 017c|0181|0182|0183|0185|0188|018c|018a|018b|01a0| 01f0|0200|0201|0202|0203|0250|0251|0253|0258|0259| 025b|0280|0281|0282|0286|0288|0289|028c)
perl -pi -e 's/^[\s]*#*[\s]*Option\s*"Composite".*/#\tOption\t"Composite"\t"1"/' /etc/X11/$X_CONF
perl -pi -e 's/^.*RenderAccel.*\n?//g;s/^.*AllowGLXWithComposite.*\n?//g;s/^.*RandRRotation.*\n?//g' /etc/X11/$X_CONF ;;
esac
done
# disable composite if not -c option used
[ "$1" != "-c" ] && perl -pi -e 's/^[\s]*#*[\s]*Option\s*"Composite".*/#\tOption\t"Composite"\t"1"/' /etc/X11/$X_CONF
fi
test "$HACK" == "1" && rm -rf /usr/lib/tls
if [ "$ARCH" == "_64" -a "$EMUL" == "1" ]; then
mkdir -p /emul/ia32-linux/usr/lib/tls/
rm -f /emul/ia32-linux/usr/lib/tls/libnvidia-tls.so.*
rm -f /emul/ia32-linux/usr/lib/libGLcore.so.*
rm -f /emul/ia32-linux/usr/lib/libGL.so.*
rm -f /emul/ia32-linux/usr/lib/libnvidia-tls.so.*
cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/tls/libnvidia-tls.so.$DVER /emul/ia32-linux/usr/lib/tls/
cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/libGLcore.so.$DVER /emul/ia32-linux/usr/lib/
cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/libGL.so.$DVER /emul/ia32-linux/usr/lib/
cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/tls/libnvidia-tls.so.$DVER /emul/ia32-linux/usr/lib/
ln -sf tls/libnvidia-tls.so.$DVER /emul/ia32-linux/usr/lib/libnvidia-tls.so.1
ln -sf libGLcore.so.$DVER /emul/ia32-linux/usr/lib/libGLcore.so
ln -sf libGL.so.$DVER /emul/ia32-linux/usr/lib/libGL.so.1
ln -sf libGL.so.1 /emul/ia32-linux/usr/lib/libGL.so
rm -rf /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG
fi
ldconfig
sync
if [ -n "$INSTALLED" ]; then
if test -z "$DM"; then
test -e /etc/init.d/kdm && /etc/init.d/kdm start
else
test -e /etc/init.d/$DM && /etc/init.d/$DM start
fi
else
modprobe nvidia
/etc/init.d/xsession restart
fi
pezza is offline   Reply With Quote