Created
September 1, 2018 15:51
-
-
Save Tosainu/7e6117a26dc37f0a9ce90b1907ed8efc to your computer and use it in GitHub Desktop.
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/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); |
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
EXTRA_CFLAGS = -Wall -g | |
obj-m = hello.o |
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
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