PDA

View Full Version : insmod: error inserting 'acumulador.ko': -1 Unknown symbol in module


vruiz
03-09-2009, 10:37 AM
Hi!

I'm newbie in LKM and I use Ubuntu (9.04). I have problems compiling a module. I want to access to xtime variable.

This is the source code:


/*
* acumulador.c - Example kernel module.
*/
#include <linux/module.h>
#include <linux/kernel.h>

int init_module(void)
{
printk("<1>Acumulador iniciado %ld\n", xtime.tv_sec);
return 0;
}

void cleanup_module(void)
{
printk("<1>Acumulador terminado\n");
}


And it's my Makefile:

obj-m += acumulador.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules


and it's the result :


$ make
make -C /lib/modules/2.6.28-8-generic/build M=/home/uve/Escritorio/DSO modules
make[1]: se ingresa al directorio `/usr/src/linux-headers-2.6.28-8-generic'
CC [M] /home/uve/Escritorio/DSO/acumulador.o
Building modules, stage 2.
MODPOST 2 modules
CC /home/uve/Escritorio/DSO/acumulador.mod.o
LD [M] /home/uve/Escritorio/DSO/acumulador.ko
make[1]: se sale del directorio `/usr/src/linux-headers-2.6.28-8-generic'
$ sudo insmod acumulador.ko
insmod: error inserting 'acumulador.ko': -1 Unknown symbol in module



$ dmesg
...
[ 3761.483358] acumulador: Unknown symbol xtime

$ grep xtime /proc/kallsyms
ffffffff80270340 T update_xtime_cache
ffffffff80910280 D xtime_lock
ffffffff809a6500 D inet_peer_gc_maxtime
ffffffff80add180 B xtime
ffffffff80add1b0 b xtime_cache


What's the problem?

I apologise for my english! Thanks!