[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problème dans l'installation d'un pilote pour une carte I82845G


From Olivier Herveïc <olivier dot herveic at efs dot sante dot fr>
Subject Problème dans l'installation d'un pilote pour une carte I82845G
Date Fri, 23 Dec 2005 17:06:44 +0100

Bonjour,
Je travaille dans une boite ou Linux est très largement utilisé, mais ou ce domaine est réservé à une seule personne. Donc durant ces vacances, si il y a un problème je peux pas intervenir. J'ai déjà une petite connaissance du système Linux, mais pas suffisante pour être capable d'intervenir efficacement en cas de problème. J'ai donc décidé de récupérer un pc afin d'y installer Linux pour pouvoir faire des tests.

Configuration de la machine (Dell Optiplex GX 60)
Celeron 1.7Ghz
40Go
400Mo de Ram
Carte graphique Intel I82845G

Naturellement, avant de vous contacter, j'ai vérifié dans les archives si je ne trouvait pas d'informations concernant mon problème.

J'ai installé une Mandriva 2006 sur cette machine, mais lors du premier démarrage l'interface graphique ne s'est pas démarrée bien que la carte graphique et l'écran ont été bien détectés.
Après avoir arrêté "dm", j'ai tester d'autres carte et d'autres resolution avec "XFdrake", mais la seule qui a fonctionnée etait : 640*480 8bits carte VGA.
J'ai téléchargé chez Intel le dernier driver en RPM et en tar.gz, mais je n'est pas réussit à installer ni l'un ni l'autre. J'ai édité le script d'install du tar.gz et j'ai trouvé dans un commentaire qu'il fallait installer gcc, ce que j'ai fait avec urpmi, qui a respecté les dépendances.
 
Lorsque je fais un lsmod (cf annexe : lsmod), il m'indique que i915 est bien lancé : i915, est le driver de la carte graphique, qui doit être utilisé.
J'ai modifié mon fichier XF86Config de tel sorte qu'il se serve de se driver, mais il ne le trouve pas(cf annexe : startx et XF86Config), suite à l'installation du système, le pilote choisi par celui-ci était "1810".

J'ai été chercher sur le site dri.sourceforge.net la dernière version des pilotes au format tar.gz, que j'ai essayé d'installer, mais il me dit qu'il me manque "des modules du kernel" (en fait c'eest ce que j'ai cru comprendre!) (cf annexe install.sh et makefile qui sont les deux fichiers les plus important servant à l'install du pilote).
vous trouverez ci-joint tous les messages qui me sont donnés au cours de l'install (cf lo_install) ainsi que le fichier de log généré par le script (dri.log).


J'espère que je vous ai donné les bonnes informations.
Je vous souhaite à Tous de Joyeuses fêtes de fin d'année
Joyeux Noël

Olivier Herveïc.

GIF image


DIRECT RENDERING OPEN SOURCE PROJECT  -  DRIVER INSTALLATION SCRIPT

[ http://dri.sourceforge.net ]

==========================================================================

Welcome to the DRI Driver Installation Script

The package you downloaded is for the following driver: 

Driver Name    : i915
Description: Intel i915 Driver
Architecture: 
Build Date     : 20051220
Kernel Module  : i915

Optional Information

Driver Version      :  
Special Description :  

Press ENTER to continue or CTRL-C to exit.



=> Ici j'appuie sur Enter


DIRECT RENDERING OPEN SOURCE PROJECT  -  DRIVER INSTALLATION SCRIPT

[ http://dri.sourceforge.net ]

==========================================================================

The script will need to copy the DRI XFree86 driver modules to
your XFree86 directory.

The script will use the following XFree86 directory:

 /usr/X11R6

If this is correct press ENTER, press C to change or CTRL-C to exit.


=> Ici j'appuie sur Enter



DIRECT RENDERING OPEN SOURCE PROJECT  -  DRIVER INSTALLATION SCRIPT

[ http://dri.sourceforge.net ]

==========================================================================

The script also needs to copy the DRM kernel modules to your
kernel module directory.

This version of the script supports 2.4.x and 2.6.x kernels.

Kernel Version   : 2.6.12-12mdk
Module Directory : /lib/modules/2.6.12-12mdk

If this is correct press ENTER, press C to change or CTRL-C to exit.


=> Ici j'appuie sur enter


DIRECT RENDERING OPEN SOURCE PROJECT  -  DRIVER INSTALLATION SCRIPT

[ http://dri.sourceforge.net ]

==========================================================================

The script will now compile the DRM kernel modules for your machine.

Press ENTER to continue or CTRL-C to exit.


=> Ici j'appuie sur enter



Compiling...
ERROR: Kernel modules did not compile

The DRI drivers can not be installed without the latest kernel modules.
Installation will be aborted. See the dri.log file for information on
what went wrong.

Makefile:166: *** Cannot find a kernel config file. Arrêt.
Module                  Size  Used by
isofs                  32312  1 
nls_iso8859_15          4224  1 
udf                    83332  0 
smbfs                  62232  0 
nfsd                  216736  9 
exportfs                4608  1 nfsd
lockd                  58536  2 nfsd
nfs_acl                 2752  1 nfsd
sunrpc                128004  13 nfsd,lockd,nfs_acl
raw                     6592  1 
i915                   17696  0 
drm                    60404  1 i915
md5                     3584  1 
ipv6                  234016  8 
snd_seq_dummy           2532  0 
snd_seq_oss            31136  0 
snd_seq_midi_event      5696  1 snd_seq_oss
snd_seq                46960  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_seq_device          6828  3 snd_seq_dummy,snd_seq_oss,snd_seq
snd_pcm_oss            48960  0 
snd_mixer_oss          16896  1 snd_pcm_oss
snd_intel8x0           29408  0 
snd_ac97_codec         83900  1 snd_intel8x0
snd_pcm                79784  3 snd_pcm_oss,snd_intel8x0,snd_ac97_codec
snd_timer              20548  2 snd_seq,snd_pcm
snd_page_alloc          8392  2 snd_intel8x0,snd_pcm
snd                    46116  9 snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer
soundcore               7008  1 snd
eepro100               27184  0 
mii                     4704  1 eepro100
af_packet              16392  0 
floppy                 55444  0 
video                  14052  0 
thermal                10920  0 
tc1100_wmi              5092  0 
processor              17876  1 thermal
fan                     3172  0 
container               3008  0 
button                  4848  0 
battery                 7460  0 
ac                      3268  0 
ide_cd                 37988  1 
loop                   14504  0 
supermount             31956  1 
intel_agp              20636  1 
agpgart                29032  2 drm,intel_agp
tsdev                   5984  0 
ehci_hcd               29192  0 
uhci_hcd               29136  0 
usbcore               108348  3 ehci_hcd,uhci_hcd
evdev                   7648  0 
ext3                  124744  2 
jbd                    48568  1 ext3
xauth:  creating new authority file /root/.serverauth.10722

This is a pre-release version of the The X.Org Foundation X11.
It is not supported in any way.
Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.
Select the "xorg" product for bugs you find in this release.
Before reporting bugs in pre-release versions please check the
latest version in the The X.Org Foundation "monolithic tree" CVS
repository hosted at http://www.freedesktop.org/Software/xorg/
X Window System Version 6.8.99.900 (6.9.0 RC 0)
Release Date: 01 August 2005 + cvs
X Protocol Version 11, Revision 0, Release 6.8.99.900
Build Operating System: Linux 2.6.12-12mdksmp i686 [ELF] 
Current Operating System: Linux saturne 2.6.12-12mdk #1 Fri Sep 9 18:15:22 CEST 2005 i686
Build Date: 16 September 2005
	Before reporting problems, check http://wiki.X.Org
	to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Dec 23 16:48:05 2005
(==) Using config file: "/etc/X11/xorg.conf"
Using vt 7

The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
>                   Ignoring extra symbols
Errors from xkbcomp are not fatal to the X server

xinit:  unexpected signal 15.
# File generated by XFdrake.

# **********************************************************************
# Refer to the XF86Config man page for details about the format of
# this file.
# **********************************************************************

Section "Files"
    # Multiple FontPath entries are allowed (they are concatenated together)
    # By default, Mandrake 6.0 and later now use a font server independent of
    # the X server to render fonts.
    FontPath "unix/:-1"
EndSection

Section "ServerFlags"
    #DontZap # disable <Crtl><Alt><BS> (server abort)
    AllowMouseOpenFail # allows the server to start up even if the mouse does not work
    #DontZoom # disable <Crtl><Alt><KP_+>/<KP_-> (resolution switching)
EndSection

Section "Module"
    Load "dbe" # Double-Buffering Extension
    Load "v4l" # Video for Linux
    Load "extmod"
    Load "type1"
    Load "freetype"
    Load "glx" # 3D layer
    Load "dri" # direct rendering
EndSection

Section "InputDevice"
    Identifier "Keyboard1"
    Driver "keyboard"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "fr"
    Option "XkbOptions" "compose:rwin"
EndSection

Section "InputDevice"
    Identifier "Mouse1"
    Driver "mouse"
    Option "Protocol" "ExplorerPS/2"
    Option "Device" "/dev/mouse"
    Option "ZAxisMapping" "6 7"
EndSection

Section "Monitor"
    Identifier "monitor1"
    VendorName "Dell"
    ModelName "Dell E173FP"
    HorizSync 31.0-80.0
    VertRefresh 56.0-76.0
    
    # TV fullscreen mode or DVD fullscreen output.
    # 768x576 @ 79 Hz, 50 kHz hsync
    ModeLine "768x576"     50.00  768  832  846 1000   576  590  595  630
    
    # 768x576 @ 100 Hz, 61.6 kHz hsync
    ModeLine "768x576"     63.07  768  800  960 1024   576  578  590  616
EndSection

Section "Device"
    Identifier "device1"
    BoardName "Intel 915"
    Driver "i810"
    Option "DPMS"
EndSection

Section "Screen"
    Identifier "screen1"
    Device "device1"
    Monitor "monitor1"
    DefaultColorDepth 16
    
    Subsection "Display"
        Depth 8
        Virtual 800 600
    EndSubsection
    
    Subsection "Display"
        Depth 15
        Virtual 800 600
    EndSubsection
    
    Subsection "Display"
        Depth 16
        Virtual 800 600
    EndSubsection
    
    Subsection "Display"
        Depth 24
        Virtual 800 600
    EndSubsection
EndSection

Section "ServerLayout"
    Identifier "layout1"
    InputDevice "Keyboard1" "CoreKeyboard"
    InputDevice "Mouse1" "CorePointer"
    Screen "screen1"
EndSection
#!/bin/bash

#######################################################################
# This is the DRI installation script. It compiles the kernel modules 
# and installs the kernel, DRI and libGL modules.
#
#   Frank Worsley   <franco at nettaxi dot com>
#   Alan Hourihane  <alanh at fairlite dot demon dot co dot uk>
#   Felix Kuehling  <fxkuehl at gmx dot de>
#
#######################################################################

###########################################################
# VARIABLE DEFINITIONS
###########################################################

LOGFILE="dri.log"
LOGFILE_TMP="tmp.log"

# Defaults
XF86_DIR="/usr/X11R6"
KERNEL_VER=`uname -r`
KERNEL_LIB_DIR="/lib/modules/$KERNEL_VER"
OPTION=$1

# Kernel version and module filename extension
KERNEL_MAJOR=${KERNEL_VER%%.*}
KERNEL_TAIL=${KERNEL_VER#*.}
KERNEL_MINOR=${KERNEL_TAIL%%.*}
KERNEL_PATCH=${KERNEL_TAIL#.*}

if [ $KERNEL_MAJOR -eq 2 -a $KERNEL_MINOR -le 4 ]; then
    KERNEL_MOD_EXT=o
else
    # This may be incorrect for early 2.5 kernels.
    # Anyone still using one, add an extra check. ;-)
    KERNEL_MOD_EXT=ko
fi

###########################################################
# FUNCTION DECLARATIONS
###########################################################

print_logo() {

	################################################################
	# This function prints a DRI logo and a general text header.
	################################################################

	clear
	echo ""
	echo "DIRECT RENDERING OPEN SOURCE PROJECT  -  DRIVER INSTALLATION SCRIPT"
	echo ""
	echo "[ http://dri.sourceforge.net ]"
	echo ""
	echo "=========================================================================="
	echo ""
}

set_values() {

	#####################################################################
	# Sets up default values.
	#####################################################################

	# Determine driver to be installed
	DRV_NAME=`sed -n '1p' pkginfo`
	DRV_DESC=`sed -n '2p' pkginfo`
	DRV_ARCH=`sed -n '3p' pkginfo`
	DRV_DATE=`sed -n '4p' pkginfo`
	DRV_MODULE=`sed -n '5p' pkginfo`
	DRV_VERSION=`sed -n '6p' pkginfo`
	DRV_BUILD_DESC=`sed -n '7p' pkginfo`
	
	# Determine directories from default or user values
	XF86_DRI_DIR="$XF86_DIR/lib/modules/dri"
	XF86_DRV_DIR="$XF86_DIR/lib/modules/drivers"
	XF86_GL_DIR="$XF86_DIR/lib"
	XF86_EXT_DIR="$XF86_DIR/lib/modules/extensions"
	XF86_OS_DIR="$XF86_DIR/lib/modules/linux"
	KERNEL_DRM_DIR="$KERNEL_LIB_DIR/kernel/drivers/char/drm"
}

check_values() {

	#####################################################################
	# Checks if default/user given values are correct.
	#####################################################################
	
	# Check if installation directories exist
	MSG=$'The following problems have occured:\n'
	FATAL=0
	ERR=0
	
	if [ \( -d $DRV_NAME -o -d core \) -a ! -d "$XF86_DIR" ]; then
		MSG="$MSG"$'\n	- XFree86 directory does not exist'
		ERR="1"
		FATAL="1";
	fi
	
	if [ -d drm -a ! -d "$KERNEL_LIB_DIR" ]; then
		MSG="$MSG"$'\n	- Kernel module directory does not exist'
		ERR="1"
		FATAL="1";
	fi

	if [ -d drm -a ! -d "$KERNEL_DRM_DIR" ]; then
		MSG="$MSG"$'\n	- Kernel DRM directory does not exist'
		ERR="1";
	fi
	
	if [ -d GL -a ! -d "$XF86_GL_DIR" ]; then
		MSG="$MSG"$'\n	- XFree86 GL library directory does not exist'
		ERR="1";
	fi	
	
	if [ -d $DRV_NAME -a ! -d "$XF86_DRI_DIR" ]; then
		MSG="$MSG"$'\n	- XFree86 DRI directory does not exist'
		ERR="1";
	fi		

	if [ -d $DRV_NAME -a ! -d "$XF86_DRV_DIR" ]; then
		MSG="$MSG"$'\n	- XFree86 driver directory does not exist'
		ERR="1";
	fi
	
	if [ -d core -a ! -d "$XF86_EXT_DIR" ]; then
		MSG="$MSG"$'\n	- XFree86 extensions directory does not exist'
		ERR="1";
	fi	
	
	if [ -d core -a ! -d "$XF86_OS_DIR" ]; then
		MSG="$MSG"$'\n	- XFree86 Linux OS directory does not exist'
		ERR="1";
	fi	
	
	# No error so return
	if [ "$ERR" == "0" ]; then
		return 0;
	fi
	
	# Get out if we have a fatal error that requires user to re-enter values
	if [ "$FATAL" == "1" ]; then
		MSG="$MSG"$'\n\nPlease make sure you have entered all information correctly.\n\nPress ENTER to review the information.'
		print_logo
		echo "$MSG"
		read KEY
		return -1;
	fi
	
	#Fix what we can
	MSG="$MSG"$'\n\nThe script can create these directories for you.\n\nPress ENTER to continue or CTRL-C to abort.'
	print_logo
	echo "$MSG"
	read KEY
	
	# Now we just create all directories no matter what ...
	mkdir -p $XF86_GL_DIR
	mkdir -p $XF86_DRI_DIR
	mkdir -p $XF86_DRV_DIR
	mkdir -p $XF86_EXT_DIR
	mkdir -p $XF86_OS_DIR
	mkdir -p $KERNEL_DRM_DIR
	
	return 0;
}

copy_files() {

	#####################################################################
	# This function copies files to their destination directories.
	#####################################################################
	
	echo "Installing files:"
	
	if [ -d $DRV_NAME ]; then
		echo -n "	DRI XFree86 modules..."
		cd $DRV_NAME
		ls -1 *drv.so | while read FILE
		do
			mv -f $XF86_DRV_DIR/$FILE $XF86_DRV_DIR/dri-old.$FILE >& $LOGFILE_TMP;
		done
		ls -1 *dri.so | while read FILE
		do
			mv -f $XF86_DRI_DIR/$FILE $XF86_DRI_DIR/dri-old.$FILE >& $LOGFILE_TMP;
		done	
		cd ..
		cp -f $DRV_NAME/*drv.so $XF86_DRV_DIR
		cp -f $DRV_NAME/*dri.so $XF86_DRI_DIR	
		echo "done"
	fi

	if [ -d drm ]; then
		echo -n "	kernel modules..."
		cd drm
		UP=..
		if [ -d linux -a -d linux-core ]; then
		    if [ $KERNEL_MINOR == 6 ]; then
			cd linux-core
		    else
			cd linux
		    fi
		    UP=../..
		fi
		mkdir -p $KERNEL_DRM_DIR
		ls -1 $DRV_MODULE.$KERNEL_MOD_EXT drm.$KERNEL_MOD_EXT \
		    2> /dev/null | while read FILE
		do
			mv -f $KERNEL_DRM_DIR/$FILE $KERNEL_DRM_DIR/dri-old.$FILE >& $LOGFILE_TMP;
			cp -f $FILE $KERNEL_DRM_DIR
		done
		cd $UP
		unset UP
		/sbin/depmod -a
		echo "done"
	fi
	
	if [ -d GL ]; then
		echo -n "	GL & GLU libraries..."
		cd GL
		ls -1 | while read FILE
		do
			mv -f $XF86_GL_DIR/$FILE $XF86_GL_DIR/dri-old.$FILE >& $LOGFILE_TMP;
			cp -f $FILE $XF86_GL_DIR
		done
		cd ..
		echo "done"
	fi
	
	if [ -d core ]; then
		echo -n "	core libraries..."
		cd core
		for FILE in libdri.so libglx.so libGLcore.so; do
			if [ -e $FILE ]; then
				mv -f $XF86_EXT_DIR/$FILE $XF86_EXT_DIR/dri-old.$FILE >& $LOGFILE_TMP
				cp -f $FILE $XF86_EXT_DIR;
			fi;
		done
		for FILE in libdrm.so; do
			if [ -e $FILE ]; then
				mv -f $XF86_OS_DIR/$FILE $XF86_OS_DIR/dri-old.$FILE >& $LOGFILE_TMP;
				cp -f $FILE $XF86_OS_DIR
			fi;
		done
		cd ..
		echo "done"
	fi

	if [ -e extras/extras.sh ]; then
		echo -n "	Copying extra files..."
		extras/extras.sh $XF86_DIR
		echo "done"
	fi
}

restore_files () {

	print_logo
	echo "Restoring files..."
	
	if [ -d $DRV_NAME ]; then
		echo -n "	XFree86 modules..."
		cd $DRV_NAME
		ls -1 *drv.so | while read FILE
		do
			mv -f $XF86_DRV_DIR/dri-old.$FILE $XF86_DRV_DIR/$FILE >& $LOGFILE_TMP;
		done
		for FILE in *dri.so
		do
			mv -f $XF86_DRI_DIR/dri-old.$FILE $XF86_DRI_DIR/$FILE >& $LOGFILE_TMP;
		done	
		cd ..
		echo "done"
	fi
	
	if [ -d drm ]; then
		echo -n "	kernel modules..."
		cd drm
		ls -1 *.$KERNEL_MOD_EXT | while read FILE
		do
			mv -f $KERNEL_DRM_DIR/dri-old.$FILE $KERNEL_DRM_DIR/$FILE >& $LOGFILE_TMP;
		done
		cd ..
		/sbin/depmod -a
		echo "done"
	fi
	
	if [ -d GL ]; then
		echo -n "	system libraries..."
		cd GL
		ls -1 * | while read FILE
		do
			mv -f $XF86_GL_DIR/dri-old.$FILE $XF86_GL_DIR/$FILE >& $LOGFILE_TMP;
		done
		cd ..
		echo "done"
	fi
	
	if [ -d core ]; then
		echo -n "	core libraries..."
		mv -f $XF86_EXT_DIR/dri-old.libdri.so $XF86_EXT_DIR/libdri.so >& $LOGFILE_TMP;
		mv -f $XF86_EXT_DIR/dri-old.libglx.so $XF86_EXT_DIR/libglx.so >& $LOGFILE_TMP;
		mv -f $XF86_EXT_DIR/dri-old.libGLcore.so $XF86_EXT_DIR/libGLcore.so >& $LOGFILE_TMP;
		mv -f $XF86_OS_DIR/dri-old.libdrm.so $XF86_OS_DIR/libdrm.so >& $LOGFILE_TMP;
		echo "done"
	fi
	
	echo ""
	echo "Completed restoring files."
}

update_config() {

	#####################################################################
	# This function updates the system configuration.
	#####################################################################
	
	echo ""
	echo "Updating configuration:"

	if [ -d GL ]; then
		echo -n "	Running ldconfig..."
		grep "$XF86_DIR" /etc/ld.so.conf >& $LOGFILE_TMP
		if [ $? != 0 ]; then
			echo "$XF86_DIR/lib" >> /etc/ld.so.conf
			/sbin/ldconfig >& $LOGFILE_TMP
			if [ $? != 0 ]; then
				echo "ERROR";
				ERR=1
			else
				echo "done";
			fi
		fi
		cat $LOGFILE_TMP >> $LOGFILE
	fi

	if [ -d drm -a ! "$X_RUNNING" == "1" ]; then
	
		# Only try and update kernel modules if X server is not running

		for MOD in $DRV_MODULE
		do
			echo -n "	Removing old kernel module \"$MOD\"..."
			/sbin/modprobe -r $MOD >& $LOGFILE_TMP

			if [ $? != 0 ]; then
				echo "ERROR"
				ERR=1;
			else
				echo "done";
			fi
	
			cat $LOGFILE_TMP >> $LOGFILE
		
			echo -n "	Inserting new kernel module \"$MOD\"..."
			/sbin/modprobe agpgart >& $LOGFILE_TMP
			/sbin/modprobe $MOD >& $LOGFILE_TMP
		
			if [ $? != 0 ]; then
				echo "ERROR"
				ERR=1;
			else
				echo "done";
			fi
	
			cat $LOGFILE_TMP >> $LOGFILE;
		done;
	fi
	
	if [ "$ERR" == "1" ]; then
		echo ""
		echo "There were errors updating the system configuration."
		echo "See the $LOGFILE file for more information.";
	fi

	rm $LOGFILE_TMP
}

check_config() {

	#####################################################################
	# This function checks the system configuration.
	#####################################################################
	
	echo ""
	echo -n "Checking configuration..."
	
	if [ -d GL ]; then
		# Fix potential libGL problems
		LIBGL1=`ldd $XF86_DIR/bin/glxinfo | grep libGL.so.1 | awk -F" " '{ printf "%s",$3 }'`
		LIBGL=`echo $LIBGL1 | sed -e 's/\.1//'`
		if [ "$LIBGL" != "$XF86_GL_DIR/libGL.so" ]; then
		        SEC_GL_DIR=`echo $LIBGL1 | sed -e 's/libGL.so.1//'`
			echo ""
			echo -n "	second copy of DRI libraries found in "
			echo $SEC_GL_DIR
		
			echo -n "	libraries have been backed up to dri-old.* in "
			echo $SEC_GL_DIR
			echo ""

		        for FILE in libGL.so libGL.so.1 libGL.so.1.2
			do
				mv -f $SEC_GL_DIR/$FILE $SEC_GL_DIR/dri-old.$FILE
				ln -s $XF86_GL_DIR/$FILE $SEC_GL_DIR/$FILE
			done
		fi

		# Make sure libGL and have correct links
		rm -f $XF86_GL_DIR/libGL.so
		rm -f $XF86_GL_DIR/libGL.so.1
		ln -s $XF86_GL_DIR/libGL.so.1.2 $XF86_GL_DIR/libGL.so
		ln -s $XF86_GL_DIR/libGL.so.1.2 $XF86_GL_DIR/libGL.so.1
	fi

	echo "done"
}

###########################################################
# MAIN SCRIPT
###########################################################

# Check if pkginfo file exists
if [ ! -e "pkginfo" ]; then
	echo "Could not locate 'pkginfo' file. Aborting."
	exit 127;
fi

# Check if we are running as root
if [ `whoami` != "root" ] && [ `whoami` != "ROOT" ]; then
	echo "You must be root to install the DRI drivers."
	exit 127;
fi

# Check if sed is installed
which sed &> /dev/null
if [ "$?" != "0" ]; then
	echo "Could not located 'sed' editor. Aborting."
	exit 127;
fi

### FIXME: We should check for matching architectures here!!! ###

# Figure out if we should restore files
if [ "$OPTION" == "restore" ]; then
	
	print_logo
	echo "This will restore your previous files."
	echo ""
	echo "XFree86 Dir       : $XF86_DIR"
	echo "Kernel Module Dir : $KERNEL_LIB_DIR"
	echo ""
	echo "Press ENTER to restore files or C to change defaults."
	read KEY
	
	if [ "$KEY" == "C" ] || [ "$KEY" == "c" ]; then
		print_logo
		echo "Enter new values and then press ENTER."
		echo ""
		echo -n "XFree86 Dir       : "
		read XF86_DIR
		echo -n "Kernel Module Dir : "
		read KERNEL_LIB_DIR
		echo ""
		echo "Press ENTER to restore files."
		read KEY;
	fi

	set_values	
	restore_files
	echo "";
	exit 0;
fi

# Print X is running message
if [ -d drm ]; then
	ps -C X > /dev/null
	if [ $? == 0 ]; then
		X_RUNNING=1
		print_logo
		echo "WARNING: YOUR X SERVER SEEMS TO BE RUNNING!"
		echo ""
		echo "The script can not update your kernel modules while the X server is running."
		echo ""
		echo "You can do one of the following:"
		echo ""
		echo "1. Log out of your X session now and then run this script."
		echo ""
		echo "2. Run the script now and restart your computer after the installation."
		echo "   If you exit your X session now you will not have to restart."
		echo ""
		echo "Press ENTER to continue or CTRL-C to exit."
		read KEY ;
	else
		X_RUNNING=0;
	fi
fi

# Do misc stuff
rm $LOGFILE
touch $LOGFILE

# Setup the defaults values
set_values

# Print a welcome message
print_logo
echo "Welcome to the DRI Driver Installation Script"
echo ""
echo "The package you downloaded is for the following driver: "
echo ""
echo "Driver Name    : $DRV_NAME"
echo "Description    : $DRV_DESC"
echo "Architecture   : $DRV_ARCH"
echo "Build Date     : $DRV_DATE"
echo "Kernel Module  : $DRV_MODULE"
echo ""
echo "Optional Information"
echo ""
echo "Driver Version      : $DRV_VERSION"
echo "Special Description : $DRV_BUILD_DESC"
echo ""
echo "Press ENTER to continue or CTRL-C to exit."
read KEY

# Determine XFree86 Directory and Kernel Module directory from user input
ERR=-1;
while [ "$ERR" == "-1" ]; do

	# Determine XFree86 directory
	if [ -d $DRV_NAME -o -d core ]; then
		print_logo
		echo "The script will need to copy the DRI XFree86 driver modules to"
		echo "your XFree86 directory."
		echo ""
		echo "The script will use the following XFree86 directory:"
		echo ""
		echo " $XF86_DIR"
		echo ""
		echo "If this is correct press ENTER, press C to change or CTRL-C to exit."
		read KEY

		if [ "$KEY" == "C" ] || [ "$KEY" == "c" ]; then
			print_logo
			echo "Please enter the XFree86 directory you would like to use."
			echo ""
			echo "Press ENTER when done or CTRL-C to abort."
			echo ""
			echo -n "Directory: "
			read XF86_DIR ;
		fi
	fi

	# Determine Kernel module directory
	if [ -d drm ]; then
		print_logo
		echo "The script also needs to copy the DRM kernel modules to your"
		echo "kernel module directory."
		echo ""
		echo "This version of the script supports 2.4.x and 2.6.x kernels."
		echo ""
		echo "Kernel Version   : $KERNEL_VER"
		echo "Module Directory : $KERNEL_LIB_DIR"
		echo ""
		echo "If this is correct press ENTER, press C to change or CTRL-C to exit."
		read KEY

		if [ "$KEY" == "C" ] || [ "$KEY" == "c" ]; then
			print_logo
			echo "Please enter your kernel module directory."
			echo ""
			echo "Press ENTER when done or CTRL-C to abort."
			echo ""
			echo -n "Directory: "
			read KERNEL_LIB_DIR ;
		fi
	fi

	# Determine paths from user input or defaults
	set_values
	
	# Check if values are good
	check_values
	ERR="$?";
done

# Compile the kernel modules
if [ -d drm ]; then
	print_logo
	echo "The script will now compile the DRM kernel modules for your machine."
	echo ""
	echo "Press ENTER to continue or CTRL-C to exit."
	read KEY

	echo ""
	echo -n "Compiling..."
	cd drm
	UP=..
	if [ -d linux -a -d linux-core ]; then
	    if [ $KERNEL_MINOR == 6 ]; then
		cd linux-core
	    else
		cd linux
	    fi
	    UP=../..
	fi
	if [ -e Makefile.linux ]; then
		MAKEFILE=Makefile.linux
	else
		MAKEFILE=Makefile
	fi
	# Makefile.linux doesn't have a rule to build .ko-files for 2.6 kernels.
	# They are somehow created automagically after $DRV_MODULE.o is built.
	make -f $MAKEFILE $DRV_MODULE.o >& $UP/$LOGFILE_TMP
	if [ $? != 0 ]; then
		cd $UP
		cat $LOGFILE_TMP >> $LOGFILE
		echo ""
		echo "ERROR: Kernel modules did not compile"
		echo ""
		echo "The DRI drivers can not be installed without the latest kernel modules."
		echo "Installation will be aborted. See the $LOGFILE file for information on"
		echo "what went wrong."
		echo ""
		exit 127;
	else
		echo "done";
	fi
	cd $UP
	unset UP
	cat $LOGFILE_TMP >> $LOGFILE
fi

# Print a last message
print_logo
echo "The script is now ready to complete the installation."
echo ""
echo "Press ENTER to continue or CTRL-C to exit."
read KEY

# Copy files, update config, check config and fix problems
print_logo

copy_files
update_config
check_config

echo ""
echo "Press ENTER to continue."
read KEY

# Print last message
print_logo
echo "The DRI installation is complete."
echo ""
if [ -d drm -a "$X_RUNNING" == "1" ]; then
	echo "Stop your X server, reload the drm module and restart the X server"
	echo "to try the new DRI drivers."
	echo ""
elif [ -d $DRV_NAME -o -d core ]; then
	echo "Restart your X server to try the new DRI drivers."
	echo ""
fi
echo "If you have problems with the DRI after upgrading your drivers"
echo "please visit the DRI website and read the Help and FAQ section."
echo "The FAQ contains solutions to many common problems."
echo ""
echo "Report any bugs, problems and comments on the dri-devel mailing list."
echo ""
echo "Thank you for using the DRI."
echo ""
# Makefile -- For the Direct Rendering Manager module (drm)
#
# Based on David Woodhouse's mtd build.
#
# Modified to handle the DRM requirements and builds on a wider range of
# platforms in a flexible way by David Dawes.  It's not clear, however,
# that this approach is simpler than the old one.
#
# The purpose of this Makefile is to handle setting up everything
# needed for an out-of-kernel source build.  Makefile.kernel contains
# everything required for in-kernel source builds.  It is included into
# this file, so none of that should be duplicated here.
#
# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.40 2003/08/17 17:12:25 dawes Exp $
#

#
# By default, the build is done against the running linux kernel source.
# To build against a different kernel source tree, set LINUXDIR:
#
#    make LINUXDIR=/path/to/kernel/source

#
# To build only some modules, either set DRM_MODULES to the list of modules,
# or specify the modules as targets:
#
#    make r128.o radeon.o
#
# or:
#
#    make DRM_MODULES="r128 radeon"
#

SHELL=/bin/sh

.SUFFIXES:

ifndef LINUXDIR
RUNNING_REL:= $(shell uname -r)

LINUXDIR:= $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \
		 echo /lib/modules/$(RUNNING_REL)/source; \
		 else echo /lib/modules/$(RUNNING_REL)/build; fi)
endif

ifndef O
O:= $(LINUXDIR)
endif

MACHINE:= $(shell uname -m)

# Modules for all architectures
MODULE_LIST:= tdfx.o r128.o radeon.o mga.o sis.o savage.o via.o mach64.o

# Modules only for ix86 architectures
ifneq (,$(findstring 86,$(MACHINE)))
ARCHX86:= 1
MODULE_LIST += i830.o i810.o i915.o
endif

ifneq (,$(findstring sparc64,$(MACHINE)))
ARCHSPARC64:= 1
MODULE_LIST += ffb.o
endif

DRM_MODULES ?= $(MODULE_LIST)

# These definitions are for handling dependencies in the out of kernel build.

DRMTEMPLATES =  drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \
                drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_irq.h \
                drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h \
                drm_core.h

DRMSHARED =     drm.h drm_sarea.h
DRMHEADERS =    drmP.h $(DRMSHARED)

TDFXHEADERS =   tdfx.h $(DRMHEADERS) $(DRMTEMPLATES)
TDFXSHARED =    tdfx.h
R128HEADERS =   r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES)
R128SHARED =    r128.h r128_drv.h r128_drm.h r128_cce.c r128_state.c r128_irq.c
RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \
                $(DRMTEMPLATES)
RADEONSHARED =  radeon.h radeon_drv.h radeon_drm.h radeon_cp.c radeon_irq.c \
                radeon_mem.c radeon_state.c
MGAHEADERS =    mga.h mga_drv.h mga_drm.h mga_ucode.h $(DRMHEADERS) \
		$(DRMTEMPLATES)
MGASHARED =     mga.h mga_dma.c mga_drm.h mga_drv.h mga_irq.c mga_state.c \
                mga_ucode.h mga_warp.c
I810HEADERS =   i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES)
I830HEADERS =   i830.h i830_drv.h i830_drm.h $(DRMHEADERS) $(DRMTEMPLATES)
I915HEADERS =   i915.h i915_drv.h i915_drm.h $(DRMHEADERS) $(DRMTEMPLATES)
I915SHARED  =   i915.h i915_drv.h i915_drm.h i915_irq.c i915_mem.c i915_dma.c
SISHEADERS=     sis.h sis_drv.h sis_drm.h $(DRMHEADERS)
SISSHARED=      sis.h sis_drv.h sis_drm.h sis_ds.c sis_ds.h sis_mm.c
SAVAGEHEADERS=  savage.h savage_drv.h savage_drm.h $(DRMHEADERS) \
                $(DRMTEMPLATES)
VIAHEADERS	= via_drm.h via_drv.h via.h via_mm.h via_ds.h \
		via_3d_reg.h $(DRMHEADERS) $(DRMTEMPLATES)
VIASHARED	= via_drm.h via_drv.h via.h via_mm.h via_ds.h \
		via_3d_reg.h via_drv.c via_ds.c via_irq.c via_map.c \
		via_mm.c via_dma.c via_verifier.c via_verifier.h via_video.c
MACH64HEADERS	= mach64.h mach64_drv.h mach64_drm.h $(DRMHEADERS) \
		$(DRMTEMPLATES)
MACH64SHARED 	= mach64.h mach64_drv.h mach64_drm.h mach64_dma.c \
		mach64_irq.c mach64_state.c
FFBHEADERS	= ffb.h ffb_drv.h $(DRMHEADERS) $(DRMTEMPLATES)

SHAREDSRC = $(DRMSHARED) $(MGASHARED) $(R128SHARED) $(RADEONSHARED) \
	$(SISSHARED) $(TDFXSHARED) $(VIASHARED) $(MACH64SHARED) \
	$(I915SHARED)

PROGS = dristat drmstat

CLEANFILES = *.o *.ko $(PROGS) .depend .*.flags .*.d .*.cmd *.mod.c linux .tmp_versions

# VERSION is not defined from the initial invocation.  It is defined when
# this Makefile is invoked from the kernel's root Makefile.

ifndef VERSION

ifdef RUNNING_REL

# SuSE has the version.h and autoconf.h headers for the current kernel
# in /boot as /boot/vmlinuz.version.h and /boot/vmlinuz.autoconf.h.
# Check these first to see if they match the running kernel.

BOOTVERSION_PREFIX = /boot/vmlinuz.

V:= $(shell if [ -f $(BOOTVERSION_PREFIX)version.h ]; then \
	grep UTS_RELEASE $(BOOTVERSION_PREFIX)version.h | \
	cut -d' ' -f3; fi)

ifeq ($(V),"$(RUNNING_REL)")
HEADERFROMBOOT:= 1
GETCONFIG:= MAKEFILES=$(shell pwd)/.config
HAVECONFIG:= y
endif

# On Red Hat we need to check if there is a .config file in the kernel
# source directory.  If there isn't, we need to check if there's a
# matching file in the configs subdirectory.

ifneq ($(HAVECONFIG),y)
HAVECONFIG:= $(shell if [ -e $(LINUXDIR)/.config ]; then echo y; fi)
endif

ifneq ($(HAVECONFIG),y)
REL_BASE:= $(shell echo $(RUNNING_REL) | sed 's/-.*//')
REL_TYPE:= $(shell echo $(RUNNING_REL) | sed 's/[0-9.-]//g')
ifeq ($(REL_TYPE),)
RHCONFIG:= configs/kernel-$(REL_BASE)-$(MACHINE).config
else
RHCONFIG:= configs/kernel-$(REL_BASE)-$(MACHINE)-$(REL_TYPE).config
endif
HAVECONFIG:= $(shell if [ -e $(LINUXDIR)/$(RHCONFIG) ]; then echo y; fi)
ifneq ($(HAVECONFIG),y)
RHCONFIG:=
endif
endif

ifneq ($(HAVECONFIG),y)
ifneq ($(0),$(LINUXDIR))
GETCONFIG += O=$(O)
endif
HAVECONFIG:= $(shell if [ -e $(O)/.config ]; then echo y; fi)
endif

ifneq ($(HAVECONFIG),y)
$(error Cannot find a kernel config file)
endif

endif

ifneq ($(findstring 2.6,$(RUNNING_REL)),)
$(error Building 2.4 version on $(RUNNING_REL))
endif

CLEANCONFIG:= $(shell if cmp -s $(LINUXDIR)/.config .config; then echo y; fi)
ifeq ($(CLEANCONFIG),y)
CLEANFILES += $(LINUXDIR)/.config .config $(LINUXDIR)/tmp_include_depends
endif

all: modules

modules: includes
	make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`pwd` DRMSRCDIR=`pwd` modules

ifeq ($(HEADERFROMBOOT),1)

BOOTHEADERS = version.h autoconf.h
BOOTCONFIG = .config

CLEANFILES += $(BOOTHEADERS) $(BOOTCONFIG)

includes:: $(BOOTHEADERS) $(BOOTCONFIG)

version.h: $(BOOTVERSION_PREFIX)version.h
	rm -f $@
	ln -s $< $@

autoconf.h: $(BOOTVERSION_PREFIX)autoconf.h
	rm -f $@
	ln -s $< $@

.config: $(BOOTVERSION_PREFIX)config
	rm -f $@
	ln -s $< $@
endif

# This prepares an unused Red Hat kernel tree for the build.
ifneq ($(RHCONFIG),)
includes:: $(LINUXDIR)/.config $(LINUXDIR)/tmp_include_depends .config

$(LINUXDIR)/.config: $(LINUXDIR)/$(RHCONFIG)
	rm -f $@
	ln -s $< $@

.config: $(LINUXDIR)/$(RHCONFIG)
	rm -f $@
	ln -s $< $@

$(LINUXDIR)/tmp_include_depends:
	echo all: > $@
endif

# Make sure that the shared source files are linked into this directory.


SHAREDDIR:= ../shared

HASSHARED:= $(shell if [ -d $(SHAREDDIR) ]; then echo y; fi)

ifeq ($(HASSHARED),y)
includes:: $(SHAREDSRC) drm_pciids.h

drm_pciids.h: $(SHAREDDIR)/drm_pciids.txt
	sh ../scripts/create_linux_pci_lists.sh < $(SHAREDDIR)/drm_pciids.txt

$(SHAREDSRC):
	@if [ -r $(SHAREDDIR)/$@ ]; then \
		(rm -f $@; set -x; ln -s $(SHAREDDIR)/$@ $@); fi

CLEANFILES += $(SHAREDSRC)
endif

includes:: linux

linux:
	rm -f linux
	ln -s . linux

clean cleandir:
	rm -rf $(CLEANFILES)

$(MODULE_LIST)::
	make DRM_MODULES=$@ modules

# Build test utilities

PRGCFLAGS = $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \
	    -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \
	    -I. -I../../..

DRMSTATLIBS = -L../../.. -L.. -ldrm -lxf86_os \
	      -L../../../../dummylib -ldummy -lm

programs: $(PROGS)

dristat: dristat.c
	$(CC) $(PRGCFLAGS) $< -o $@

drmstat: drmstat.c
	$(CC) $(PRGCFLAGS) $< -o $@ $(DRMSTATLIBS)

else

# Check for kernel versions that we don't support.

BELOW24:= $(shell if [ $(VERSION) -lt 2 -o $(PATCHLEVEL) -lt 4 ]; then \
		echo y; fi)

ifeq ($(BELOW24),y)
$(error Only 2.4.x and later kernels are supported \
	($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)))
endif

ifdef ARCHX86
ifndef CONFIG_X86_CMPXCHG
$(error CONFIG_X86_CMPXCHG needs to be enabled in the kernel)
endif
endif

# This needs to go before all other include paths.
CC += -I$(DRMSRCDIR)

# Check for Red Hat's 4-argument do_munmap().
DOMUNMAP:= $(shell grep do_munmap $(LINUXDIR)/include/linux/mm.h | \
                grep -c acct)

ifneq ($(DOMUNMAP),0)
EXTRA_CFLAGS += -DDO_MUNMAP_4_ARGS
endif

# Check for 5-argument remap_page_range() in RH9 kernel, and 2.5.x kernels
RPR:= $(shell grep remap_page_range $(LINUXDIR)/include/linux/mm.h | \
		grep -c vma)

ifneq ($(RPR),0)
EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5_ARGS
endif

# Check for 4-argument vmap() in some 2.5.x and 2.4.x kernels
VMAP:= $(shell grep -A1 'vmap.*count,$$' $(LINUXDIR)/include/linux/vmalloc.h | \
		grep -c prot)

ifneq ($(VMAP),0)
EXTRA_CFLAGS += -DVMAP_4_ARGS
endif

# Check for PAGE_AGP definition
PAGE_AGP:= $(shell cat $(LINUXDIR)/include/asm/agp.h 2>/dev/null | \
		grep -c PAGE_AGP)

ifneq ($(PAGE_AGP),0)
EXTRA_CFLAGS += -DHAVE_PAGE_AGP
endif


# Start with all modules turned off.
CONFIG_DRM_GAMMA:= n
CONFIG_DRM_TDFX:= n
CONFIG_DRM_MGA:= n
CONFIG_DRM_I810:= n
CONFIG_DRM_R128:= n
CONFIG_DRM_RADEON:= n
CONFIG_DRM_I830:= n
CONFIG_DRM_I915:= n
CONFIG_DRM_SIS:= n
CONFIG_DRM_FFB:= n
CONFIG_DRM_SAVAGE:= n
CONFIG_DRM_VIA:= n
CONFIG_DRM_MACH64:= n

# Enable module builds for the modules requested/supported.

ifneq (,$(findstring tdfx,$(DRM_MODULES)))
CONFIG_DRM_TDFX:= m
endif
ifneq (,$(findstring r128,$(DRM_MODULES)))
CONFIG_DRM_R128:= m
endif
ifneq (,$(findstring radeon,$(DRM_MODULES)))
CONFIG_DRM_RADEON:= m
endif
ifneq (,$(findstring sis,$(DRM_MODULES)))
CONFIG_DRM_SIS:= m
endif
ifneq (,$(findstring via,$(DRM_MODULES)))
CONFIG_DRM_VIA:= m
endif
ifneq (,$(findstring mach64,$(DRM_MODULES)))
CONFIG_DRM_MACH64:= m
endif
ifneq (,$(findstring ffb,$(DRM_MODULES)))
CONFIG_DRM_FFB:= m
endif

# These require AGP support

ifdef CONFIG_AGP
ifneq (,$(findstring mga,$(DRM_MODULES)))
CONFIG_DRM_MGA:= m
endif
ifneq (,$(findstring i810,$(DRM_MODULES)))
CONFIG_DRM_I810:= m
endif
ifneq (,$(findstring i830,$(DRM_MODULES)))
CONFIG_DRM_I830:= m
endif
ifneq (,$(findstring i915,$(DRM_MODULES)))
CONFIG_DRM_I915:= m
endif
ifneq (,$(findstring savage,$(DRM_MODULES)))
CONFIG_DRM_SAVAGE:= m
endif
endif

include $(DRMSRCDIR)/Makefile.kernel

# Depencencies
$(tdfx-objs):	$(TDFXHEADERS)
$(r128-objs):	$(R128HEADERS)
$(mga-objs):	$(MGAHEADERS)
$(i810-objs):	$(I810HEADERS)
$(i830-objs):	$(I830HEADERS)
$(i915-objs):	$(I915HEADERS)
$(radeon-objs):	$(RADEONHEADERS)
$(sis-objs):	$(SISHEADERS)
$(ffb-objs):	$(FFBHEADERS)
$(savage-objs): $(SAVAGEHEADERS)
$(via-objs):	$(VIAHEADERS)
$(mach64-objs): $(MACH64HEADERS)

endif