Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abhishekjiitr/7b440741c25fa46f99f54623d267c949 to your computer and use it in GitHub Desktop.
Save abhishekjiitr/7b440741c25fa46f99f54623d267c949 to your computer and use it in GitHub Desktop.
Medium Blog Linux Kernel Module Programming Supporting Code
// hello.c
#include <linux/module.h>
#include <linux/kernel.h>
// license for the module. required
MODULE_LICENSE("GPL");
// executed when module is inserted
int init_module(void)
{
printk(KERN_INFO "Hello, World!\n");
return 0;
}
// executed when module is removed
void cleanup_module(void)
{
printk(KERN_INFO "Bye World!\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment