modprobe与depmod

本文发布时间: 2019-Mar-22
1.modprobemodprobe - program to add and remove modules from the Linux Kernelmodprobe和insmod类似,是用来动态加载模块的,区别在于modprobe可以解决load module时的依赖关系,它是通过/lib/modules/<kernel-version>/modules.dep(.bb)文件来查找依赖关系的;而insmod不能解决依赖问题。如有2个模块g_file_storage.ko和udc.ko,g_file_storage.ko依赖于udc.ko,在加载g_file_storage.ko前必须先加载udc.ko,如果使用insmod加载,必须按顺序一个一个加载:insmod udc.koinsmode g_file_storage.ko file=/dev/mtdblock3如果使用modprobe加载则执行:modprobe g_file_storage file=/dev/mtdblock3/*此处的加载对象写为g_file_storage,非g_file_storage.ko*/PS:modules.dep(.bb)文件内容如下:g_file_storage.koudcudc.ko symbol:usb_gadget_unregister_driver symbol:usb_gadget_register_driver2.depmoddepmod - program to generate modules.dep and map files当把模块文件放到/lib/module/`uname -r`/目录下,运行depmod,则会在/lib/modules/<kernel-version>/目录下生成modules.dep(.bb)文件,表明了模块的依赖关系3. 对于在使用"modprobe xxx"动态加载过程中出现“modprobe XXX not found”若出现此问题,需确认:1. modules.dep(.bb)文件是否生成,若没有,则可以运行depmod,生成此依赖关系文件2. 若有依赖关系文件,仍出现此问题,把modprobe xxx.ko改为执行modprobe xxx


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:11pm
栏目列表