Why atiupgrade?
I started atiupgrade a while ago to apply a patch to the kernel source (that was bad), then to the driver source (that was better), since the fglrx module didn't compile after a kernel update. That only lasted a short time.
Later I started developing a script to automate the driver installation following the method commonly known as "the hard way". There wasn't an unofficial repo with the latest driver at that time. If there had been, I wouldn't have spent time writing a script and would just have used that repo. The reason why I didn't use the "official" ATI repo is that the drivers in this repo were not up to date and - although they mostly worked - often printed an awkward watermark entitled " AMD - UNSUPPORTED HARDWARE " on the desktop. We later found how to remove this watermark and put it in a short script. (ATI RadeonHD 6310M - OpenSuse 11.4 ( Asus K43U Seris Laptop )) Today the ATI official repo is not used anymore. AFAIK there isn't any for 12.1.
I was asked why I would keep maintaining atiupgrade since a repo providing the latest drivers had been created. Well ... the answer is that atiupgrade is easier, faster, performs some additionnal checks before, can fix installation bugs afterwards, provides more features (can be used to upgrade as well as downgrade the driver), is not bound to a specific release of openSUSE, and is able to package the driver on tumbleweed or beta versions*, and before a package will be available in any repo.
* Notice that it doesn't work on openSUSE 12.2 Milestone 3 yet. But it is not because of atiupgrade. The script would work, but the ATI installer fails to build the package. Do not try to install the ATI proprietary driver on openSUSE 12.2 M3 today (April 2012) , using atiupgrade or another method.
Installation.
atiupgrade is available as a rpm package in my repo for openSUSE 11.4 and 12.1. It will be available for future releases as well. Tumbleweed users may install it from any repo. The package has no dependencies and contains only a single script, which is identical for all versions.
To install atiupgrade from repo, open a terminal and type the following commands:
Code:
su -l zypper ar http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_12.2/ PTA zypper --gpg-auto-import-keys refresh -r PTA zypper -n in atiupgrade
Installing from repo is convenient because it ensures that you get the latest version and receive further updates. But you can also download the scipt from this page - or copy/paste the code from this article -, save it in /usr/bin or /usr/local/bin as the file "atiupgrade" and make it executable:
Code:
su -l cd /usr/bin wget http://www.unixversal.com/linux/openSUSE/atiupgrade chmod 755 atiupgrade
If you don't know which method is better, install from repo.
code
Here's version 5.3 (from November 6 2012):
Code:
#! /bin/bash #: Title : atiupgrade #: Date Created: Fri Oct 29 20:02:40 PST 2010 #: Last Edit : Tue Nov 6 14:11:45 PST 2012 #: Author : Agnelo de la Crotche (please_try_again) #: Version : 5.3 #: Description : install or upgrade the latest ATI proprietary driver # # -------------------------------------------------------------- # What This script does the following : # (1) checks the model of your ATI card # (2) gets latest Catalyst version number # (3) installs required packages # (4) creates /usr/share/atiupgrade # (5) downloads latest ATI Catalyst installer # (6) looks for existing fglrx package # (7) builds rpm # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # (!) exit if X is fglrx is running in case we need to uninstall (not update) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # (8) unloads fglrx module if needed # (9) uninstalls any previously installed fglrx driver: # . from earlier rpm package ( fglrx-xxxx.rpm) # . from repo (x11-video-fglrxG02 ) # . from the ATI run file (with /usr/share/ati/fglrx-unistall.sh) # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # (10) installs the fglrx package (compiling the kernel module) # (11) runs aticonfig --initial if needed # # -------------------------------------------------------------- # as always ... you're using it at your own risk. # ChangeLog # * Tue Nov 6 14:11:45 PST 2012 # - fixed ati installer name for Catalyst 12.10 # * Wed Sep 19 15:41:17 PDT 2012 # - fixed rpm build under 12.2 # * Mon Sep 10 13:11:55 PDT 2012 # - fixed legaycy driver download url # * Sat Sep 8 12:00:34 PDT 2012 # - install driver directly under 12.2 (workaround) # * Sun Jul 22 14:55:18 PDT 2012 # - print currently installed Catalyst version # * Fri Jul 6 21:08:37 PDT 2012 # - added support for new Radeon HD 2000/3000/4000 legacy driver # * Thu Apr 26 21:19:25 PDT 2012 # - set defaut to Catalyst 12.4 # * Sun Apr 22 17:30:02 PDT 2012 # - version 4.1 - added option -d to install the driver # * Thu Apr 12 08:59:11 PDT 2012 # - version 4.0 - first build # -------------------------------------------------------------- # check if we are root [ $UID -eq 0 ] || exec echo "You have to run this script as root" catalystDef="12-10" catalystLegacyDef="12-6" catalystLegacy="9-3" ext='run' LastSupportedSUSE=122 LegacyRadeonLastSupportedSUSE=121 LegacyLastSupportedSUSE=111 #atiBaseUrl="https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux" atiBaseUrl="http://www2.ati.com/drivers/linux" atiLegacyBaseUrl="http://www2.ati.com/drivers/legacy" atiDownloadUrl="http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx?type" atiLegacyDownloadUrl="http://support.amd.com/us/gpudownload/linux/legacy/Pages/legacy-radeon_linux.aspx?type" #atiLegacyDownloadUrl="http://support.amd.com/us/kbarticles/Pages/catalyst${catalystLegacyDef/-/}legacyproducts.aspx?type" atiUninstall=/usr/share/ati/fglrx-uninstall.sh atiupgradeDir=/usr/share/atiupgrade FGLRX=$atiupgradeDir/FGLRXRPM mach=`uname -m` arch=${mach/i[34567]86/i586} kernel=`uname -r` rel=${kernel%-*} krn=${kernel##*-} i686=IA32 x86_64=AMD64 BUILDPKG=yes UPDATE=yes RPMBUILD_PKG="rpm-build" FORCE="" RED=$(tput bold)$(tput setaf 1) BLD=$(tput bold)$(tput setaf 2) BLU=$(tput bold)$(tput setaf 4) SGR=$(tput sgr0) PRG=$(basename $0) declare -l yesno # use lsb_release to get openSUSE version which lsb_release >/dev/null 2>&1 || zypper -n in lsb-release function msgExit { if [ -f "$fglrxrpm" ] ; then cat << EOF_SUCCESS_MSG _____________________________________________________________ | The driver has be successfully compiled and the package | | $(tput bold)$(basename $fglrxrpm)$(tput sgr0) has been created | | in the directory $atiupgradeDir. | | | | Please exit X or reboot in runlevel 3 and run atiupgrade | | again. | _____________________________________________________________ EOF_SUCCESS_MSG else cat << EOF_FAIL_MSG $BLD$(tput setaf 1)The fglrx package failed to build.$SGR :-( EOF_FAIL_MSG fi exit } function matchkernel { linux="linux-$rel" Kernel="kernel-$krn" ksrc=$(rpm -qa kernel-source) srel=${ksrc#kernel-source-*} ; srel=${srel%*.noarch} if [ "$ksrc" ] ; then # kernel-source is installed and ... slinux=$(readlink /usr/src/linux) if [ "$slinux" == "$linux" ] ; then # kernel-source matches kernel (nothing to do) printf " * Kernel source matches installed kernel (%s%s%s)\n" $BLU "$rel" $SGR else # kernel-source doesn't matche kernel and ... printf " * %sKernel source (%s%s%s) doesn't match installed kernel(%s%s%s)%s\n" $RED $BLU "${slinux##linux-}" $RED $BLU "$rel" $RED $SGR eval $(zypper lu | awk -F "|" '/'$Kernel'/ { gsub(/ /,"", $4) ; gsub(/ /, "", $5) ; printf "crel=%s ; urel=%s ;", $4, $5 }') if [ "$urel" ] ; then # a kernel update is available or printf " * %sand a new kernel (%s%s%s) is available.%s\n" $RED $BLU "$urel" $RED $SGR UPDKERNEL=yes elif ( zypper lu | grep -q 'kernel-source'); then # a kernel source update is available or printf " * %sand a kernel source update is available.%s\n" $RED $SGR else # no update is available but /usr/src/linux doesn't point to the source of the installed kernel (re-symlinking) for slinux in $(find /usr/src . -maxdepth 1 -type d ! -type l -name "linux*" ! -name "*-obj" -exec basename "{}" ";") ; do if [ "$slinux" == "$linux" ] ; then printf " * symlinking /usr/src/linux to %s%s%s\n" $BLU $slinux $SGR ln -sfn $slinux /usr/src/linux break fi done fi fi else # kernel-source is not installed and ... eval $(zypper lu | awk -F "|" '/'$Kernel'/ { gsub(/ /,"", $4) ; gsub(/ /, "", $5) ; printf "crel=%s ; urel=%s ;", $4, $5 }') # a kernel update is available if [ "$urel" ] ; then printf " * %sKernel source is not installed and a new kernel (%s%s%s) is available.%s\n" $RED $BLU "$urel" $RED $SGR UPDKERNEL=yes # no kernel update is available (nothing to do. We can install the kernel-source later in the script.) else printf " * Kernel source will be installed...\n" fi fi if [ "$UPDKERNEL" ] ; then printf " * %sYou should update the kernel an reboot, then run %s again.%s\n" $RED $PRG $SGR yesno="" while [ "true" ] ; do printf " Do you want to update the kernel now? [yn] " read -n1 yesno printf "\n" [ "$yesno" == "y" -o "$yesno" == "n" ] && break done if [ "$yesno" == "y" ] ; then zypper refresh zypper -n update $Kernel && exec printf " * %sThe kernel has been updated. Please reboot now and run %s again.%s\n" $RED $PRG $SGR fi fi } function enableKMS { grep -q '^NO_KMS_IN_INITRD=\"yes\"' /etc/sysconfig/kernel && SETKMS=yes grep -q '^KMS_IN_INITRD=\"no\"' /etc/sysconfig/kernel && SETKMS=yes [ "x$SETKMS" == "xyes" ] || return printf " * Enabling KMS in /etc/sysconfig/kernel...\n" sed -i 's/^NO_KMS_IN_INITRD.*/NO_KMS_IN_INITRD="no"/g;s/^KMS_IN_INITRD.*/KMS_IN_INITRD="no"/g' /etc/sysconfig/kernel printf " * Rebuilding initrd...\n" mkinitrd } if [ "$1" == "-d" -o "$1" == "--deinstall" ] ; then # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Deinstalling fglrx # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 1) Deinstalling fglrx package # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (1) - Deinstalling fglrx package ...%s\n" $BLD $SGR printf " * Querying rpm database... Please wait...\n" fglrxrpm=$(rpm -qa | grep "fglrx.*SUSE") if [ "$fglrxrpm" ] ; then fglrx=${fglrxrpm%%-*} zypper rm $fglrx rpm -qa | grep -q "$fglrx" && exit # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 2) Re-enabling Kernel Mode Setting # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (2) - Re-enabling Kernel Mode Setting ...%s\n" $BLD $SGR yesno="" while [ "true" ] ; do printf " Do you want to enable KMS in initrd? [yn] " read -n1 yesno printf "\n" [ "$yesno" == "y" -o "$yesno" == "n" ] && break done [ "$yesno" == "y" ] && enableKMS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 3) Restoring original Xorg configuration # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (3) - Restoring original Xorg configuration ...%s\n" $BLD $SGR if [ -f /etc/X11/xorg.conf ] ; then grep -q fglrx /etc/X11/xorg.conf && mv /etc/X11/xorg.conf{,.fglrx} fi echo $RED ; zypper ps ; echo $SGR else exec printf "%s No fglrx package installed.%s\n" $RED $SGR fi # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 1) get OS release and ATI model # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (1) - Analyzing system...%s\n" $BLD $SGR Ver=$(lsb_release -s -r | tr -d ".") [ $Ver -le 121 ] && RPMBUILD_PKG=rpm # ~~~~ 12.2 workaround - BEGIN ~ hope we can't remove that soo ~~~~~~~~~~ # ! packaging the driver doesn't work under 12.2. SO we won't do it # !! fixed after installing rpmbuild - which wasn't installed under 12.2 !! # [ $Ver -ge 122 ] && BUILDPKG=no # ~~~~ 12.2 workaround - END ~ hope we can't remove that soo ~~~~~~~~~~~~ [ $Ver -gt $LastSupportedSUSE ] && UPDATE=no rpm -qa | grep -q x11-video-fglrxG02 && UPDATE=no [ -x "$atiUninstall" ] && UPDATE=no catalystInstalledVer=0 if [ -f "/etc/ati/amdpcsdb.default" ] ; then catalystInstalledVer=$(sed -n 's/Catalyst_Version=[^0-9]*//p' /etc/ati/amdpcsdb.default) [ "$catalystInstalledVer" ] || ReleaseVersion=$(sed -n 's/ReleaseVersion=[^0-9]*//p' /etc/ati/amdpcsdb.default) isATI=yes fi rpm -qa | grep -q fglrx && isATI=yes lsmod | grep -q fglrx && isATI=yes [ "x$NOSYSCHECK" == "xyes" ] && isATI=yes ati_legacy="9500 9550 9600 9700 9800 X300 X550 X600 X700 X800 X850 X1050 X1300 X1550 X1600 X1650 X1800 X1900 Xpress X1200 X1250 X2100" ati_model="$(lspci | sed -n '/VGA/s/.*Radeon *//ip' | sed 's/Mobility *//i;s/ *Series//i;s/]//g' )" which aticonfig &>/dev/null && ati_radeon=$(aticonfig --query-monitor | sed -n 's/Default Adapter - *//p') ati_model=${ati_model:-$ati_radeon} which fglrxinfo &>/dev/null && ati_radeon=$(fglrxinfo 2>/dev/null | awk -F ":" '/renderer string/ { sub(/^ /,"", $2) ; print $2 }') ati_model=${ati_model:-$ati_radeon} if [ "x$isATI" == "xyes" ] ; then [ $Ver -gt $LastSupportedSUSE ] && Ver=$LastSupportedSUSE printf " * Found ATI graphics card: %s%s%s\n" $BLU "$ati_model" $SGR else if [ "x$ati_model" == "x" ] ; then yesno="" while [ "true" ] ; do printf " ATI graphic card detection failed. Is your ATI card a HD Radeon >= 5000 [yn] " read -n1 yesno printf "\n" [ "$yesno" == "y" -o "$yesno" == "n" ] && break done if [ "$yesno" == "y" ] ; then ati_oldradeon="no" ati_model="HD > 5000x" else yesno="" while [ "true" ] ; do printf " Is your ATI card a HD Radeon 2000x, 3000x or 4000x? [yn] " read -n1 yesno printf "\n" [ "$yesno" == "y" -o "$yesno" == "n" ] && break done if [ "$yesno" == "y" ] ; then ati_oldradeon="yes" ati_model="HD > 2000x" else while [ "true" ] ; do printf " No ATI graphic card detected. Do you want to continue? [yn] " read -n1 yesno printf "\n" [ "$yesno" == "y" -o "$yesno" == "n" ] && break done [ "$yesno" == "n" ] && exit NOATI="yes" while [ "true" ] ; do printf " Which ATI driver do you wamt to build? Legacy (1) or current (2) ? [12] " read -n1 yesno printf "\n" [ "$yesno" == "1" -o "$yesno" == "2" ] && break printf " Please type %s1%s for legacy or %s2%s for current.%s\n" $(tput bold) $SGR $(tput bold) $SGR done case $yesno in 1) ati_model="HD > 2000x" ;; 2) ati_model="HD > 5000x" ;; esac fi fi fi ati_model=${ati_model#Radeon *} model=${ati_model%% *} if [ "${ati_legacy#*$model}" == "${ati_legacy}" ] ; then [ $Ver -gt $LastSupportedSUSE ] && Ver=$LastSupportedSUSE [ "$NOATI" ] || printf " * Found ATI graphics card: %s%s%s\n" $BLU "$ati_model" $SGR else catalystDef="$catalystLegacy" [ $Ver -gt $LegacyLastSupportedSUSE ] && exec printf "\nATI Legacy card (%s) detected.\nThes legacy fglrx driver (%s) is incompatible with this openSUSE version. Script aborted.\n" "$ati_model" $catalystLegacy Ver=$LegacyLastSupportedSUSE fi fi ati_serie=$(( $(echo $ati_model | sed 's|HD[ >]*\([1-9]\).*|\1|') * 1)) [ $ati_serie -lt 5 ] && ati_oldradeon="yes" || ati_oldradeon="no" cver="${1:-$catalystDef}" ; cver=${cver/.} ; cver=${cver/-} ; cver=$(($cver * 1)) [ $cver -le 124 ] && ati_oldradeon="no" if [ "x$ati_oldradeon" == "xyes" ]; then catalystDef="$catalystLegacyDef" Ver=$LegacyRadeonLastSupportedSUSE fi catalystVer="${1:-$catalystDef}" catalystVer=${catalystVer/./-} if [ "x$ati_oldradeon" == "xyes" ] ; then atiDownloadUrl="$atiLegacyDownloadUrl" atiBaseUrl="$atiLegacyBaseUrl/${catalystVer/./-}" fi SUSEVer=SUSE$Ver buildOption="SuSE/$SUSEVer-${!mach}" # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 2) getting latest Catalyst version number # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # find out latest Catalyst version which curl &>/dev/null && catalystLast=$(curl -s $atiDownloadUrl | sed -n 's/^.*\(a[tm][id]-*driver-installer[^"]*\)">.*/\1/p' | grep -v beta) [ "$catalystLast" ] && catalystLastVer=$(echo $catalystLast | sed 's/a[tm][id]-*driver-installer-[a-z-]*\([0-9]*\)[\.-]\([0-9]*\)-.*/\1-\2/') || catalystLastVer=$catalystDef # take version given as argument if [ "$1" ]; then catalystLastVer=${catalystVer} latest="This" else latest=" Latest " atiDownloadFile=$catalystLast fi Cdef=${catalystDef/-/} ; [ ${#Cdef} -eq 3 ] && Cdef=${Cdef:0:2}0${Cdef:2} Clst=${catalystLastVer/-/} ; [ ${#Clst} -eq 3 ] && Clst=${Clst:0:2}0${Clst:2} Clst=$(($Clst * 1)) [ $Clst -eq 0 ] && exec printf "\033[31;1m ! Catalyst version nummer is zero. Most likely the installer has changed name again :-(%s\n" $SGR [ "$latest" == " Latest" ] && [ $Cdef -gt $Clst ] && catalystLastVer=$catalystDef if [ "x$ati_oldradeon" == "xyes" ] ; then ext='zip' catalystLastVer=${catalystLastVer/-/.} atiBaseFile=amd-driver-installer-$catalystLastVer-legacy-x86.x86_64.run FORCE="--force" else if [ "$latest" == "This" ]; then atiDownloadFile=ati-driver-installer-$catalystLastVer-x86.x86_64.run [ $Clst -ge 1208 ] && atiDownloadFile="amd-driver-installer-$catalystLastVer-x86.x86_64.zip" [ $Clst -ge 1210 ] && atiDownloadFile="amd-driver-installer-catalyst-${catalystLastVer/-/.}-x86.x86_64.zip" fi fi atiBaseFile=${atiDownloadFile/.zip/.run} catalystInstalledVer=${catalystInstalledVer:-0} catalystLastVer=${catalystLastVer/-/.} if [ "$catalystInstalledVer" ] ; then if [ "$catalystInstalledVer" == "0" ] ; then [ "$ReleaseVersion" ] && printf " * Found fglrx: %s%s%s\n" $BLU "${ReleaseVersion%%-*}" $SGR else printf " * Found: Catalyst %s%s%s\n" $BLU "$catalystInstalledVer" $SGR fi fi printf "%s (2) - Getting latest (or specified) Catalyst version: " $BLD printf "%s%s%s" $BLU $catalystLastVer $SGR if [ "x$catalystLastVer" == "x$catalystInstalledVer" ] ; then yesno="" while [ "true" ] ; do printf "\n *%sCatalyst version (%s%s%s) already installed. Do you want to continue? [yn] " "$latest" $BLU $catalystInstalledVer $SGR read -n1 yesno printf "\n" [ "$yesno" == "y" -o "$yesno" == "n" ] && break done [ "$yesno" == "n" ] && echo && exit elif [ $((${catalystInstalledVer/./}*1)) -gt $((${catalystLastVer/./}*1)) ] ; then printf "\n" FORCE="--force" elif [ "$ReleaseVersion" ] ; then # had to do that in order to be able to downgrade. Could be more precise but ... printf "\n" FORCE="--force" else printf "\n" fi # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 3) installing required packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (3) - Installing required packages...%s\n" $BLD $SGR matchkernel # install kernel headers and sources if not present PKG2INSTALL="" for pkg in kernel-source kernel-$krn-devel kernel-syms gcc make ${RPMBUILD_PKG} ; do zypper se --match-exact -i $pkg | grep -q $pkg && echo " * $pkg is already installed" || PKG2INSTALL="$PKG2INSTALL $pkg" done [ "$PKG2INSTALL" ] && zypper -n in $PKG2INSTALL # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 4) creating /usr/share/atiupgrade # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if [ -d "$atiupgradeDir" ] ; then printf "%s (4) - %s directory exists...%s\n" $BLD $atiupgradeDir $SGR else printf "%s (4) - Creating %s directory...%s\n" $BLD $atiupgradeDir $SGR mkdir $atiupgradeDir fi cd $atiupgradeDir # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 5) getting the ATI installer # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # if installer found, skip downloading AtiInstall=$atiupgradeDir/$atiDownloadFile if [ -f $AtiInstall ] ; then printf "%s (5) - ATI installer %s%s%s found...%s\n" $BLD $BLU $atiDownloadFile $BLD $SGR else printf "%s (5) - Downloading the ATI installer %s%s%s ...%s\n" $BLD $BLU $atiDownloadFile $BLD $SGR # make sure wget is installed which wget > /dev/null 2>&1 || zypper in wget # get the ATI installer for your architecture (i686 or x86_64) printf " * Connecting... Please wait...\n" wget $atiBaseUrl/$atiDownloadFile if [ "x$ati_oldradeon" == "xyes" ] ; then # force installation for now because the package has lower version number than the one from previous Catalyst. FORCE="--force" fi fi if ( file $AtiInstall | grep -q Zip ) ; then which unzip > /dev/null 2>&1 || zypper in unzip AtiInstall=$atiupgradeDir/$(unzip -l $atiDownloadFile | awk '/.run/ { print $NF}') [ -f $AtiInstall ] || unzip $atiDownloadFile fi if [ -f "$AtiInstall" ] ; then fglrxver=$(strings $AtiInstall | sed -n 's|.*Driver-\([0-9.]*\)"|\1-1|p' | sed 's|\([0-9]\{1,\}\.[0-9]\{2\}\)-1$|\10-1|') else exec printf " %s* ATI installer %s%s%s not found. Script aborted.%s\n" $RED $BLU $atiBaseFile $RED $SGR fi # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 6) Looking for existing rpm package # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~ 12.2 workaround - BEGIN ~ hope we can't remove that soo ~~~~~~~~~~ if [ "$BUILDPKG" == "no" ] ; then if [ -f $AtiInstall ] ; then cat << EOFWA $RED !! The AMD installer was unable to create the fglrx package. This is not !! !! a bug in atiupgrade. However the AMD installer for your graphics card !! !! has been succesfully downloaded, and atiupgrade can run it if you wish !! !! to install Catalyst $BLU$catalystLastVer$RED. This will be the same procedure as running !! !! the installer manually ('the hard way'). This is not optimal, and this !! !! bug will also break other atiupgrade functionalities. But there is a !! !! good chance that the driver will work for you. Please select "Install !! !! Driver..." in AMD Catalyst(TM) setup and NOT "Generate Distribution !! !! Specific Driver Package". !!$SGR EOFWA declare -l yesno while [ "$yesno" != "y" -a "$yesno" != "n" ] ; do printf "\n Do you want to run %s%s? [y,n]%s " $BLU $(basename $AtiInstall) $SGR read -N 1 yesno [ "$yesno" == "n" ] && echo && exit [ "$yesno" == "y" ] && exec sh $AtiInstall printf "\n Please answer with n or y." done fi exit fi # ~~~~ 12.2 workaround - END ~ hope we can't remove that soo ~~~~~~~~~~~~ # if fglrx package found, skip bulding if [ -f "$FGLRX" ] ; then fglrxrpm=$(cat $FGLRX) elif [ "$fglrxver" ] ; then fglrxrpm=$(find $atiupgradeDir -type f -name "fglrx*rpm" | grep "$fglrxver") if [ "$fglrxrpm" == "${fglrxrpm%%$arch*}" ] ; then unset fglrxrpm else echo $fglrxrpm > $FGLRX fi fi printf "%s (6) - Looking for rpm package of fglrx %s%s%s...%s" $BLD $BLU "$fglrxver" $BLD $SGR if [ "$fglrxrpm" ] ; then if [ -f "$fglrxrpm" ] ; then FGLRXRPM=$(basename $fglrxrpm) BUILDPKG=no printf "\n * found %s%s%s\n" $BLU "$FGLRXRPM" $SGR else printf "\n" fi else printf "%s not found.%s\n" $BLD $SGR fi # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 7) Building rpm package # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if [ "$BUILDPKG" == "yes" ] ; then printf "%s (7) - creating fglrx rpm...%s\n" $BLD $SGR sh $AtiInstall --buildpkg $buildOption fglrxrpm=$(find $atiupgradeDir -type f -name "fglrx*rpm" | grep $fglrxver) [ -f "$fglrxrpm" ] && echo $fglrxrpm > $FGLRX || exec printf " %s* package %s%s%s not found. Script aborted.%s\n" $RED $BLUE $fglrxrpm $RED $SGR else printf "%s (7) - skipping package building...%s\n" $BLD $SGR fi NR=8 #************************************************************************** # deinstalling a previous #************************************************************************** if [ "$UPDATE" == "no" ] ; then # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Abort script here if run in X # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # don't run in X if fglrx is loaded (but run in SSH sessions) ps ax | grep -v grep | grep -q 'X ' && XRUN=1 ps ax | grep -v grep | grep -q -i 'xorg ' && XRUN=1 [ "$XRUN" ] && lsmod | grep -q fglrx && msgExit # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 8) Aborting script if the fglrx module cannot be unloaded # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (8) - unloading kernel module...%s\n" $BLD $SGR # unload fglrx lsmod | grep -q fglrx && modprobe -r fglrx # exit if fglrx is still loaded lsmod | grep -q fglrx && exec printf " %s* fglrx is still loaded.%s\n" $RED $SGR # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 9) Uninstalling previoulsy installed fglrx # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (9) - uninstalling previously installed fglrx...%s\n" $BLD $SGR # save /etc/X11/xorg.conf [ -f "/etc/X11/xorg.conf" ] && cp /etc/X11/xorg.conf{,.pta} # uninstall x11-video-fglrxG02 (installed from the ATI repo) rpm -qa | grep -q x11-video-fglrxG02 && { zypper rm x11-video-fglrxG02 sed -i 's/^DISPLAYMANAGER_XSERVER=.*/DISPLAYMANAGER_XSERVER="Xorg"/' /etc/sysconfig/displaymanager ln -snf /usr/bin/Xorg /var/lib/X11/X } # uninstall ATI driver directly installed from the ati .run file [ -x "$atiUninstall" ] && $atiUninstall # uninstall older fglrx packages atirpm=$(rpm -qa | grep -i -E '^fglrx.*suse') if [ "$atirpm" ] ; then zypper rm $atirpm # restore previously saved xorg.conf since we're updating and not deinstalling [ -f "/etc/X11/xorg.conf.pta" ] && cp /etc/X11/xorg.conf{.pta,} fi # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NR=10 fi #************************************************************************** # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 10) Installing fglrx # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (%s) - installing fglrx...%s\n" $BLD $NR $SGR [ -d /etc/ld.so.conf.d ] || mkdir /etc/ld.so.conf.d function ldconfpath { lib="lib$(uname -m | sed 's/.*86_*//')" grep -q -R "/usr/X11R6/$lib" /etc/ld.so.conf.d/* && return libpath="/usr/X11R6/lib" [ "$lib" == "lib64" ] && libpath="/usr/X11R6/lib64\n$libpath" printf "# created by atiupgrade - %s\n# Remove this file when it's not needed anymmore\n$libpath\n" "$(date)" > /etc/ld.so.conf.d/ati-fglrx.conf } function lnglx { lib="lib$(uname -m | sed 's/.*86_*//')" if [ ! -L "/usr/$lib/xorg/modules/updates/extensions/libglx.so" ]; then echo " * Create symlink to fglrx-libglx.so" /usr/$lib/fglrx/switchlibglx amd 2>/dev/null fi if [ ! -L "/usr/X11R6/$lib/libGL.so.1.2" ]; then echo " * Create symlink to fglrx-libGL.so.1.2" /usr/$lib/fglrx/switchlibGL amd 2>/dev/null fi } # install/update fglrx package if [ -f "$fglrxrpm" ]; then yesno="" while [ "true" ] ; do printf " Do you want to install %s now? [yn] " $(basename $fglrxrpm) read -n1 yesno printf "\n" [ "$yesno" == "y" -o "$yesno" == "n" ] && break done if [ "$yesno" == "y" ] ; then # ldconfpath zypper in $FORCE $fglrxrpm && rm -f $FGLRX && lnglx echo $RED zypper ps let NR++ else exit fi fi # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 11) Running aticonfig # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ printf "%s (%s) - Running aticonfig...%s\n" $BLD $NR $SGR # exit if aticonfig not found [ -x "/usr/bin/aticonfig" ] || exec echo "aticonfig not found. /etc/X11/xorg.conf not updated". # exit if fglrx sextion found in /etc/X11/xorg.conf /usr/bin/aticonfig --initial=check && exit # if /etc/X11/xorg.conf exists and doesn't contain a fglrx section, rewrite it with sed # (aticonfig changes too much thing, IMO) if [ -f "/etc/X11/xorg.conf" ] ; then cp /etc/X11/xorg.conf{,.radeon.pta} sed '/Driver/s/[Dd]river.*radeon.*/Driver "fglrx"/' /etc/X11/xorg.conf.radeon.pta > /etc/X11/xorg.conf grep -q fglrx /etc/X11/xorg.conf || /usr/bin/aticonfig --initial exec echo "/etc/X11/xorg.conf updated." fi # generate a basic dual head /etc/X11/xorg.conf if more than 1 monitor found HWINFO=`which hwinfo 2>/dev/null` [ "$HWINFO" ] && [ $($HWINFO --monitor | grep "Unique ID" | wc -l) -gt 1 ] && exec /usr/bin/aticonfig --initial=dual-head # otherwise generate a basic /etc/X11/xorg.conf /usr/bin/aticonfig --initial exit fi
Open a terminal and type:
Code:
su -l atiupgrade
- download anything
- install or uninstall anything
atiupgrade will download the driver installation script (AMD or ATI run file) from ATI's website and install all packages required to compile the kernel module, such as kernel source, make and gcc compiler.
kernel update
A common mistake while installing a package which needs to compile a kernel module is to install the kernel source without upgrading the kernel itself. VirtualBox users might have experienced this issue already. Since version 4.0, atiupgrade makes sure that kernel and kernel source are of the same version and also checks for available kernel and kernel source updates.
If the kernel source is not installed and a kernel update is available, atiupgrade will ask for your confirmation to update the kernel (see picture below). You should proceed and reboot once the new kernel has been installed, then run atiupgrade again. When kernel source is installed later in the script - together with other required packages - it will match the running kernel.
If the kernel source is already installed for your kernel version, it won't be upgraded, even if an update is availalble, because it is not necessary to compile the module, and it is not the job of atiupgrade to decide if you should upgrade the kernel or not. If you later update kernel and kernel source, the fglrx kernel module will be automatically recompiled at next boot - thanks to a sysinit service installed with the package (/etc/init.d/boot.fglrxrebuild). Thus it is NOT necessary to use modautocompile for this module any longer.
view screenshot
The different steps of installing or upgrading the driver
atiupgrade performs several tasks, before downloading the installer, building the package and after installing the driver, which can be divided into 9 steps - 11 if a previous version of the driver has to be uninstalled first. It prints the number of each step to standard output and a short description of the task. Thus, if it fails to complete the whole process, it will tell you at which step it hung and you may report the problem or look for solutions in the atiupgrade thread.
(1) - analysing system
atiupgrade tries to detects your graphics card. It can only obtain the information that the graphics card gives about itself. Thus it might fail in some cases. This system check can produce different results:
- Non-ATI graphic card detected.
In this case, the script will ask if you want to continue. You may proceed if you know that you have a supported ATI graphics card. You may also proceed if you don't have an ATI card but just want to build the fglrx package (for example to install it later on an ATI system). Otherwise or if you are unsure, say "no" to abort the script.
- ATI Legacy card detected.
Legacy cards are older models which are not supported by ATI any more. If you happen to have one of those, you should not try to install nor use the fglrx driver: it won't work. atiupgrade will abort if it detects a legacy card. Again the test is as reliable as the info given by the card. If you are sure that your graphics card is supported, you may skip the system check by running atiupgrade with this command:
Code:
env NOSYSCHECK=yes atiupgrade
If atiupgrade sees your graphics card as a legacy one when it is not, please post the output of this command in the atiupgrade thread, so that I can fix it or make a workaround:
Code:
lspci | grep -i vga
This is the expected result in the most common case. The script will print the model of the graphics card.
(2) - get latest (or specified) catalyst version:
atiupgrade queries the ATI website to find out the latest available Catalyst version. It it fails (for example if the website is offline or the script is unable to parse this information), it will default to the value defined in the script (in the variable catalysDef). This is the main reason why I update atiupgrade whenever a new Catalyst version is released, so that it will default to the latest version if it fails to read it from the website. You can also specify a version as argument if you know it is the latest one and the script didn't get it or if you want to downgrade the driver. As of the this writing, these two commands are equivalent and install Catalyst 12.3:
Code:
atiupgrade
Code:
atiupgrade 12-3
Code:
atiupgrade 12-2
atiupgrade installs everything it needs to build the kernel module. This include the packages kernel-source, kernel-devel, kernel-syms, gcc and make. Packages that are already installed will be skipped - meaning atiupgrade won't try to reinstall or update them.
At this point, if the kernel-source is not installed, before installing it, the script will offer to update the kernel if a newer version is available. Otherwise the version of the kernel-source will not match the version of the installed kernel. Upgrading to the latest kernel ensures that the kernel-source will have the correct version. After the kernel has been updated, you should reboot and run atiupgrade again to proceed.
(4) - creating /usr/share/atiupgrade directory.
atiupgrade creates the directory /usr/share/atiupgrade to store the ATI run file and fglrx package if this directory doesn't already exist.
(5) - Downloading the ATI installer.
atiupgrade downloads the ATI installer and saves it in the directory /usr/share/atiupgrade. If the installer is already there, it won't be downloaded again. If it fails to download the installer, the script will abort with an error message. It is advisable to keep older versions of the installer in /usr/share/atiupgrade in order to be able to rebuild an older package in case you need it. If you can't download the installer from ATI's site but get it from somewhere else, copy the file in /usr/share/atiupgrade and run atiupgrade again.
(6) - Looking for existing rpm package
atiupgrade checks whether a rpm package of the driver to be installed already exists in /usr/share/atiupgrade. If this package is found, it won't build it again.
(7) - creating fglrx rpm
atiupgrade executes the ati/amd installer, which builds the fglrx rpm package for the openSUSE version on which it is run or for the last supported openSUSE version (specified in the variable LastSupportedSUSE in the script). Both the installer (the ati/amd .run file) and the resulting package are stored in the directory /usr/share/atiupgrade. You may keep this package for further installing/reinstalling on the same or another ATI based machine (see next step).
(8) - installing fglrx.
atiupgrade asks if you want install the fglrx package. If you were just building the package but don't intend to install it on this system, you may say no here.
Notice that compiling the kernel module occures at installation time, not at package build time! Thus, if you want to install the fglrx package using zypper on another machine, you need to make sure that the required packages - kernel source and compiler - are installed.
(9) - running aticonfig
Athough It is not necessary to run aticonfig anymore - since the post-install script of the fglrx package takes care of that - it doesn't hurt to double check if a fglrx section is present in xorg.conf.
Deinstalling the driver
Since it is installed as a package, the fglrx driver can be removed like any other rpm with zypper remove. atiupgrade since version 4.1 provides an option to uninstall the driver. Notice that it can only deinstall fglrx if it was installed with atiupgrade or from a fglrx package created following the "hardway method" (provided you chose to build a rpm instead of installing directly) or downloaded from the ATI unofficial repo.
To deinstall fglrx and switch back to the open source driver, run atiupgrade with the option -d (or --deinstall)
Code:
atiupgrade -d
This option performs the following steps:
(1) - Deinstalling fglrx package
This is the package created by the ATI installer. You can find out its name and version by querying the rpm database:
Code:
$ rpm -qa | grep fglrx fglrx64_xpic_SUSE121-8.951-1.x86_64
atiupgrade asks if you want to re-enable KMS. If you had to start originally Linux with "nomodeset", you should answer no. Otherwise, say yes.
(3 )Restoring original Xorg configuration
The postuninstall scriptlet of the rpm package normally takes care of that. However if /etc/X11/xorg.conf still exists and contains the string "fglrx", it will be renamed to /etc/X11/xorg.conf.fglrx.
At next boot, X should use the open source driver.
screenshots
- Installing fglrx using atiupgrade on a fresh openSUSE 12.1 install
- upgrading fglrcx (12.2 -> 12.3)
- downgrading fglrx (12.3 -> 12.2)
- upgrading fglrx without building (previously built package found in /usr/share/atiupgrade)
- Installing Catalyst 12.10 on openSUSE 12.2 - fresh install
- Upgrading Catalyst (12.8 -> 12.10) on openSUSE 12.2
Message