Skip to content

Instantly share code, notes, and snippets.

@hnakagawa
Created October 6, 2012 10:09
Show Gist options
  • Save hnakagawa/3844533 to your computer and use it in GitHub Desktop.
Save hnakagawa/3844533 to your computer and use it in GitHub Desktop.
Linux kernel module template(勉強会配布用)
#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);
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
@hnakagawa
Copy link
Author

勉強会配布用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment