jineesh
Newbie level 4
hi all
i 'm new to linux kernel module programming.
when i tried to compile one simple module like ( this example is from The Linux Kernel Module Programming Guide written by Ori Pomerantz)
////////////////////////////////////////////////////////////////////////////
#include <linux/module.h>/* Needed by all modules */
#include <linux/kernel.h>/* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
/////////////////////////////////////////////////////////////////////////////
and for compilation i used the makefile as follows.
////////////////////////////////////////////////////////////////////////////
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
/////////////////////////////////////////////////////////////////////////////////
when i tried 'make' the output is something like this
hostname:~/lkmpg-examples/02-HelloWorld# make
make -C /lib/modules/2.6.11/build M=/root/lkmpg-examples/02-HelloWorld modules
make[1]: Entering directory `/usr/src/linux-2.6.11'
......
after this it shows error. i think problem is with the usage of 'kbuild'. I dont have any idea about it. i just downloaded and installed. how to use kbuild ? In the book it is written that kbuild is explained in
linux/Documentation/kbuild/modules.txt
but i failed to follow this.
plz anybody help me.
thanks
jineesh
i 'm new to linux kernel module programming.
when i tried to compile one simple module like ( this example is from The Linux Kernel Module Programming Guide written by Ori Pomerantz)
////////////////////////////////////////////////////////////////////////////
#include <linux/module.h>/* Needed by all modules */
#include <linux/kernel.h>/* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
/////////////////////////////////////////////////////////////////////////////
and for compilation i used the makefile as follows.
////////////////////////////////////////////////////////////////////////////
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
/////////////////////////////////////////////////////////////////////////////////
when i tried 'make' the output is something like this
hostname:~/lkmpg-examples/02-HelloWorld# make
make -C /lib/modules/2.6.11/build M=/root/lkmpg-examples/02-HelloWorld modules
make[1]: Entering directory `/usr/src/linux-2.6.11'
......
after this it shows error. i think problem is with the usage of 'kbuild'. I dont have any idea about it. i just downloaded and installed. how to use kbuild ? In the book it is written that kbuild is explained in
linux/Documentation/kbuild/modules.txt
but i failed to follow this.
plz anybody help me.
thanks
jineesh