AnsweredAssumed Answered

Error compiling very simple Kernel module

Question asked by Matteo Fabiani on Aug 30, 2012
Latest reply on Jul 24, 2013 by yanhongfei yan

Hi,

I'm trying to compile a kernel test module by means of the below line in i.mx28EVK board.

 

make CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- -C /home/mydir/imx28/ltib/rpm/BUILD/linux-2.6.35.3 ARCH=arm M=/home/mydir/Project/test modules

 

 

The code of test module is listed below.......

 

 

#include <linux/module.h>

#include <linux/init.h>
/* public domain */
MODULE_LICENSE("GPL and additional rights");

static int test_init(void)
{
return 0;
}
static void test_exit(void)
{
}
module_init(test_init);
module_exit(test_exit);

 

 

.....and the result of the cross-compilation is lised below:

 

 

CC /home/mydir/Project/test/test.mod.o
/home/mydir/Project/test/test.mod.c:8: error: variable '__this_module' has initializer but incomplete type
/home/mydir/Project/test/test.mod.c:9: error: unknown field 'name' specified in initializer
/home/mydir/Project/test/test.mod.c:9: warning: excess elements in struct initializer
/home/mydir/Project/test/test.mod.c:9: warning: (near initialization for '__this_module')
/home/mydir/Project/test/test.mod.c:10: error: unknown field 'init' specified in initializer
/home/mydir/Project/test/test.mod.c:10: warning: excess elements in struct initializer
/home/mydir/Project/test/test.mod.c:10: warning: (near initialization for '__this_module')
/home/mydir/Project/test/test.mod.c:14: error: unknown field 'arch' specified in initializer
/home/mydir/Project/test/test.mod.c:14: error: 'MODULE_ARCH_INIT' undeclared here (not in a function)
/home/mydir/Project/test/test.mod.c:14: warning: excess elements in struct initializer
/home/mydir/Project/test/test.mod.c:14: warning: (near initialization for '__this_module')
make[1]: *** [/home/mydir/Project//test/test.mod.o] Error 1

 

 

Have you any suggestion??

Thank you very much!!

Outcomes