Install pcduino-linux-headers-3.4.79+ and compile
driver on pcDuino
1 ) uncomment 2 wiimu source
$ sudo nano /etc/apt/sources.list
$ sudo apt-get update $ sudo apt-get install pcduino-linux-headers-3.4.79+
2) make new directory and write a test driver
$ mkdir hello && cd hello && cat > hello.c << EOF #include <linux/init.h> #include <linux/module.h> static int pcduino_hello_init(void) { printk("Hello, pcDuino\n"); return 0; } static void pcduino_hello_exit(void) { printk("Bye, pcDuino\n"); } MODULE_LICENSE("GPL"); MODULE_AUTHOR("pcDuino Team"); module_init(pcduino_hello_init); module_exit(pcduino_hello_exit); EOF
b) write Makefile
$ cat > Makefile << EOF obj-m = hello.o EOF
2) compile and run test driver
a) compile
$ make M=`pwd` -C /usr/src/linux-headers-3.4.29+
b) load driver
$ sudo insmod hello.ko
you can see the debug message by:
$ sudo dmesg | tail -n 1 [ 16915.209465] Hello, pcDuino
c) unload driver
$ sudo rmmod hello.ko
you can see the debug message by:
$ sudo dmesg | tail -n 1 [ 16928.689917] Bye, pcDuino
Leave a Reply
You must be logged in to post a comment.