Created
October 6, 2012 10:09
-
-
Save hnakagawa/3844533 to your computer and use it in GitHub Desktop.
Linux kernel module template(勉強会配布用)
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/kernel.h> | |
static int example_init(void) | |
{ | |
printk(KERN_INFO"example is loaded\n"); | |
return 0; | |
} | |
static void example_exit(void) | |
{ | |
printk(KERN_INFO"example is unloaded\n"); | |
} | |
MODULE_LICENSE("GPL"); | |
module_init(example_init); | |
module_exit(example_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
KERNEL ?= /usr/src/linux | |
PWD := $(shell pwd) | |
obj-m := example.o | |
all: | |
make -C $(KERNEL) M=$(PWD) modules | |
clean: | |
rm -f *.o *.ko *.mod.c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
勉強会配布用