Installing ATI-Drivers on Debian Linux(nforce2 chipset)

Introduction

There are some problems when installing drivers for ATI graphic-cards on Linux on a motherboard with nforce2 chipset. Thus I've written this little description which might be helpful.

Making the Kernel

We need the agpgart module of kernel 2.4.22. The ATI drivers have also built-in support for the AGP-Bus, but the latest version still does not work with ATI cards. On a debian system just use apt-get:
apt-get install kernel-source-2.4.22
If you want to compile the kernel the "debian-way" you also need the debian package "kernel-package":
apt-get install kernel-package

Configuration

We are now ready to configure the kernel. Change to directory /usr/src/. There you will find the kernel-source, which is a tar.bz2-file. Extract it and change to the new directory to run "make menuconfig:
cd /usr/src
tar xjvf kernel-source-2.4.22.tar.bz2
ln -s kernel-source-2.4.22 linux
cd linux
make menuconfig
apt-get install kernel-package
The most important options are:
- Processor type and features
  - [*] MTRR (Memory Type Range Register) support

- Loadable module support 
  - [*] Enable loadable module support
  - [*] Kernel module loader support

- Character devices
  - <M> /dev/agpgart (AGP Support)
    - [*] NVIDIA chipset support 
  - [ ] Direct Rendering Manager (XFree86 DRI support)
IMPORTANT: Do NOT select "Direct Rendering Manager"! It's not compatible with ATI drivers.

Notes about Kernel 2.6.x

If you use the old config of the 2.4.x kernel you might run into trouble, because now the options for /dev/agpgart and NVIDIA chipset support need to be both in the kernel or both compiled as a module. But it's not possible to have /dev/agpgart compiled as module and NVIDIA chipset support in the kernel. Thus the command "make oldconfig" changes the config and NVIDIA chipset support will be compiled as module. That's no problem, but you have to know that and load the module after booting. Otherwise 3D-support will not work and you will get error messages in your Xfree logfile.

Compilation

Now compile the kernel, create the debian package and install it:
make-kpkg --revision=custom.1.0 --append-to-version=-ati kernel_image
dpkg -i ../kernel-image-2.4.22-ati_custom.1.0_i386.deb

Lilo Setup

If you want to configure Lilo yourself create a new entry:
image=/boot/vmlinuz-2.4.22-ati
  label=Linux-ati
  read-only
Don't forget to run Lilo afterwards!

Now we are ready to reboot and load the new kernel.

Testing agpgart

Login as root and try to load the module:
modprobe agpgart
On my system I get the following output:
Linux agpgart interface v0.99 (c) Jeff Hartmann
agpgart: Maximum main memory to use for agp memory: 439M
agpgart: Detected NVIDIA nForce2 chipset
agpgart: AGP aperture is 64M @ 0xe0000000
To load the module automatically at boot-time add "agpgart" to /etc/modules:
echo agpgart >> /etc/modules

Installing the Drivers

You can find the drivers on the ATI homepage
There's also an textfile with Installation Tips
Download the package that fits to your X-server. ATI provides only rpm packages, but with alien we are able to convert it into a debian package.
alien -d fglrx-glc22-4.2.0-3.2.5.i586.rpm
dpkg -i fglrx-glc22_4.2.0-4.2_i386.deb

Package Dependencies

You will get some errors when installing the package, e.g.:
Unpacking replacement fglrx-glc22 ...
dpkg: error processing fglrx-glc22_4.2.0-4.2_i386.deb (--install):
 trying to overwrite `/usr/X11R6/lib/libGL.so.1.2', which is also in
 package xlibmesa3-gl
 dpkg-deb: subprocess paste killed by signal (Broken pipe)
 Errors were encountered while processing:
  fglrx-glc22_4.2.0-4.2_i386.deb
This problem appears because libGL.so.1.2 is also provided by xlibmesa3-gl. The easiest way to get around is to force the package installation(Don't do it, read further before!).
Note: Package names are sometimes changing, the current package is called fglrx-4.3.0. Take care about that when moving to the next step.
dpkg --force-overwrite -i <package_filename>.deb
e.g.: dpkg --force-overwrite -i fglrx-glc22_4.2.0-4.2_i386.deb
This solution makes problems when upgrading or removing the xlibmesa3-gl package, so it should be avoided. Kai Weber reported this and also a better way, how to do it. Thanks a lot for this tip, Kai. The right way is to use dpkg-divert. It makes it possible that two different packages provide the same file:
dpkg-divert --package <package_name> --add /usr/X11R6/lib/libGL.so.1.2
dpkg -i <package_filename>
e.g.:
dpkg-divert --package fglrx-glc22 --add /usr/X11R6/lib/libGL.so.1.2
dpkg -i fglrx-glc22_4.2.0-4.2_i386.deb
<package_filename> is the filename of the package (.deb file)
<package_name> is the name of the package, you already have seen it during unpacking (fglrx-glc22 in this case):
Unpacking replacement fglrx-glc22 ...
If you want to remove the diversion and the fglrx-glc22 package:
dpkg-divert --remove /usr/X11R6/lib/libGL.so.1.2
dpkg --purge fglrx-glc22

Xfree Configuration

ATI provides a tool for writing a new configuration:
fglrxconfig
It will prompt for some options, in most cases the default values are ok.
Only one question is really important:
Do you want to use the external AGP GART module (y/n)? [n] y
Say yes here to use the kernel module "agpgart".

Compiling the Kernel Module

To compile the custom kernel module "fglrx" execute the following commands:
cd /lib/modules/fglrx/build_mod
chmod u+x make.sh
./make.sh
cd ..
chmod u+x make_install.sh
./make_install.sh
The last step will also try to load and unload the module.

Testing X

Start your X-server and run "glxgears" and "fgl_glxgears". Here's the output on my AthlonXP:
jimmy@reptile:~$ glxgears
9579 frames in 5.0 seconds = 1915.800 FPS
8790 frames in 5.0 seconds = 1758.000 FPS
8791 frames in 5.0 seconds = 1758.200 FPS
8728 frames in 5.0 seconds = 1745.600 FPS
8665 frames in 5.0 seconds = 1733.000 FPS
8791 frames in 5.0 seconds = 1758.200 FPS

jimmy@reptile:~$ fgl_glxgears
1466 frames in 5.0 seconds = 293.200 FPS
1387 frames in 5.0 seconds = 277.400 FPS
1386 frames in 5.0 seconds = 277.200 FPS
1380 frames in 5.0 seconds = 276.000 FPS
1381 frames in 5.0 seconds = 276.200 FPS
1363 frames in 5.0 seconds = 272.600 FPS

Links

Another ATI-Radeon-Linux-Howto which is also available in german.
This ATI-Radeon-Linux-Howto also includes information about installing the drivers on other distributions.
ATI Linux driver packages for Debian
Another HowTo for Debian, also includes Debian packages and reports of working setups.