Build of kernel module failed

Tried installing 10.7 Catalyst Proprietary Driver and I couldn’t get the kernel module to build. Have also tried this script

rpm -qa '*kernel*'
kernel-xen-devel-2.6.36-90.1.x86_64
kernel-syms-2.6.36-90.1.x86_64
kernel-desktop-2.6.36-90.1.x86_64
kernel-default-devel-2.6.36-90.1.x86_64
kernel-desktop-base-2.6.36-90.1.x86_64
kernel-desktop-devel-2.6.36-90.1.x86_64
patterns-openSUSE-devel_kernel-11.3-22.1.x86_64
kernel-default-2.6.36-90.1.x86_64
kernel-debug-devel-2.6.36-90.1.x86_64
kernel-firmware-20100617-24.2.noarch
kernel-devel-2.6.36-90.1.noarch
kernel-source-2.6.36-90.1.noarch

rpm -qa '*fglrx*'
fglrx64_7_5_0_SUSE113-8.783-1.x86_64

rpm -qa '*gcc*'
gcc45-info-4.5.0_20100604-1.12.noarch
gcc44-info-4.4.1_20090817-2.3.4.x86_64
gcc-c++-4.5-4.2.x86_64
gcc45-c++-4.5.0_20100604-1.12.x86_64
gcc44-4.4.1_20090817-2.3.4.x86_64
gcc-gij-4.5-4.2.x86_64
gcc-info-4.5-4.2.x86_64
gcc45-4.5.0_20100604-1.12.x86_64
gcc44-c++-4.4.1_20090817-2.3.4.x86_64
gcc-java-4.5-4.2.x86_64
gcc45-java-4.5.0_20100604-1.9.x86_64
libgcc45-32bit-4.5.0_20100604-1.12.x86_64
gcc45-gij-4.5.0_20100604-1.9.x86_64
cross-mingw-gcc-3.4.5_20060117_1-5.1.x86_64
gcc-4.5-4.2.x86_64
libgcc45-4.5.0_20100604-1.12.x86_64

rpm -q make
make-3.81-135.1.x86_64


Are there any inconsistencies here?

This script is not intended to install the ATI driver. It’s a service which recompiles already installed kernel modules after a kernel update.
To install/upgrade Catalyst, you can use that script: Upgrading ATI driver with atiupgrade
If you have a good reason to install 10.7 rather than the latest version (10.10) you should change the value of catalystVer in the script. It hasn’t been tested with 10.7 though.

Oh, I see that you have fglrx64_7_5_0_SUSE113-8.783-1.x86_64 installed. It is the latest Catalyst version (10.10).
Do you have the file /etc/modautocompile.conf with the following content?

# kernel modules to autocompile after kernel update
# name                  command
fglrx           /usr/bin/fglrx-kernel-build.sh

Are you sure the module hasn’t been compile :

find /lib/modules -name "fglrx.ko"

What happens if you do:

service modautocompile start

?

I already have the file /etc/modautocompile.conf. And I ran the commands

find /lib/modules -name "fglrx.ko"
/lib/modules/2.6.34-12-desktop/extra/fglrx.ko
/lib/modules/2.6.31.12-0.1-desktop/extra/fglrx.ko
/lib/modules/2.6.31.12-0.2-desktop/extra/fglrx.ko

service modautocompile start
 - compiling module fglrx.ko
file /lib/modules/2.6.36-90-desktop/source/include/../arch/x86/include/asm/compat.h says: COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
/usr/src/kernel-modules/fglrx /home/izaak
make: Entering directory `/usr/src/linux-2.6.36-90-obj/x86_64/desktop'
make -C ../../../linux-2.6.36-90 O=/usr/src/linux-2.6.36-90-obj/x86_64/desktop/. 
  CC [M]  /usr/src/kernel-modules/fglrx/firegl_public.o
/usr/src/kernel-modules/fglrx/firegl_public.c:410:5: error: unknown field 'ioctl' specified in initializer
/usr/src/kernel-modules/fglrx/firegl_public.c:410:5: warning: initialization from incompatible pointer type
/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
make[3]: *** [/usr/src/kernel-modules/fglrx/firegl_public.o] Error 1
make[2]: *** [_module_/usr/src/kernel-modules/fglrx] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
make: Leaving directory `/usr/src/linux-2.6.36-90-obj/x86_64/desktop'

******************************
Build of kernel module failed!
******************************


As you can see, the module failed to build. What else am I missing?

You’re not missing anything. It just looks like the fglrx module doesn’t compile with kernel 2.6.36-90. It might be related with the asm compat bug we had before. In that case you can either patch the kernel or patch the module. I do not garantee that it’s going to work anf you might have to modify the patch anyway, as the files probably don’t match exactly.
These were the patches used to fix that bug on kernel 2.6.34.7-0.3 (not needed anymore since 2.6.34.7-0.4) :

kernel patch


--- /usr/src/linux-2.6.34.7-0.3/arch/x86/include/asm/compat.h.orig      2010-05-16 14:17:36.000000000 -0700
+++ /usr/src/linux-2.6.34.7-0.3/arch/x86/include/asm/compat.h   2010-09-24 04:08:33.245272394 -0700
@@ -216,4 +216,10 @@
        return current_thread_info()->status & TS_COMPAT;
 }
 
+static inline void __user *compat_alloc_user_space(unsigned long len)
+{
+       struct pt_regs *regs = task_pt_regs(current);
+       return (void __user *)regs->sp - len;
+}
+ 
 #endif /* _ASM_X86_COMPAT_H */

module patch


--- /usr/src/kernel-modules/fglrx/kcl_ioctl.c.orig      2010-10-06 14:26:53.480379335 -0700
+++ /usr/src/kernel-modules/fglrx/kcl_ioctl.c   2010-10-06 14:29:25.054397034 -0700
@@ -193,7 +193,13 @@
  */
 void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
 {
-    return compat_alloc_user_space(size);
+    void __user *ret = arch_compat_alloc_user_space(size);
+
+    /* prevent stack overflow */
+    if (!access_ok(VERIFY_WRITE, ret, size))
+        return NULL;
+
+    return (void *)ret;
 }
 
 #endif // __x86_64__

Do not apply both of them! Either patch the kernel or patch the module (rather patch the module!). But again, if the files are different from previous versions, the patch is not going to work and you will have to apply the changes manually. If it doens’t help, it’s another bug.

You wouldn’t have problems with kernel 2.6.34.7-0.5.

I tried patching the module and ‘service modautocompile start’. I guess it really isn’t going to work.
So is reverting to an older kernel a staightforward process? i.e. zypper in kernel-desktop-2.6.34.7-0.5…etc and removing the newer one?

I’ll just use yast.

Don’t forget to reverse the patch before compiling the module for kernel 2.6.34.7-0.5!
I have no idea about fglrx issues on kernel 2.6.36. I don’t use that one.

firegl_public.c:410:5: error: unknown field ‘ioctl’ specified in initializer - Google Search

BTW:

Never, never, ever patch your kernel sources/headers if an “out of tree”-module fails to build.

Not only will you break other compatible “out of tree”-modules with that, you also get a good chance your compiled module will not work.

Your only chance to get it running is to patch the out of tree-module (see search results above).

Additional:

Luckily enough, patching this file

--- /usr/src/linux-2.6.34.7-0.3/arch/x86/include/asm/compat.h.orig      2010-05-16 14:17:36.000000000 -0700
+++ **/usr/src/linux-2.6.34.7-0.3/arch/x86/include/asm/compat.h**   2010-09-24 04:08:33.245272

did not have any effect for an “out of tree”-build, a sane Makefile will search somewhere else for the headers to include.

A very good article about building external modules (especially about what NOT to do) is here:

j.eng’s site - No cloneconfig needed!

The author is a kernel developer and also a well known packager of openSUSE RPMs (jengelh), so if you don’t trust me, THIS guy knows, what he is talking about.

And as an additional note, with openSUSE >= 11.3, “kernel-source” is not needed any more for building external kernel modules, kernel-devel and kernel-$flavor-devel for the respective kernel flavor(s) is enough.

(I really DO “love” this function preventing you from editing your posts after a few minutes.)

I have rollback all my kernels to 2.6.34.7-0.5 and ran fglrx-kernel-build.sh.

The driver is installed now, but movie in vlc is laggy. Is this how its suppose to work? If it is, I’m reverting back to the default radeon driver.