how to add a simple kernel module with customized kernel

hai all,

i followed this link to compile a kernel for bbb
http://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-BasicRequirements

i try to mount my kernel using sd card, after a series of bugs finally i can able to boot my kernel using the precompiled ubuntu rootfs which was given in the above link.
but when i tried to add a hello world module into my bbb . i got the following error
i googled it all the possible ways but none of them helped me .

ubuntu@arm:/opt$ sudo insmod hello.ko
Error: could not insert module hello.ko: Invalid module format

ubuntu@arm:/opt$

when i execute modinfo command from the bbb. i got the following log information

ubuntu@arm:/opt$ modinfo hello.ko

filename: /opt/hello.ko
description: A Simple Hello World module
author: sivakumar
license: GPL
srcversion: F545620F75762B1AAE668ED
depends:
vermagic: 3.8.13 SMP mod_unload modversions ARMv7 p2v8

help me how to insert the module into my beagelobne black kernel.

regards
siva

What kind of kernel did you build? My stock kernel is “Thumb2” so modinfo shows:

vermagic: 3.8.13-bone41 SMP mod_unload modversions ARMv7 thumb2 p2v8

If your kernel is Thumb2, then your module needs to be Thumb2, also.

mark@p3d:/lib/modules/3.8.13-bone41/kernel/drivers% zcat /proc/config.gz | grep -i thumb
CONFIG_ARM_THUMB=y
CONFIG_ARM_THUMBEE=y
CONFIG_THUMB2_KERNEL=y
CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11=y
CONFIG_XZ_DEC_ARMTHUMB=y

Mark

hai,
i used the kernel

ubuntu@arm:/proc$ uname -ar
Linux arm 3.12.13-bone12 #1 SMP Thu Mar 20 04:17:43 IST 2014 armv7l armv7l armv7l GNU/Linux

ubuntu@arm:/proc$ zcat /proc/config.gz | grep -i thumb

CONFIG_ARM_THUMB=y
CONFIG_ARM_THUMBEE=y
# CONFIG_THUMB2_KERNEL is not set
CONFIG_XZ_DEC_ARMTHUMB=y
ubuntu@arm:/proc$

is Thumb2 option to be enabled or not necessary …
regards
siva

i noticed one more difference (mistake) from my side

ubuntu@arm:/opt$ modinfo -F vermagic hello.ko
3.8.13 SMP mod_unload modversions ARMv7 p2v8

ubuntu@arm:/opt$ uname -r
3.12.13-bone12
ubuntu@arm:/opt$

i compiled the module against the 3.8.13 kernel !! might be this cause the issue. .i will try to resolve the issue