开发者

Insert modules (*.ko) that have circular dependencies

开发者 https://www.devze.com 2023-02-21 05:18 出处:网络
I have three Linux kernel modules (*.ko files). They have circular dependencies like this: mod1.ko uses functions exported by mod3.ko

I have three Linux kernel modules (*.ko files). They have circular dependencies like this:

  • mod1.ko uses functions exported by mod3.ko
  • mod2.ko uses functions exported by mod1.ko
  • mod3.ko uses functions 开发者_开发知识库exported by mod1.ko and mod2.ko

I cannot load the first mod1.ko file because of "Unknown symbol" error. I also tried two other methods but I got the same error:

  • load all modules at a time

    insmod mod1.ko mod2.ko mod3.ko
    
  • Put these files in /lib/modules/kernel_version/my_modules, and run

    depmod kernel_version
    modprobe mod3
    

Can anyone help me please! Any suggestions are appreciated. Thanks in advance :)


Well, how about merge those three modules into one?


I encountered the same problem. Merging the modules was not a good solution in my case.

What I eventaully did was to add use callback function instead of the original function. And to registrate the function in the other module using registration routines (need to use function pointer for that).

This has eliminated the dependency between the modules.

You can then insert the non-dependent module first, and the dependent module afterwards.

0

精彩评论

暂无评论...
验证码 换一张
取 消