定制mod。名Linux内核模块中的c MODULE_ALIAS

时间:2023-02-06 12:22:42

I need to modify a kernel module located in Linux 3.2.0. Within drivers/staging/bcm, the driver should support the device id 198F:015E, instead in the InterfaceInit.h file, it was mentioned as 198F:15E, I changed that to 015E but still, after successful compilation, the new device id's are not being picked up by the kernel.

我需要修改位于Linux 3.2.0中的内核模块。在驱动器/分段/bcm中,驱动程序应该支持设备id 198F:015E,而不是在InterfaceInit中。h文件,上面提到的是198F:15E,我把它改成了015E,但是编译成功后,内核并没有接收到新的设备id。

Here is the output of modinfo:

这是modinfo的输出:

filename:       <somewhere/>bcm_wimax.ko
license:        GPL
version:        5.2.45
description:    Beceem Communications Inc. WiMAX driver
srcversion:     D6016018ABCFFD16AF31D22
alias:          usb:v19D2p0007d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0489pE017d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v19D2p0132d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v198FpBCCDd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v198Fp0220d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v198Fp0210d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v198Fp0300d*dc*dsc*dp*ic*isc*ip*
depends:        
vermagic:       3.2.0-26-generic-pae SMP mod_unload modversions 686 
parm:           debug:Debug level (0=none,...,16=all) (uint)

My 198F:015E is still not appearing! Strangely after beginning the compilation, I can see a file called bcm_wimax.mod.c getting generated inside the module source folder. Inside that, I found out the modinfo alias thing. Which looks like:

我的198F:015E还没有出现!奇怪的是,在开始编译之后,我可以看到一个名为bcm_wimax.mod的文件。c在模块源文件夹中生成。在里面,我找到了莫丁佛别名。这看起来像:

 #include <linux/module.h>
 #include <linux/vermagic.h>
 #include <linux/compiler.h>

 MODULE_INFO(vermagic, VERMAGIC_STRING);

 struct module __this_module
 __attribute__((section(".gnu.linkonce.this_module"))) = {
  .name = KBUILD_MODNAME,
  .init = init_module,
 #ifdef CONFIG_MODULE_UNLOAD
  .exit = cleanup_module,
 #endif
  .arch = MODULE_ARCH_INIT,
 };

 MODULE_INFO(staging, "Y");

 static const struct modversion_info ____versions[]
 __used
 __attribute__((section("__versions"))) = {
 };

 static const char __module_depends[]
 __used
 __attribute__((section(".modinfo"))) =
 "depends=";

 MODULE_ALIAS("usb:v198Fp0300d*dc*dsc*dp*ic*isc*ip*");
 MODULE_ALIAS("usb:v198Fp0210d*dc*dsc*dp*ic*isc*ip*");
 MODULE_ALIAS("usb:v198Fp0220d*dc*dsc*dp*ic*isc*ip*");
 MODULE_ALIAS("usb:v198FpBCCDd*dc*dsc*dp*ic*isc*ip*");
 MODULE_ALIAS("usb:v19D2p0132d*dc*dsc*dp*ic*isc*ip*");
 MODULE_ALIAS("usb:v0489pE017d*dc*dsc*dp*ic*isc*ip*");
 MODULE_ALIAS("usb:v19D2p0007d*dc*dsc*dp*ic*isc*ip*");

 MODULE_INFO(srcversion, "D6016018ABCFFD16AF31D22");

But I tried to modify bcm_wimax.mod.c but after compiling, the file got reverted back to it's original condition, removing my edits. How can I get to add my 198f:015e to the module alias section?

但是我试图修改bcm_wimax.mod。但是编译之后,文件又恢复到原来的状态,删除了我的编辑。如何将198f:015e添加到模块别名部分?

1 个解决方案

#1


2  

198F:015E is the same as 198F:15E

198F:015E与198F:15E相同

Looking at the kernel source it seems you are interested in BCM_USB_PRODUCT_ID_SYM, but the device is not present in InterfaceUsbtable drivers/staging/bcm/InterfaceInit.c.

查看内核源代码,您似乎对BCM_USB_PRODUCT_ID_SYM感兴趣,但是设备并不存在于InterfaceUsbtable驱动程序/staging/bcm/InterfaceInit.c中。

You can add it and hope the driver support that device as well.

您可以添加它,并希望驱动程序也支持该设备。

#1


2  

198F:015E is the same as 198F:15E

198F:015E与198F:15E相同

Looking at the kernel source it seems you are interested in BCM_USB_PRODUCT_ID_SYM, but the device is not present in InterfaceUsbtable drivers/staging/bcm/InterfaceInit.c.

查看内核源代码,您似乎对BCM_USB_PRODUCT_ID_SYM感兴趣,但是设备并不存在于InterfaceUsbtable驱动程序/staging/bcm/InterfaceInit.c中。

You can add it and hope the driver support that device as well.

您可以添加它,并希望驱动程序也支持该设备。