• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinokernel and ubootInstall pcduino-linux-headers-3.4.79+ and compile ...
Previous Next

Install pcduino-linux-headers-3.4.79+ and compile driver on pcDuino

Posted by: Yang , July 9, 2014

 Install pcduino-linux-headers-3.4.79+ and compile

 driver on pcDuino

1 ) uncomment 2 wiimu source

$ sudo nano /etc/apt/sources.list

 

2014-07-09-054424_660x464_scrot

$ 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

2014-07-09-054027_660x464_scrot 2014-07-09-054601_1280x696_scrot

Tags: kernel and uboot

Share!
Tweet

Yang

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors