LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-13-2007, 02:38 AM   #1
jynth.m
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Rep: Reputation: 0
Question help me! problem in loading module?


hello,

I'm new to the driver programming. i successfully compiled kernel source 2.6.18 and i'm running it. the simple driver program what i wrote successfully compiled and i got .ko module. but as do insmod mymodule.ko i could see nothing on the screen, just root# prompt. what could be the reason? help me.
this is simple program i wrote:

#include<linux/init.h>
#include<linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
int init_module(void){
printk("<1>Hello World\n");
return 0;
}
void cleanup_module(void){
printk("<1>Good BYE\n");
}

and i compiled as
root# make -C "lib/modules/$(uname -r)/build" M=$PWD obj-m="$(basename mymodule.c .c).o"

i got mymodule.ko ,these are steps i followed to load module and results i got are as below
root#insmod ./mymodule.ko
root#
root#rmmod mymodule
root#
i could see no print messages on the screen. what the problem here? but the module is loaded, i checked using lsmod and in /proc/modules
 
Old 11-13-2007, 06:28 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I've not done any kernel programming, but could it be that the output isn't meant to be shown on the terminal and appears in /var/log/messages or something else?
 
Old 11-13-2007, 07:20 AM   #3
jynth.m
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks..

Thanks for the reply..
It is in /var/log/messages.. but how to get it printed on the konsole? reply please..

Last edited by jynth.m; 11-13-2007 at 07:22 AM.
 
Old 11-13-2007, 09:44 AM   #4
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Rep: Reputation: 33
You want to use printk for debugging?? thats way you want it on console. right?

you could just do the tail -n [any number] on /var/log/messages to se the values at some critical point.

As far as remember printing message only help so much.
 
Old 11-15-2007, 05:52 AM   #5
sixerjman
Member
 
Registered: Sep 2004
Distribution: Debian Testing / Unstable
Posts: 180
Blog Entries: 1

Rep: Reputation: 32
Try doing the insmod / rmmod on the real console

Messages won't show up if you are running under X (i.e. gnome or KDE + xterm). If you use Gnome, Control+Alt+F1 will put you into the first console. Login as root, then do the insmod and rmmod.

Last edited by sixerjman; 11-15-2007 at 05:54 AM.
 
Old 11-16-2007, 12:15 AM   #6
jynth.m
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks sixerjman.. now i am able debug my 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
Module loading problem don_dimo Linux - Software 3 05-17-2004 09:06 AM
module loading problem in 2.6.3 silverline Linux - Hardware 1 04-08-2004 06:51 PM
module loading problem usr Linux - General 2 01-11-2004 10:18 AM
Problem loading a module louai Linux - Software 1 01-07-2004 09:57 PM
Finding Module Dependencies...(Still loading...still loading..still loading..HANG!!!) Aeudian Linux - General 3 08-11-2003 03:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:35 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