Contact drive for many years, but has not been a systematic induction, now re-start from the simplest Hello world, the following will continue to update the other drivers, all drive TQ2440 Development Board to learn
<span style= "FONT-SIZE:18PX;" >///////////////////////Hello.c/////////////////////////////////</span>
#include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h>module_license ("Dual BSD/GPL "), static int hello_init (void) {PRINTK (kern_alert" Hello world!\n "); return 0;} static void Hello_exit (void) {PRINTK (kern_alert "Good bye!\n");} Module_init (Hello_init); Module_exit (Hello_exit);
makefile///////////////////
Obj-m: = Hello.okernel_dir: =/lib/modules/$ (Shell uname-r)/build#kernel_dir: =/opt/linux-2.6.30.4/pwd: = $ (Shell PWD) a Ll:make-c ${kernel_dir} m=${pwd} modulesclean:rm-rf *.o *.ko
Linux Driver Hello World