Linux.com

Home Linux Community Forums Programming and Development Kernel Development kernel module: no symbol version for struct_module

kernel module: no symbol version for struct_module

Link to this post 09 Apr 10

Hi all,

I try to build a simple kernel module on Ubuntu 9.04 with an self compiled (make-kpkg) 2.6.29.4 Kernel. The kernel module is a simple "Hello World" example listed below:


#include <linux/module.h>
#include <linux/kernel.h>

int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");

return 0;
}

void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}

The Makefile which belongs to the module looks like:


MODULENAME := anytimeKM

obj-m += $(MODULENAME).o

prefix := $(shell rtai-config --prefix)

ifeq ($(prefix),)
$(error Please add <rtai-install>/bin to your PATH variable)
endif

CC = $(shell rtai-config --cc)

LINUX_DIR = $(shell rtai-config --linux-dir)

all:$(MODULENAME).ko

$(MODULENAME).ko:$(MODULENAME).c
$(MAKE) -C $(LINUX_DIR) CC=$(CC) SUBDIRS=$$PWD V=$(V) modules

clean::
$(RM) $(LINUX_DIR)/.tmp_versions/*_rt.mod *.o *.ko *.mod.c .*.cm

.PHONY: clean

The compile process works fine except of the following warning message:



....
Warning: Symbol version dump /usr/linux-2.6.29.4/Module.symvers is missing; modules will have dependencies and modversions.
....


When I try to insmod the module I get the following error message:

insmod: error inserting 'anytimeKM.ko': -1 Invalid module format

dmesg prints:

anytimeKM: no symbol version for struct_module

Does anybody knows how to fix that problem? I will appreciate it if somebody can bring some light to the dark.

Best regards

Nekoto

Link to this post 16 Apr 10

With the most recent versions of the kernel, you need to actually configure and build (but not install) the kernel in order to properly build a loadable kernel module. At least that was what I understood when I recently had to do that. So, I have done so, and everything works as expected.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board