next up previous contents
Next: Kernel Modules Versus Applications Up: Device Drivers Previous: Building and Running Modules   Contents

The Hello World Module

The following code is a complete "hello world" module:
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
    printk(KERN_ALERT "Hello, world\n");
    return 0;
}
static void hello_exit(void)
{
    printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);

next up previous contents
Next: Kernel Modules Versus Applications Up: Device Drivers Previous: Building and Running Modules   Contents
Cem Ozdogan 2007-05-16