Skip to content

Instantly share code, notes, and snippets.

@vppillai
Created October 10, 2013 10:42
Show Gist options
  • Save vppillai/6916450 to your computer and use it in GitHub Desktop.
Save vppillai/6916450 to your computer and use it in GitHub Desktop.
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>
MODULE_LICENSE("GPL"); /*else kernel complaints about kernel taint*/
int simple_init(void)
{
printk(KERN_ALERT"Hello kernel space world\n"); /*Kernel mode printf - messages appear in /var/log/messages . or use command dmesg | tail*/
return 0;
}
int simple_exit(void)
{
printk(KERN_ALERT"Bye bye kernel world\n");
return 0;
}
module_init(simple_init); /* register the module init function to be executed on insmod*/
module_exit(simple_exit); /* register the module cleanup/exit function to be executed on rmmod*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment