I have make an HelloWorld kernel module like that :

 *# cd * 

*# mkdir Modules && cd Modules*

*# nano ModHello.c*



 #include <linux/module.h> /* Needed by all modules */

#include <linux/kernel.h> /* Needed for KERN_INFO */

#include <linux/init.h> /* Needed for the macros */


 static int __init hello_start*(*void*)*

*{*

printk*(*KERN_INFO "Loading HelloWorld module...\n"*);*

printk*(*KERN_INFO "*** Hello world :-) ***\n"*);*

*return* 0*;*

*}*


 static void __exit hello_end*(*void*)*

*{*

printk*(*KERN_INFO "GoodbyeWorld...\n"*);*

*}*


 module_init*(*hello_start*);*

module_exit*(*hello_end*);*



 *# make ARCH=arm CROSS_COMPILE= 
gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf- 
-o ModHello ModHello.c*


 *# scp ModHello.ko r...@xxx.xxx.xxx.xxx:/root/modules*


 *# cd /root/modules*

*# insmod ModHello.ko*

*# lsmod*

Module      Size Used by

ModHello  832   0


 *# dmesg | tail*

[ 2599.602704] Loading HelloWorld module...

[ 2599.602749] *** Hello world  ***


 *# rmmod*

*# dmesg | tail*

[ 2757.354253] GoodbyeWorld...


Good Luck :)

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to