Last active
August 29, 2015 14:21
-
-
Save sbourdelin/3b7a64c10f4648377342 to your computer and use it in GitHub Desktop.
Minimalistic kernel module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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