#!/bin/sh # fglrx An ATi official driver automatic install script # # Usage: fglrx # # Exit codes: # 0 - everything worked perfectly # 1 - the lunch is wrong - empty line or non-rpm package, or not running as root # 2 - kernel module compile failed # 3 - kernel module install failed # # The comments are rare, process is mostly described in information for user # # (c) 2005, Sergew Popov # (c) 2005, Vector Linux # License: GNU GPL if [[ `whoami` != "root" ]] then echo echo "You need to be root to install these drivers" exit 1 fi if [ -n "$1" ] then file=$1 extension=".rpm" file=${file/.rpm/} #getting the package's name without ending '.rpm' if [[ $1 = $file ]] then echo "The usage is:" echo echo "fglrx_installer " echo "fglrx_installer fglrx_6_8_0-8.16.20-1.i386.rpm , for instance" echo echo "Just give us a package, and we will do all the rest" exit 1 else echo echo "Well, we can start installing.." echo echo "First of all we are going to convert .rpm to a native Slackware type, .tgz" echo "Due to the big size of the package, convertation may last long." rpm2tgz $file.rpm echo "Here it is: $file.tgz" echo echo "Now we are installing it with usual installpkg." installpkg $file.tgz > /dev/null echo echo "The convertation is not lossless. The installer scripts and permissions are lost in it." echo "It is an obvious thing, no need to panic. We will bring everything back to normal." cd /lib/modules/fglrx echo echo "We are now in $PWD. That is where drivers files are installed." echo "The permissions are need to be set.." echo echo "chmod 700 make_install.sh" chmod 700 make_install.sh echo "chmod 700 ./build_mod/make.sh" chmod 700 ./build_mod/make.sh cd ./build_mod echo echo "********************************************************************" echo echo "Now the most important part - we are making the module." echo "Everything is going to be fine, if you use a standard VL kernel." echo "If not - well, if compile fails, we'll tell you, what can cause it. " echo echo "Good luck and here we go!" echo sleep 3 echo "exit 0" >> make.sh # All the exits in this script have 1 value and are errors sh make.sh if [[ $? = "0" ]] then echo echo "********************************************************************" echo echo "We've made it!!!" echo echo "Now the last part - installing it." echo echo "Trying to unload all drivers, that can interfere." echo echo "modprobe -r fglrx" modprobe -r fglrx > /dev/null echo "modprobe -r radeon" modprobe -r radeon > /dev/null echo "modprobe -r agpgart" modprobe -r agpgart > /dev/null echo if [[ `lsmod | grep agpgart` || `lsmod | grep radeon` || `lsmod | grep fglrx` ]] then echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo echo "Failed to remove modules!" echo "We will try to install, though, but.." echo else echo "Good, we've unloaded them all" echo fi sleep 3 cd .. sh make_install.sh if [[ $? = "0" ]] then echo echo "********************************************************************" echo echo "That went fine!" echo echo "Now we are adding a special /dev/shm in your fstab to make your 3D work" echo echo "tmpfs /dev/shm tmpfs defaults 0 0" >> /etc/fstab mount /dev/shm mount | grep "shm" echo echo "We are almost there!" echo "And the last part - configuring X.org" echo echo "We are running fglrxconfig now, please, answer all questions." echo "And, of course, answer 'yes' to the question, if to write a new xorg.conf file." echo echo "Your old config is being backupped to xorg.conf.prefglrx" echo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.prefglrx echo sleep 3 echo "tmpfs /dev/shm tmpfs defaults 0 0" >> /etc/fstab mount /dev/shm fglrxconfig echo echo "********************************************************************" echo echo "The kmown issue of fglrxconfig is that it does not set the xkb settings right," echo "so you have to alter xkb section manually. For example, if you want Russian, add: " echo echo "Option \"XkbLayout\"\"us,ru(winkeys)\"" echo "Option \"XkbOptions\"\"grp:alt_shift_toggle,grp_led:scroll\"" echo echo "If you don't want nothing, just exit the editor." sleep 7 mcedit /etc/X11/xorg.conf echo echo "********************************************************************" echo echo "Now you are ready to try the new configuration. For it, you have to reload X-server." echo echo "If you are in graphical mode, press Ctrl+Alt+Backspace to reload the server" echo "Note, it will close all programs, running in X-mode!" echo echo "If you are in text mode, you can start graphical mode by changing runlevel to graphical." echo "init 4 , and you will have those flying penguins. Or you can just startx to run the" echo "that is written in your .xinitrc" echo echo "There is a possibility, that even now X-server would not run." echo "Then you will have to edit xorg.conf once again and change BusID from 1:0:1 to 1:0:0" echo "Or vice-versa ;) . and try again." echo echo "If nothing happens - feel free to write the author at faijeyagmail.com" echo "Or ask for advice in the VectorLinux forum (http://vectorlinux.com/forum/)" echo echo echo "Don't forget to launch glxinfo | grep render, fglrxinfo and fgl_glxgears or some UT2004))" echo echo echo "Good luck!" exit 0 else # Failed to install module echo echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo echo "Looks like we have not managed to install module." echo "Boot in text mode (init 2) and run the script again, that can help." echo "If nothing happens - please, report the author at faijeyagmail.com," echo "or in the VectorLinux forum (http://vectorlinux.com/forum/)" echo echo "By the way, make sure you have ATi card ;-)" exit 3 fi else # Failed to build module echo echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo echo "Something went wrong. Remember, you always have the standard kernel" echo echo "Make sure, that you have: " echo " - /dev/agpgart" echo " - your chipset's agpgart driver" echo " - direct rendering manager" echo " - radeon's drm driver" echo "compuled as modules, not into the kernel!" echo echo "Also, driver won't compile, if you are using too new kernel." echo "It affects nVidia proprietary too. Usually you need to run a kernel, " echo "that numbers is less than the brand new one by one or two." echo echo "Solve this problem and return back." echo echo "Luck to you!" exit 2 fi fi else echo "The usage is:" echo echo "fglrx_installer " echo "fglrx_installer fglrx_6_8_0-8.16.20-1.i386.rpm , for instance" echo echo "Just give us a package, and we will do all the rest" exit 1 fi