Upgrading ATI driver with atiupgrade

Hi everyone,
Here’s the latest version of the atiupgrade script. It first installs kernel sources and compiler if they are missing, download the ati run script from ATI’s site, deinstalls fglrx, however it was previously installed: from repo, with ati .run (untested - highlighted in red in the code) or from rpm (generated by ati .run). It then creates a rpm and installs it. I hope it is enough documented and easy to read.

#! /bin/bash

# --------------------------------------------------------------
# What This script does the following :
# - install kernel sources and gcc if needed
# - unload fglrx if needed
# - make a copy of /etc/X11/xorg.conf (if any)
# - download ATI Catalyst 10.10 for your architecture if needed
# - deinstall the repo driver (x11-video-fglrxG02 ) if it was previously installed
# - deinstall the ATI driver previously installed from the ATI run file (with /usr/share/ati/fglrx-unistall.sh)
# - run the ATI installer to create a rpm  package  
# - deinstall any previously installed fglrx
# - install the fglrx package (and compile the kernel module)
#
# as always ... you're using it at your own risk.
# $ Agnelo de la Crotche (Please_try_again) - 26.10.2010
# --------------------------------------------------------------

catalystVer="10-10"
atiBaseUrl="https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux"
atiBaseFile=ati-driver-installer-$catalystVer-x86.x86_64.run
atiUninstall=/usr/share/ati/fglrx-uninstall.sh
mach=`uname -m`
kernel=`uname -r`
rel=${kernel%-*}
krn=${kernel##*-}
i686=IA32
x86_64=AMD64

# don't run in X
[ "$DISPLAY" ] && exec echo "this script cannot be run in X"

# use lsb_release to get openSUSE version
which lsb_release >/dev/null &>1 || zypper -n in lsb-release
SUSEVer=SUSE$(lsb_release -s -r | tr -d ".")
buildOption="SuSE/$SUSEVer-${!mach}"


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 1) Make sure kernel sources and compiler are installed
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# install kernel headers and sources if not present
for pkg in kernel-source kernel-$krn-devel kernel-syms ; do
	rpm -qa | grep -q  $pkg || zypper -n in $pkg
done

# install devel_basis (gcc) if not present
zypper search -t pattern -i | grep -q devel_basis || zypper -n in -t pattern devel_basis 

# exit in directory /usr/src/linux/$rel not present
[ -d /usr/src/linux-$rel ] || exec echo "directory /usr/src/linux-$rel not found. Make sure that kernel $rel sources are installed."
	
# make sure the /usr/src/linux -> /usr/src/linux/$rel (in case different kernel sources are installed)	
if [ "$(readlink /usr/src/linux)" != "linux-$rel" ] ; then 
	ln -sfn linux-$rel /usr/src/linux 
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 2) Cancel script if the fglrx module cannot be unloaded
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# unload fglrx 
lsmod | grep -q fglrx && modprobe -r fglrx

# exit if fglrx is still loaded 
lsmod | grep -q fglrx && exec echo "fglrx is still loaded"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 3) Get the ATI installer 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# if installer found in current directory, skip downloading
if [ ! -f ./$atiBaseFile ] ; then

	# 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)
	wget $atiBaseUrl/$atiBaseFile

fi

# look for the ATI installer in the current directory
ati_install=(`find . -name "ati-driver*$mach.run"`)

# cancel script if 0 or more than 1 installer found
if [ ${#ati_install[li]} -gt 1 ] ; then
[/li]	exec echo "several versions of the ATI installer found. Script aborted."
elif [ ${#ati_install[li]} -eq 0 ] ; then
[/li]	exec echo "no ATI installer found. Script aborted."
fi

# let's doublecheck ! :-)
AtiInstall=`basename ${ati_install[0]}`
[ -f ./$AtiInstall ] || exec echo "no ATI installer found. Script aborted."
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 4) Create rpm package 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

sh ./$AtiInstall --buildpkg $buildOption

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 5) Uninstall previoulsy installed fglrx 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# save /etc/X11/xorg.conf (just in case)
[ -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

# uninstall ATI driver directly installed from the ati .run file
[ -x $atiUninstall ] && $atiUninstall

# unistall ATI driver installed from package generated byt the ati .run file
atirpm=$(rpm -qa | grep '^fglrx' | grep $SUSEVer | grep $mach)
zypper rm $atirpm

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 6) install fglrx 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

# install/reinstall fglrx package 
find . -maxdepth 1 -name "fglrx*$mach.rpm" -exec  zypper in "{}" ";"

If you wonder how to use it:

[ul]
[li]open a texteditor (kwrite, gedit) and copy/paste the code above in the editor window
[/li][li]save the file as /home/you/bin/atiupgrade
[/li]* where ‘you’ is your login name
[li] copy the file in /usr/local/bin and make it owned by root.
[/li]

su -l
mkdir /usr/local/bin 2> /dev/null
cp /home/you/bin/atiupgrade /usr/local/bin
cd /usr/local/bin
chmod 744 atiupgrade
chown root:root atiupgrade

[li] exit X, login in console as root and run the script
[/li]

/usr/local/bin/atiupgrade

[li] you should be able to restart X with the new driver without rebooting (but it doesn’t hurt).
[/li][/ul]

please_try_again, I am so happy to see you helping out our many ATI users with your script. Since I don’t use ATI, I am always afraid of saying anything that was not tested by me. I know that this script will be beneficial for all of our many ATI users. Thanks so much for your effort with this subject.

Thank You,

Nice script! but you’re missing a code line to make the final installer executable?
'm a noob, so i am not sure…
But just before the ATI drivers where about to be installed the script aborted with the message “no ATI installer found. Script aborted.”
so i made the installer executable and then ran it myself.
but thanks for this script it helped me a lot…

it’s not needed since I call it with “sh” :

sh ./$AtiInstall --buildpkg $buildOption

It was looking for this in the current directory:

find . -name "ati-driver*$(uname -m).run"

and could not find any matching file for some reason (?)

yes thats what i expected when the script aborted, cause the installer was in the same directory.

Hmmm … I would like to fix the bug if there is one but I don’t see it.
If I copy the file ati-driver-installer-10-10-x86.x86_64.run in the current directory and execute this snip:

#!/bin/bash
mach=`uname -m`

# look for the ATI installer in the current directory
ati_install=(`find . -name "ati-driver*$mach.run"`)

# cancel script if 0 or more than 1 installer found
if [ ${#ati_install[li]} -gt 1 ] ; then
[/li]        exec echo "several versions of the ATI installer found. Script aborted."
elif [ ${#ati_install[li]} -eq 0 ] ; then
[/li]        exec echo "Fail1: no ATI installer found. Script aborted."
fi

# let's doublecheck ! :-)
AtiInstall=`basename ${ati_install[0]}`
[ -f ./$AtiInstall ] || exec echo "Fail2: no ATI installer found. Script aborted."

echo " **** Success ! ATI installer found : $AtiInstall *** "

I get the success message (green). At this point the script should have proceed with the next command, i.e run the installer. (it did it for me).

If I remove or rename ati-driver-installer-10-10-x86.x86_64.run, the script aborts as expected at Fail1 (red).

Well i don’t know either, i just ran your script until it aborted then manually ran the installer and it gave me the same result as intended…
so i don’t know where it went wrong, but point is that it worked and thats what counts…

I just update the script to the latest Catalyst version (10-11). That’s a minor change that you can do yourself by replacing the line
catalystVer=“10-10”
with
catalystVer=“10-11”
Here’s the updated version:

#! /bin/bash

# --------------------------------------------------------------
# What This script does the following :
# - install kernel sources and gcc if needed
# - unload fglrx if needed
# - make a copy of /etc/X11/xorg.conf (if any)
# - download ATI Catalyst 10.10 for your architecture if needed
# - deinstall the repo driver (x11-video-fglrxG02 ) if it was previously installed
# - deinstall the ATI driver previously installed from the ATI run file (with /usr/share/ati/fglrx-unistall.sh)
# - run the ATI installer to create a rpm  package  
# - deinstall any previously installed fglrx
# - install the fglrx package (and compile the kernel module)
#
# as always ... you're using it at your own risk.
# $ Agnelo de la Crotche (Please_try_again) - 20.11.2010
# --------------------------------------------------------------

catalystVer="10-11"
atiBaseUrl="https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux"
atiBaseFile=ati-driver-installer-$catalystVer-x86.x86_64.run
atiUninstall=/usr/share/ati/fglrx-uninstall.sh
mach=`uname -m`
kernel=`uname -r`
rel=${kernel%-*}
krn=${kernel##*-}
i686=IA32
x86_64=AMD64

# don't run in X
[ "$DISPLAY" ] && exec echo "this script cannot be run in X"

# use lsb_release to get openSUSE version
which lsb_release >/dev/null &>1 || zypper -n in lsb-release
SUSEVer=SUSE$(lsb_release -s -r | tr -d ".")
buildOption="SuSE/$SUSEVer-${!mach}"


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 1) Make sure kernel sources and compiler are installed
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# install kernel headers and sources if not present
for pkg in kernel-source kernel-$krn-devel kernel-syms ; do
	rpm -qa | grep -q  $pkg || zypper -n in $pkg
done

# install devel_basis (gcc) if not present
zypper search -t pattern -i | grep -q devel_basis || zypper -n in -t pattern devel_basis 

# exit in directory /usr/src/linux/$rel not present
[ -d /usr/src/linux-$rel ] || exec echo "directory /usr/src/linux-$rel not found. Make sure that kernel $rel sources are installed."
	
# make sure the /usr/src/linux -> /usr/src/linux/$rel (in case different kernel sources are installed)	
if [ "$(readlink /usr/src/linux)" != "linux-$rel" ] ; then 
	ln -sfn linux-$rel /usr/src/linux 
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 2) Cancel script if the fglrx module cannot be unloaded
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# unload fglrx 
lsmod | grep -q fglrx && modprobe -r fglrx

# exit if fglrx is still loaded 
lsmod | grep -q fglrx && exec echo "fglrx is still loaded"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 3) Get the ATI installer 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# if installer found in current directory, skip downloading
if [ ! -f ./$atiBaseFile ] ; then

	# 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)
	wget $atiBaseUrl/$atiBaseFile

fi

# look for the ATI installer in the current directory
ati_install=(`find . -name "ati-driver*$mach.run"`)

# cancel script if 0 or more than 1 installer found
if [ ${#ati_install[li]} -gt 1 ] ; then
[/li]	exec echo "several versions of the ATI installer found. Script aborted."
elif [ ${#ati_install[li]} -eq 0 ] ; then
[/li]	exec echo "no ATI installer found. Script aborted."
fi

# let's doublecheck ! :-)
AtiInstall=`basename ${ati_install[0]}`
[ -f ./$AtiInstall ] || exec echo "no ATI installer found. Script aborted."
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 4) Create rpm package 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

sh ./$AtiInstall --buildpkg $buildOption

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 5) Uninstall previoulsy installed fglrx 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# save /etc/X11/xorg.conf (just in case)
[ -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

# uninstall ATI driver directly installed from the ati .run file
[ -x $atiUninstall ] && $atiUninstall

# unistall ATI driver installed from package generated byt the ati .run file
atirpm=$(rpm -qa | grep '^fglrx' | grep $SUSEVer | grep $mach)
zypper rm $atirpm

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 6) install fglrx 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

# install/reinstall fglrx package 
find . -maxdepth 1 -name "fglrx*$mach.rpm" -exec  zypper in "{}" ";"

I just ran it and it seems to work (More to follow on the topic… )
To make it simple, boot in runlevel 3, log in as root and do:
cd /tmp
atiupgrade

provided the script atiupgrade is in your path and executable by root (something I cannot do for you).

Now, here’s what you should see on your screen - after a while - upon success - except for date, download speed (and tipos!). The part in green will appear only in case you’re doing an update (i.e another fglrx package is already installed). Of course you have to answer that question with y.

  • The script will also install kernel headers and some tools needed to compile the kernel module. So if those packages aren’t already installed on your system, you might see more output from zypper.
  • The rpm additional output (text in blue) is about kernel module compilation. This output is normal. The warnings are harmless. The advice at the end is irrelevant and obsolete.
--2010-11-20 15:49:36-- [noparse]https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/ati-driver-installer-10-11-x86.x86_64.run[/noparse]
Resolving a248.e.akamai.net... 206.108.207.169, 206.108.207.137
Connecting to a248.e.akamai.net|206.108.207.169|:443... connected.
HTTP request send, awaiting response... 200 OK
Length: 123939635 (118M) [application/octet-stream]
Saving to: `ati-driver-installer-10-11-x86.x86_64.run'
100%==========================================================] 123,939,635  885K/s  in 2m 5s
2010-11-20 15:51:41 (969 KB/s) - `ati-driver-installer-10-11-x86-x86_64.run' saved [123939635/123939635]

Created directory fglrx-install.B1jiQM
Verifying archive integrity... All good.
Uncompressing ATI Catalyst(TM) Proprietary Driver-8.791 ..........................................................
..................................................................................................................
..................................................................................................................
..................................................................................................................
..................................................................................................................
...........................................................................................................
=====================================================================
 ATI Technologies Catalyst(TM) Proprietary Driver Installer/Packager
=====================================================================
Generating package: SuSE/SUSE113-AMD64
/tmp/ati.Gm76c0
Package /tmp/fglrx64_7_5_0_SUSE113-8.791.x86_64.rpm has been successfully generated
Removing temporary directory: fglrx-install.B1jiQM
Loading repository data...
Reading installed packages...
Resolving packages dependencies...

The following package is going to be REMOVED:
  fglrx64_7_5_0_SUSE113

1 package to remove.
After the operation, 128.6 MiB will be freed.
Continue? [y/n?] (y):**y
Removing fglrx64_7_5_0_SUSE113-8.783-1 [done]**
Loading repository data...
Reading installed packages...
Resolving packages dependencies...

The following NEW package is going to be installed:
  fglrx64_7_5_0_SUSE113

1 new package to install.
Overall download size: 29.4 MiB. After the operation, additional 129.6 MiB will be used.
Continue? [y/n/?] (y): **y**
Retrieving package fglrx64_7_5_0_SUSE113-8.791-1.x86_64 (1/1), 29.4 MiB (129.6 MiB unpacked)
Installing: fglrx64_7_5_0_SUSE113-8.791-1 [done]
Additional rpm output:
file /lib/modules/2.6.34.7-0.5-desktop/source/include/../arch/x86/include/asm/compat.h says: COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
/usr/src/kernel-modules/fglrx /
make: Entering directory `/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/'
make -C ../../linux-2.6.34.7-0.5 0=/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/.
  LD      /usr/src/kernel-modules/fglrx/built-in.o
  CC [M]  /usr/src/kernel-modules/fglrx/firegl_public.o
/usr/src/kernel-modules/fglrx/firegl_public.c: In function ?KCL_GetInitKerPte?:
/usr/src/kernel-modules/fglrx/firegl_public.c:2378:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2379:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2380:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c: In function ?KCL_GetInitKerPte?:
/usr/src/kernel-modules/fglrx/firegl_public.c:2378:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2379:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2380:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c: In function ?KCL_GetPageTableByVirtAddr?:
/usr/src/kernel-modules/fglrx/firegl_public.c:2425:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2428:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2429:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c: In function ?KCL_TestAndClearPageDirtyFlag?:
/usr/src/kernel-modules/fglrx/firegl_public.c:2598:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c: In function ?KCL_GetDmaPhysAddr?:
/usr/src/kernel-modules/fglrx/firegl_public.c:2636:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2637:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2638:5: warning: return makes integer from pointer without a cast
/usr/src/kernel-modules/fglrx/firegl_public.c:2640:5: warning: return makes integer from pointer without a cast
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_acpi.o
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_agp.o
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_debug.o
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_ioctl.o
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_io.o
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_pci.o
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_str.o
  CC [M]  /usr/src/kernel-modules/fglrx/kcl_wait.o
  LD [M]  /usr/src/kernel-modules/fglrx/fglrx.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: could not find /usr/src/kernel-modules/fglrx/.libfglrx_ip.a.GCC4.cmd for /usr/src/kernel-modules/fglrx/libfglrx_ip.a.GCC4
  CC      /usr/src/kernel-modules/fglrx/fglrx.mod.o
  LD [M]  /usr/src/kernel-modules/fglrx/fglrx.ko
make: Leaving directory `/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/.
make: Entering directory `/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/'
make -C ../../linux-2.6.34.7-0.5 0=/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/. modules_install
  CC      /usr/src/kernel-modules/fglrx/fglrx.mod.o
  LD [M]  /usr/src/kernel-modules/fglrx/fglrx.ko
  INSTALL /usr/src/kernel-modules/fglrx/fglrx.mod.o
  DEPMOD  2.6.34.7-0.5-desktop
make: Leaving directory `/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/.
make: Entering directory `/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/'
make -C ../../linux-2.6.34.7-0.5 0=/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/. clean
  INSTALL /usr/src/kernel-modules/fglrx/fglrx.mod.o
  CLEAN   /usr/src/kernel-modules/fglrx/.tmp_versions
  CLEAN   /usr/src/kernel-modules/fglrx/Module.symvers /usr/src/kernel-modules/fglrx/modules.order
make: Leaving directory `/usr/src/linux-2.6.34.7.-0-5-obj/x86_64/desktop/.
/

*************************************************************
Please read "/usr/share/doc/packages/fglrx/README.SuSE" for
configuration details when using SaX2.
*************************************************************

So if that is what you see, everything worked.

  • you’ll find the rpm package fglrx64_7_5_0_SUSE113-8.791-1.x86_64.rpm
    in the current directory. As it is /tmp, it’s more likely going to be deleted. Copy that file somewhere else, so you will be able to reinstall the package if needed (or use it on another machine).
  • the flgrx module has been compiled and installed. This is the file /lib/modules/2.6.34.7-0.5-desktop/extra/fglrx.ko for that kernel. It has to be recompiled after each kernel update (!). If you want to avoid black screen trouble and have the module compiled automatically, you can use the modautocompile service automatically recompile kernel modules after kernel update (which btw can autorecompile any other module as well, like the VirtualBox kernel module for example).
  • You can start X directly with startx
    , kdm, etc or by entering runlevel 5 with init 5. No need to reboot… But wait ! (see my next post!)
  • In some cases - precisely if this is the first install of the ATI driver - you might have to run aticonfig --initial
    to generate a ATI device section in /etc/X11/xorg.conf. I know very little about that command, as I write this file myself.

So what happended after running atiupgrade?
[ul]
[li]While deinstalling the older fglrx package with zypper, someone (I bet zypper) modified /etc/X11/xorg.conf and replaced
[/li]Driver “fglrx”
with
Driver “radeonhd”
[li]While installing the new fglrx package, noone changed that back.
[/li][li]So before starting X, you have to edit /etc/X11/xorg.conf and make sure that you have the line
[/li]Driver “fglrx”
in the device section of your graphic card.
[/ul]

Unfortunately you’ll have to use a console text editor. I’m afraid “vi” is not going to help many people. Maybe you can use nano (?).
hmm … or you can use that :

cp /etc/X11/xorg.conf{,.radeonhd}
sed '/Driver/s/radeonhd/fglrx/' /etc/X11/xorg.conf.radeonhd > /etc/X11/xorg.conf

I might have to consider adding that command to the script or updating fglrx rather than deinstalling/installing. The problem is that atiupgrade has to take care of different ways people might have installed the ATI driver before, as installing from generated rpm package is not the only method (even if it is the best one).

Hey please_try_again, got the script to run and everything was good until the script downloaded the CCC installer package. It downloaded ati-driver-installer-10-11-x86.x86_64.run but then said something about there being multiple installers and aborted the script. Not sure if there’s somewhere I can grab a log for you or not.

That’s not a bug. That’s a feature. :slight_smile:
The script aborts if it finds more than one installer in the current directory.

# cancel script if 0 or more than 1 installer found
if [ ${#ati_install[li]} -gt 1 ] ; then[/li]	exec echo "several versions of the ATI installer found. Script aborted."
elif [ ${#ati_install[li]} -eq 0 ] ; then[/li]	exec echo "no ATI installer found. Script aborted."
fi

Move/remove the older ATI installer first and run the script again (it won’t download the installer twice).

Alright, so I got the script to run properly (it seems) but now my display is all hosed up. I was going to post a screenshot, but it shows up fine in the screenshot. Basically it looks like every other line in the display is missing and all the fonts are jacked up. When I opened XTerm, I couldn’t even read what I was typing in.

Are sure that you are using the fglrx driver and not radeon or radeonhd, as described in post #10 of that thread?
Please, have a look in your /etc/X11/xorg.conf. Make sure you have this line:
Driver "fglrx"
and not “radeon” or “radeonhd” … or even something else.

Got Driver “fglrx”. Odd thing is I dropped my resolution from 1920x1080 to 1280x1024 and the screen cleared up. When I switch back to 1920x1080 it stayed clear. Not sure what that’s all about.

I get this error. /usr/src/linux-2.6.34-12 not found. Make sure that kernel 2.6.34-12 sources are installed.

Did you install kernel-source of the same version as your kernel ? If you don’t understand the question, please advise.

The script was supposed to install the kernel sources for you. Could you please run this test:

#! /bin/bash
kernel=`uname -r`
rel=${kernel%-*}
krn=${kernel##*-}
for pkg in kernel-source kernel-$krn-devel kernel-syms ; do
	echo -n "checking $pkg : "
	rpm -qa | grep -q  $pkg && echo "$pkg installed"
	rpm -qa | grep -q  $pkg || echo "$pkg not installed"
	rpm -qa | grep -q  $pkg || echo "todo: zypper -n in $pkg "
done

If present, the lines introduced by todo show what the script would have done at this point.

If the kernel sources are installed, the directory /usr/src/linux-2.6.34-12 should exist and you shouldn’t get this error message.

But IMO you should update the kernel to 2.6.34.7-0.5 before installing the ATI driver.

Hi,

This is what I got when I ran what you requested thank you.

checking kernel-source : kernel-source installed
checking kernel-desktop-devel : kernel-desktop-devel installed
checking kernel-syms : kernel-syms installed

Did you install kernel-source of the same version as your kernel ? If you don’t understand the question, please advise.

I ran atiupgrade after all my updates on a fresh install. I did not check any kernel source or kernel version. Please excuse me here because I am on a learning curve on openSUSE compared to working with Ubuntu the last few years.

I do have the ati drivers installed now and desktop is working fine however my terminal like init 3 is color garbled. LoL this is a labor in progress I guess.

Thank you.

I had to update an ATI system. So I updated the script.
Changes (blue=added ; red=removed/commented out) :
[ul]
[li]Do not deinstall a previously installed fglrx.rpm package (partially fixes the problem described at post #10 )
[/li][li]run aticonfig --initial to generate a basic single/dual-head xorg.conf (if needed)
[/li][/ul]

#! /bin/bash

# --------------------------------------------------------------
# What This script does the following :
# - install kernel sources and gcc if needed
# - unload fglrx if needed
# - make a copy of /etc/X11/xorg.conf (if any)
# - download ATI Catalyst 10.11 for your architecture if needed
# - deinstall the repo driver (x11-video-fglrxG02 ) if it was previously installed
# - deinstall the ATI driver previously installed from the ATI run file (with /usr/share/ati/fglrx-unistall.sh)
# - run the ATI installer to create a rpm  package  
# - deinstall any previously installed fglrx
# - install the fglrx package (and compile the kernel module)
# - run aticonfig --initial (only if /etc/X11/xorg.conf doesn't exist. see section #7)
#
# as always ... you're using it at your own risk.
# $ Agnelo de la Crotche (Please_try_again) - Mon Dec  6 08:37:05 PST 2010
# --------------------------------------------------------------

catalystVer="10-11"
atiBaseUrl="https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux"
atiBaseFile=ati-driver-installer-$catalystVer-x86.x86_64.run
atiUninstall=/usr/share/ati/fglrx-uninstall.sh
mach=`uname -m`
kernel=`uname -r`
rel=${kernel%-*}
krn=${kernel##*-}
i686=IA32
x86_64=AMD64

# don't run in X
[ "$DISPLAY" ] && exec echo "this script cannot be run in X"

# use lsb_release to get openSUSE version
which lsb_release >/dev/null &>1 || zypper -n in lsb-release
SUSEVer=SUSE$(lsb_release -s -r | tr -d ".")
buildOption="SuSE/$SUSEVer-${!mach}"


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 1) Make sure kernel sources and compiler are installed
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# install kernel headers and sources if not present
for pkg in kernel-source kernel-$krn-devel kernel-syms ; do
	rpm -qa | grep -q  $pkg || zypper -n in $pkg
done

# install devel_basis (gcc) if not present
zypper search -t pattern -i | grep -q devel_basis || zypper -n in -t pattern devel_basis 

# exit in directory /usr/src/linux/$rel not present
[ -d /usr/src/linux-$rel ] || exec echo "directory /usr/src/linux-$rel not found. Make sure that kernel $rel sources are installed."
	
# make sure the /usr/src/linux -> /usr/src/linux/$rel (in case different kernel sources are installed)	
if [ "$(readlink /usr/src/linux)" != "linux-$rel" ] ; then 
	ln -sfn linux-$rel /usr/src/linux 
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 2) Cancel script if the fglrx module cannot be unloaded
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# unload fglrx 
lsmod | grep -q fglrx && modprobe -r fglrx

# exit if fglrx is still loaded 
lsmod | grep -q fglrx && exec echo "fglrx is still loaded"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 3) Get the ATI installer 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# if installer found in current directory, skip downloading
if [ ! -f ./$atiBaseFile ] ; then

	# 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)
	wget $atiBaseUrl/$atiBaseFile

fi

# look for the ATI installer in the current directory
ati_install=(`find . -name "ati-driver*$mach.run"`)

# cancel script if 0 or more than 1 installer found
if [ ${#ati_install[li]} -gt 1 ] ; then
[/li]	exec echo "several versions of the ATI installer found. Script aborted."
elif [ ${#ati_install[li]} -eq 0 ] ; then
[/li]	exec echo "no ATI installer found. Script aborted."
fi

# let's doublecheck ! :-)
AtiInstall=`basename ${ati_install[0]}`
[ -f ./$AtiInstall ] || exec echo "no ATI installer found. Script aborted."
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 4) Create rpm package 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

sh ./$AtiInstall --buildpkg $buildOption

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 5) Uninstall previoulsy installed fglrx 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 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

# uninstall ATI driver directly installed from the ati .run file
[ -x $atiUninstall ] && $atiUninstall

# unistall ATI driver installed from package generated byt the ati .run file
# Leave it commented out. It is not needed !
# atirpm=$(rpm -qa | grep '^fglrx' | grep $SUSEVer | grep $mach)
# zypper rm $atirpm

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 6) install fglrx 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

# install/reinstall fglrx package 
find . -maxdepth 1 -name "fglrx*$mach.rpm" -exec  zypper in "{}" ";"

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 7) run aticonfig 
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
# 
# 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
	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