Building Kernel Module

Submitted by rizzetti
on September 23, 2008 - 5:24pm

Hello,

I'm trying compile a external kernel module of a proprietary driver. The makefile build object files, but seems that where Building modules, stage 2 start the headers doesn't found. The output is something like that

....
LD [M] /Linux_PPC/EZpul_k26.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "__kmalloc" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "strlen" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "sprintf" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "jiffies" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "memset" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "printk" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "schedule_timeout" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "vsnprintf" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "kfree" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "memcpy" [/Linux_PPC/EZpul_k26.ko] undefined!
WARNING: "memmove" [/Linux_PPC/EZpul_k26.ko] undefined!
CC /Linux_PPC/EZpul_k26.mod.o
/Linux_PPC/EZpul_k26.mod.c:8: error: variable '__this_module' has initializer but incomplete type
...

The main Make invocation is like
$(MAKE) -C $(KDIR) M=$(PWD) BASEDIR=$(BASEDIR) CROSS_COMPILE=ppc_6xx- ARCH=powerpc

EXTRA_CFLAGS has a Include dirs for proprietary source code
CFLAGS has include for kernel source ($(KDIR)/include)

Where previous Variables are correctly set.

I searched about this, but can't found nothing helpfull.

Some Tip ?

Thanks a lot.

Solved

on
December 16, 2008 - 1:00pm

I solved this problem some time after the previous post, and for someone that have the same problem that I had, for future references, I will explain what happens.

This error is caused because the kernel modules support isn't enable, the solution is simple, just run:

make ARCH=YOUR_ARCH CROSS_COMPILE=YOUR_CROSSCOMPILE menuconfig

[*] Enable loadable module support
[*] Module unloading (not necessary, but very useful)

and recompile the kernel.

After that, the modules will compile fine.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.