LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-03-2009, 07:24 AM   #1
supernaturalyasir
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
not show output of simple module


hello i am newer here and also a new user for linux. actutally the problem is that i was writing a simple module for kernel 2.6.30. it does load and unload successfuly, but do not gives required output as it should show. can any body help me. code is so simple here it is
/*
* hello−1.c − The simplest kernel module.
*/
#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 here its Makefile

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


after loading it does not show any output, and should show Hello world!

Last edited by supernaturalyasir; 07-03-2009 at 07:26 AM.
 
Old 07-03-2009, 08:53 AM   #2
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
Let me make sure that you're expecting the output in the right place. The phrases "Hello world" and "Goodbye world" will not be printed in your terminal, they will be seen if you run the

dmesg

command after you load or unload the module.
 
  


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
My fstab output doesn't show my slave!!!!! faby1321 Linux - Newbie 3 01-06-2008 12:16 PM
Is there a way to show the output of background process? nadavvin Linux - General 1 05-27-2007 11:21 PM
Can I show different output on the laptop screen and the external one? riwaJR Linux - Laptop and Netbook 9 11-14-2006 02:01 PM
how to show input and output of a program on the terminal divin Linux - Software 1 03-25-2005 12:19 AM
'Invalid module format' loading simple module on Suse Linux Professional 9.1 rocketdude Linux - Distributions 3 07-27-2004 11:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:53 AM.

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