Note for English Readers

If I write the articles in Indonesian, I will write a summary in English so that you can read my articles too. After you read the summary and you feel that you need more information about that, please do not hesitate to contact me via e-mail that can be found in my profile.

Thank you for reading my blogs.

Thursday, June 14, 2012

AMD Catalyst Patch for kernel-3.4.x

After the kernel-3.3.x has been terminated (EOL), I decided to move to kernel-3.4.x. Unfortunately, this moving was not so easy since fglrx module could not be compiled for the kernel-3.4.x, in other words, this module needs to be patched. Referring to two references that I have written below, I have got the patch and have successfully patched fglrx module of AMD Catalyst-12.4 and AMD Catalyst-12.6Beta. You can download the patch from this link or just copy-paste a few lines below to your favorite text editor and saving it to a file:

--- lib/modules/fglrx/build_mod/firegl_public.c
+++ lib/modules/fglrx/build_mod/firegl_public.c.new
@@ -4181,7 +4184,11 @@ static int kasInitExecutionLevels(unsigned long level_init)
 {
     unsigned int p;
     KCL_DEBUG5(FN_FIREGL_KAS, "%d\n", level_init);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
+    for_each_possible_cpu(p)
+#else
     for_each_cpu_mask(p, cpu_possible_map)
+#endif
     {
         KCL_DEBUG1(FN_FIREGL_KAS,"Setting initial execution level for CPU # %d\n", p);
         preempt_disable();

--- lib/modules/fglrx/build_mod/kcl_ioctl.c
+++ lib/modules/fglrx/build_mod/kcl_ioctl.c.new
@@ -217,6 +217,10 @@
  *  \param size [in] Number of bytes to allocate
  *  \return Pointer to allocated memory
  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
+DEFINE_PER_CPU(unsigned long, old_rsp);
+#endif
+
 void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
 {
     void __user *ret = COMPAT_ALLOC_USER_SPACE(size);


I used the following steps to install AMD Catalyst-12.4 or 12.6 Beta and patch the fglrx module:
  • change directory to the path where the installer is
  • run the installer as root (superuser): 
  • # ./amd-driver-installer-12-4-x86.x86_64.run
    (change to ./amd-driver-installer-8.98-x86.x86_64.run for AMD Catalyst-12.6 Beta)
  • follow the instructions, at the end of installation process you will get notice that there are some errors.
  • exit the installer
  • at console, copy the patch file (fglrx_kernel_3.4.0.patch) to /lib/modules/fglrx
  • change directory to /lib/modules/fglrx
  • patch the fglrx source:
  • # patch -p3 < fglrx_kernel_3.4.0.patch
  • compile the fglrx modules:
  • # cd build_mod
    # ./make.sh
    # cd ..
    # ./make_install.sh
  • reboot.
Enjoy your AMD Catalyst-12.4 or AMD Catalyst-12.6 Beta!

References:

13 comments:

Linards said...

I'm crossing fingers on this one ...

Any feedback for others?

Anonymous said...

Thanks for the tip! Everything worked as expected with my custom 3.4 kernel.

Maxim Yegorushkin said...

Nicely done, thanks a lot! Running it with no issues.

Richard Herbert said...

The patch doesn't work with the official 12.6 released yesterday. The code is patched properly, but the compiler errors out.

Unknown said...

Hi Richard, I have installed AMD Catalyst 12.6 official release, all are working nicely, including the patch. http://henryhermawan.blogspot.com/2012/07/official-release-of-amd-catalyst-126.html

Anonymous said...

Henry, thx for the patch, I will try it!

Unknown said...

You're welcome.

Anonymous said...

You are the man, Henry! Worked like a charm, thank you very much :)

Best Regards,
Chris

tw3ak said...

still a problem with linux-3.5???

Unknown said...

Hi Chris, glad to know this can solve your problem.

Unknown said...

Hi tw3ak, I haven't tried it yet. I have downloaded Catalyst 12.8 & kernel 3.5.3 last week, unfortunately, I didn't have enough time to test them. I hope, I can test them soon.

Peter said...

Hi Henry,

I'm trying to compile the 12.4 fglrx module on my 3.5 kernel, but the compiler keeps erroring out with "/home/peter/catalyst/driver/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:2122:5: error: implicit declaration of function ‘do_mmap’ [-Werror=implicit-function-declaration]". Could you please give me some help?

Unknown said...

Hi Peter,

You need to patch the fglrx module since do_mmap problem. I haven't tried it since I don't have enough time. Currently, I stick to kernel 3.4.x & catalyst 12.6.

FYI, yesterday (22-OCT-2012), AMD has released the official 12.10. You can try it on kernel 3.5.x or 3.6.x. If I have time, I will try it.