Created
October 23, 2011 09:05
-
-
Save HungMingWu/1307133 to your computer and use it in GitHub Desktop.
Linux Driver: Example0
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/init.h> | |
#include <linux/module.h> | |
MODULE_LICENSE("GPL"); | |
static int __init init_modules(void) | |
{ | |
printk("hello world\n"); | |
return 0; | |
} | |
static void __exit exit_modules(void) | |
{ | |
printk("goodbye\n"); | |
} | |
module_init(init_modules); | |
module_exit(exit_modules); |
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
mname := brook | |
$(mname)-objs := main.o | |
obj-m := $(mname).o | |
KERNELDIR := /lib/modules/`uname -r`/build | |
all: | |
$(MAKE) -C $(KERNELDIR) M=`pwd` modules | |
clean: | |
$(MAKE) -C $(KERNELDIR) M=`pwd` clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment