Module driver "hello" for beagleboard

Hi all.
I am beginner with beagleboard.
I trying write driver “hello” for beagleboard but it not load in the kernel when i run command:
root@linaro:/lib/modules/2.6.38.7/kernel/drivers/mydrivers# insmod ./hello.ko
insmod: error inserting ‘./hello.ko’: -1 Invalid module format
I run command:
root@linaro:~# modprobe hello
FATAL: Module hello not found.
I have ALIP running on beagleboard, i use source code linux 2.6.38.7.
Help me solve this problem.
Thank all.
Best Regards.
Hien Nguyen

Be in the folder where hello.ko is present. Then try insmod ./hello.ko

For using modprobe first do depmod, then I think u can use modprobe for your local module.

I used modprobe hello but it not success.

2012/10/16 @ksonly@ks <aksonlyaks@live.com>

Yaa… modprobe will not work directly. You first try insmod ./hello.ko

For modprobe you need to run command: depmod

Then modprobe can work.

Regards

Abhi

Hello

to be sure that you have cross compiled module for hello.ko

I used cross_compile:arm-linux-gnueabi- to compile modules driver

  • Source code hello.c:
    #include <linux/module.h> // modules
    #include <linux/kernel.h> // KERN_INFO
    #include <linux/init.h> // macros

static int __init hello_start(void)
{

printk(KERN_INFO “***********************************\n”);

printk(KERN_INFO “Loading my first kernel driver…\n”);

printk(KERN_INFO “Welcome to the hello driver\n”);

printk(KERN_INFO “***********************************\n”);

return 0;

}

static void __exit hello_end(void)
{

printk(KERN_INFO “***********************************\n”);

printk(KERN_INFO “Unloading hello…\n”);

printk(KERN_INFO “***********************************\n”);

}

MODULE_AUTHOR(“bb”);
//Defining the function that will be called when the module is loaded
module_init(hello_start)

//Defining the function that will be called when the module is unloaded
module_exit(hello_end)

  • Makefile:

obj-m := hello.o

Help me solve it.Thank you very much