Results 1 to 7 of 7
I'm using Slack 8.1 and succesfully compiled the helloworld module.
I can load the module with insmod, I can then see it loaded with lsmod and I can unload it ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-01-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 8
Where are my printk messages?
I'm using Slack 8.1 and succesfully compiled the helloworld module.
I can load the module with insmod, I can then see it loaded with lsmod and I can unload it with rmmod.
However, I never see my printk messages anywhere.
I tried doing a cat of /var/log/messages and /var/log/syslog but don't see my output.
I'm doing all this work via ssh if that makes any diference.
Chris
root@slack-8-1:/usr/src/hellomod# cat hello.c
#define MODULE
#define LINUX
#define __KERNEL__
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void){
printk("<1> Hello Mod Init!\n");
return 0;
}
static void hello_exit(void){
printk(KERN_WARNING "Hello Mod Exit!\n");
}
module_init(hello_init);
module_exit(hello_exit);
root@slack-8-1:/usr/src/hellomod#
root@slack-8-1:/usr/src/hellomod# lsmod
Module Size Used by Not tainted
pcmcia_core 40896 0
ide-scsi 7456 0
eepro100 17264 1
root@slack-8-1:/usr/src/hellomod# insmod hello.o
root@slack-8-1:/usr/src/hellomod# lsmod
Module Size Used by Not tainted
hello 336 0 (unused)
pcmcia_core 40896 0
ide-scsi 7456 0
eepro100 17264 1
root@slack-8-1:/usr/src/hellomod# rmmod hello
root@slack-8-1:/usr/src/hellomod# ls mod
/bin/ls: mod: No such file or directory
root@slack-8-1:/usr/src/hellomod# lsmod
Module Size Used by Not tainted
pcmcia_core 40896 0
ide-scsi 7456 0
eepro100 17264 1
root@slack-8-1:/usr/src/hellomod#
- 02-02-2009 #2
Are you inserting this "hello world" module into a remote kernel? If you are then the printk results are probably on the remote machine...Hope this Helps Gerard4143
Welcome to the forums
- 02-02-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 8
No, I'm inserting it right on the box I'm compiling it on.
- 02-02-2009 #4
- 02-02-2009 #5Just Joined!
- Join Date
- Jan 2009
- Posts
- 8
Becuase my wife demands I sit in the front room with her while she watches TV, but that's a whole other story.
Anyway, I just tried it right from the console and I still don't see them.
Chris
- 02-02-2009 #6
I tried compiling your Hello world module and it worked...the message(s) appeared in the /var/log/messages file...kernel - 2.6.27.7-9-default x86_64 GNU/Linux
MakefileCode://#define MODULE //#define LINUX //#define __KERNEL__ #include <linux/module.h> #include <linux/kernel.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { printk("<1> Hello Mod Init!\n"); return 0; } static void hello_exit(void) { printk(KERN_WARNING "Hello Mod Exit!\n"); } module_init(hello_init); module_exit(hello_exit);
Code:obj-m += test.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
- 02-12-2009 #7Just Joined!
- Join Date
- Jan 2009
- Location
- Bangalore
- Posts
- 15
Where are my printk messages?
Hi
you printk messages will be in /var/log/messages/dmesg
or just type
dmesg
at the end you will see you printk message


Reply With Quote

