LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-23-2006, 02:04 AM   #1
venkatesh111
Member
 
Registered: Mar 2006
Posts: 34

Rep: Reputation: 15
Question module not in action


hi,
i have loaded my simple module hello.o into kernel using insmod hello.o
the module was succesfully inserted i could see my module using lsmod
but,
but,
but,
the module i inserted is (unused) wt does it mean?
n how can i make it to be in action
n i could not see any mesage from my module in

/var/log/messages


**************my hello.c************

#define __NO_VERSION__
#include <linux/version.h>
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>

static int hello_init(void)
{
printk("hello world");
return 0;
}

static void hello_exit(void)
{
printk("goodbye... world");
}

module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("VENKATESH");



*********my Makefile**************

TARGET := hello
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc33

${TARGET}.o: ${TARGET}.c

.PHONY: clean

clean:
rm -rf {TARGET}.o
 
Old 03-23-2006, 04:49 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Code:
printk("hello world\n");
Printk as printf is buffered. It waits for end of line to really flush and display the string so always finish printk with \n.

And your module doesn't provide any function to the outside world so why would it be used?
in general another module or the kernel requiring your module will call insmod, or when looking at /lib/modules/`uname -r`/modules.dep will automatically load the modules on which it depends.
so in general after creating and putting a module in /lib/modules/..
oyu have to run depmod -a so that dependencies are recreated.
These two actions are made by make modules_install in the kernel tree

I highly suggest that you read this online book:
http://lwn.net/Kernel/LDD3/
You will understand a lot!
http://www.xml.com/ldd/chapter/book/ for older kernels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What about our Action Heroes? Mega Man X General 30 04-14-2005 04:56 AM
See CL in Action 2 Xterminator Conectiva 0 06-30-2003 10:14 AM
affirmative action? fragged one General 25 01-23-2003 09:37 PM
Dumb action... techplex Linux - Newbie 5 01-23-2003 08:28 PM
See CL 8 in action Xterminator Conectiva 1 09-26-2002 12:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration