fglrx + patched Linux kernels

So lately, I have noticed that people, including myself have been running into a fatal error which prevents your fglrx (ATi proprietary drivers) to compile due to the fact that the kernel developers decided to patch a critical vulnerability with a GPL only solution which meant that the library that fglrx requires no longer exist.

You would usually get an error like this when you try to compile the fglrx kernel module:

/usr/src/kernel-modules/fglrx /
make: Entering directory `/usr/src/packages/BUILD/kernel-2.6.35.50.3desktop'
  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_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
/usr/src/kernel-modules/fglrx/kcl_ioctl.c: In function ‘KCL_IOCTL_AllocUserSpace32’:
/usr/src/kernel-modules/fglrx/kcl_ioctl.c:196:5: error: implicit declaration of function ‘compat_alloc_user_space’
/usr/src/kernel-modules/fglrx/kcl_ioctl.c:196:5: warning: return makes pointer from integer without a cast
make[1]: *** [/usr/src/kernel-modules/fglrx/kcl_ioctl.o] Error 1
make: *** [_module_/usr/src/kernel-modules/fglrx] Error 2
make: Leaving directory `/usr/src/packages/BUILD/kernel-2.6.35.50.3desktop'

 

Fortunately, there is a solution to this and it took me days to find this oh so very simple solution, apparently all you need to do is to go into the /usr/src/kernel-modules/fglrx/kcl_ioctl.c file (each distribution may vary) and on line 197, change it from:

void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
{
    return compat_alloc_user_space(size);
}

#endif // __x86_64__

 

to this:

void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
{
    return arch_compat_alloc_user_space(size);
}

#endif // __x86_64__

Save the file and then recompile the kernel module by running /usr/bin/fglrx-kernel-build.sh and you should get your kernel module building again. After recompiling your kernel, reboot your machine and fglrx will then load and boot.

It's just that simple, only 5 extra characters that makes that big of a difference.

Hope this helps!

Do note that I did not discover this fix and was discovered by others. I'm just simply posting it to help others. I do not take any credit for this fix.

My distribution information :

OpenSUSE 11.3 x86_64
Linux kernel 2.6.35.5 (custom compilation) 
fglrx 8.771 (Catalyst 10.9) 

Leave a Reply

Your email address will not be published. Required fields are marked *