当前位置: 动力学知识库 > 问答 > 编程问答 >

Add insmod Kernel HID module

问题描述:

I made certain modifications in hid module.

I can make it and load (insmod) it on kernel v 2.6.27.14 sucessfully

Now I am willing to load the same kernel module on kernel v 2.6.27.11

As there is no differance in the kerbel source files for both the kernel versions

I can make it sucessfully, but I cannot add / insmod in this .11 kernel version

**

 ERROR: Module myhid does not exist in /proc/modules

insmod: error inserting 'myhid.ko': -1 Invalid module format

**

Regards,

网友答案:

You can't load a module compiled for another kernel version. That the source code of the module did not change does not mean that the binary will be the same for another kernel version. Any interface change of kernel internal APIs (even when not directly visible) will break the module...

Therefore, the kernel stays on the safe side by disallowing loading of modules that were built for another kernel version. Alternatively, you can set the MODVERSIONS configuration option when building your kernel. This will embed version information into all symbols used by your module and with luck you can load it on another kernel version.

If any interface used by your module changed, the result will be the same though.

网友答案:

see what "modinfo" tells you about your module:

Check that it's compiled properly, linked to the right kernel.

$ modinfo hid
filename:       /lib/modules/2.6.27.7/kernel/drivers/hid/hid.ko
license:        GPL
depends:        
vermagic:       2.6.27.7 mod_unload 486 
parm:           pb_fnmode:Mode of fn key on Apple keyboards (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst) (int)

When you compile/install modules, don't forget that you have to run "depmod" (as root) to rebuild the modules dependancies before running insmod/modprobe.

网友答案:

Thanks ! Here is the make file . I dowload all the dependent source files for HID.O and rename them

MAKEFILE

obj-m := myhid.o

myhid-objs := my-hiddraw.o my-hid-core.o my-hid-input.o my-hid-input-quirk.o

KDIR := /lib/modules/$(shell uname -r)/build

PWD := $(shell pwd)

default:

$(MAKE) -C $(KDIR) M=$(PWD) modules
分享给朋友:
您可能感兴趣的文章:
随机阅读: