Skip to content

Instantly share code, notes, and snippets.

@HungMingWu
Created October 23, 2011 09:05
Show Gist options
  • Save HungMingWu/1307133 to your computer and use it in GitHub Desktop.
Save HungMingWu/1307133 to your computer and use it in GitHub Desktop.
Linux Driver: Example0
#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);
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