Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Module programming problem

Status
Not open for further replies.

jineesh

Newbie level 4
Joined
Mar 30, 2006
Messages
6
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,336
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
 

only done beginner level programming with modules , but never used kbuild , what is it for..

i only needed gcc
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top