Newbie - Help compiling kernel modules

Wesley Jin wesleyj22 at gmail.com
Tue Mar 3 05:58:03 CET 2009


H
Hello,
I am new to the *OpenMoko* community and appreciate your patience.
I am trying to compile a simple "Hello World" *kernel* module.

//***********************************************************************
#include <linux/module.h>       /* Needed by all *modules* */
#include <linux/*kernel*.h>       /* Needed for KERN_INFO */
#include <linux/init.h>         /* Needed for the macros */

static int __init hello_start(void)
{
printk(KERN_INFO "Loading hello module...\n");
return 0;
}

static void __exit hello_end(void)
{
printk(KERN_INFO "Leaving module\n");
}
//***********************************************************************

I have downloaded the tool chain and am trying to compile the module as
follows:
/usr/local/*openmoko*/arm/bin/arm-angstrom-linux-gnueabi-gcc -D__KERNEL__
-DMODULE -c hello.c
hello.c:1:60: error: linux/module.h: No such file or directory
hello.c:3:60: error: linux/init.h: No such file or directory
hello.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘hello_start’
hello.c:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘hello_end’
hello.c:17: warning: data definition has no type or storage class
hello.c:17: warning: parameter names (without types) in function declaration

hello.c:18: warning: data definition has no type or storage class
hello.c:18: warning: parameter names (without types) in function declaration


It's complaining that it cannot find linux/ libraries.
Do I need to use the -l option to specify the *OpenMoko* libraries
somewhere?

I really appreciate any help.
Thanks.

Wesley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/devel/attachments/20090302/9a3f8ce0/attachment.htm 


More information about the devel mailing list