Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seeing output of Kernel Modules

Status
Not open for further replies.

akiba201

Programmer
Nov 7, 2005
30
0
0
CA
Hi,
Could anyone help me on how I can see the output/results of a kernel module? Example below: ( Iam using fedora core 4, I have a working makefile and the .ko files, i did insmod for .ko file, it was fine). Now I am wondering how do I see that message display?. I will use the knowledge from this example and your answers to work on my own modules.

/* hello.c
*
* "Hello, world" - the loadable kernel module version.
*
* Compile this with
*
* gcc -c hello.c -Wall
*/

/* Declare what kind of code we want from the header files */
#define __KERNEL__ /* We're part of the kernel */
#define MODULE /* Not a permanent part, though. */

/* Standard headers for LKMs */
#include <linux/modversions.h>
#include <linux/module.h>

#include <linux/tty.h> /* console_print() interface */

/* Initialize the LKM */
int init_module()
{
console_print("Hello, world - this is the kernel speaking\n");
/* More normal is printk(), but there's less that can go wrong with
console_print(), so let's start simple.
*/

/* If we return a non zero value, it means that
* init_module failed and the LKM can't be loaded
*/
return 0;
}


/* Cleanup - undo whatever init_module did */
void cleanup_module()
{
console_print("Short is the life of an LKM\n");
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top