Skip to content

Instantly share code, notes, and snippets.

@sbourdelin
Last active August 29, 2015 14:21
Show Gist options
  • Save sbourdelin/3b7a64c10f4648377342 to your computer and use it in GitHub Desktop.
Save sbourdelin/3b7a64c10f4648377342 to your computer and use it in GitHub Desktop.
Minimalistic kernel module
obj-m += mykmod.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
#include <linux/module.h>
#include <linux/init.h>
static int __init mykmod_init(void)
{
printk(KERN_INFO "Hello World\n");
return 0;
}
static void __exit mykmod_exit(void)
{
printk(KERN_INFO "Good bye World\n");
}
module_init(mykmod_init);
module_exit(mykmod_exit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment