Tuesday, April 10, 2012

ATI Mobility Radeon HD 5xxx Series in Linux (kernel 3.2.14)

I will try to explain how I got to install the AMD Catalyst™ 12.3 Proprietary Linux x86 Display Driver and avoid all the installation problems with the Kernel 3.2.14.

In the beggining I was getting this error:

# vim /usr/share/ati/fglrx-install.log
1
2 Creating symlink /var/lib/dkms/fglrx/8.85/source ->
3 /usr/src/fglrx-8.85
4
5 DKMS: add Completed.
6
7 Kernel preparation unnecessary for this kernel. Skipping...
8
9 Building module:
10 cleaning build area....
11 cd /var/lib/dkms/fglrx/8.85/build; sh make.sh --nohints --uname_r=2.6.38-2-6 86 --norootcheck.....(bad exit status: 1)
12 0
13 0
14 [Error] Kernel Module : Failed to build fglrx-8.85 with DKMS
15 [Error] Kernel Module : Removing fglrx-8.85 from DKMS
16
17 ------------------------------
18 Deleting module version: 8.85
19 completely from the DKMS tree.
20 ------------------------------
21 Done.
22 [Reboot] Kernel Module : update-initramfs

To avoid this problem I uninstalled the program dkms. I have to say that I don't know what is for this program and if you need it you can try to reinstall it after finishing the installation of the ATI driver.




$ apt-get remove dkms

Once I did this I tryed to install again the driver but I got a new error:

[Message] Kernel Module : Found kernel module build environment, generating kernel module now.
AMD kernel module generator version 2.1
doing Makefile based build for kernel 2.6.x and higher
rm -rf *.c *.h *.o *.ko *.a .??* *.symvers
make -C /lib/modules/3.2.9-1.fc16.i686/build SUBDIRS=/lib/modules/fglrx/build_mod/2.6.x modules
make[1]: Entering directory `/usr/src/kernels/3.2.9-1.fc16.i686'
CC [M] /lib/modules/fglrx/build_mod/2.6.x/firegl_public.o
/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘KCL_fpu_begin’:
/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:5804:28: error: ‘TS_USEDFPU’ undeclared (first use in this function)
/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:5804:28: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o] Error 1
make[1]: *** [_module_/lib/modules/fglrx/build_mod/2.6.x] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.2.9-1.fc16.i686'
make: *** [kmod_build] Error 2
build failed with return value 2
[Error] Kernel Module : Failed to compile kernel module - please consult readme.
[Reboot] Kernel Module : dracut

This time it was more complicate to fix this error, because we have to apply a patch to the ATI driver source. I followed this steps that can be found in this page.

1) Extract amd-driver-installer into subdir. Example:

chmod 700 amd-driver-installer-12-2-x86.x86_64.run
./amd-driver-installer-12-2-x86.x86_64.run --extract fglrx-12.2


2) cd into directory containing firegl_public.c. i.e.,

cd fglrx-12.2/common/lib/modules/fglrx/build_mod/


3) In that dir, open a text editor, copy the following code and save to a file named "fglrx.patch":

fixed fgrlx compilation error on 32-bit x86 arch with kernel 3.3-rc4 due to commit:
https://github.com/torvalds/linux/commit/f94edacf998516ac9d849f7bc6949a703977a7f3
later modified (in 3.3-rc5) by commit:
https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8#diff-1
and finally backported to kernel 3.2.8.

Signed-off-by: Gianluca Gennari
---
firegl_public.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/firegl_public.c b/firegl_public.c
index 6e0aa82..cb9e217 100644
--- a/firegl_public.c
+++ b/firegl_public.c
@@ -5797,10 +5797,16 @@ void ATI_API_CALL KCL_fpu_begin(void)
#ifdef CONFIG_X86_64
kernel_fpu_begin();
#else
+#ifndef TS_USEDFPU
+ preempt_disable();
+ if (__thread_has_fpu(current))
+ __save_init_fpu(current);
+#else
struct thread_info *cur_task = current_thread_info();
preempt_disable();
if (cur_task->status & TS_USEDFPU)
__save_init_fpu(cur_task->task);
+#endif
else
clts();
#endif
--
1.7.5.4


4) Run the patch on firegl_public.c :

patch -p1 < ~/fglrx.patch


5) At this point, if you have previously run amd-driver-installer unsuccessfully, you need to return the system to it's starting state by running /usr/share/ati/fglrx-uninstall.sh. Then, make sure you follow the directives in the section below titled "Installation Prep for Amd-Driver-Installer". After you have completed that checklist, you can now run ati-installer.sh from the extraction subdir (in this case "fglrx-12.2") using the following command line:

/bin/sh ./ati-installer.sh 8.95 --install


From here you should have a successful Fglrx installation. However at the end remember to execute this command to create the new xorg.conf file.

aticonfig --initial -f




Resources
http://wiki.cchtml.com/index.php/Fedora_16_Installation_Guide#Amd-driver-installer_Compilation_Problems_on_i686_Fedora_16
http://techpatterns.com/forums/about1864.html
http://www.linuxquestions.org/questions/slackware-14/cant-compile-fglrx-kernel-module-for-kernel-3-2-13-in-current-936784/

No comments: