Skip to content

Instantly share code, notes, and snippets.

@Tosainu
Created September 1, 2018 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tosainu/7e6117a26dc37f0a9ce90b1907ed8efc to your computer and use it in GitHub Desktop.
Save Tosainu/7e6117a26dc37f0a9ce90b1907ed8efc to your computer and use it in GitHub Desktop.
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
MODULE_DESCRIPTION("My first kenel module!");
MODULE_AUTHOR("Kensta Sato <tosainu.maple@gmail.com>");
MODULE_LICENSE("GPL");
static int hello_init(void) {
printk("Hello, World!\n");
return 0;
}
static void hello_exit(void) {
printk("bye!");
}
module_init(hello_init);
module_exit(hello_exit);
EXTRA_CFLAGS = -Wall -g
obj-m = hello.o
KDIR = /lib/modules/`uname -r`/build
kbuild:
make -C $(KDIR) M=`pwd`
clean:
make -C $(KDIR) M=`pwd` clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment