[英]Difference between Linux Loadable and built-in modules
What's the difference between loadable modules and built-in (statically linked) modules? 可加载模块和内置(静态链接)模块之间有什么区别?
I got this question while finding out an answer for difference between system calls subsys_initcall()
and module_init()
我在找到系统调用
subsys_initcall()
和module_init()
之间差异的答案时得到了这个问题
Linux kernel supports inserting of modules (aka device drivers) in two ways: Linux内核支持以两种方式插入模块(也称为设备驱动程序):
insmod driver.ko
or modprobe driver.ko
insmod driver.ko
或modprobe driver.ko
插入此模块 The advantage the loadable modules have over the built-in modules is that you can load unload them on run-time. 可加载模块相对于内置模块的优势在于您可以在运行时加载它们。 This is good if you are working on a module and you need to test it.
如果您正在处理模块并且需要测试它,那么这很好。 Every time you test it and you need to make changes to it, you can easily unload it (
rmmod driver.ko
or modprobe -r driver.ko
) and then after making changes, you can insert it back. 每次测试它并且需要对其进行更改时,您可以轻松卸载它(
rmmod driver.ko
或modprobe -r driver.ko
),然后在进行更改后,您可以将其重新插入。 But for the built-in modules if you need to make any changes in the module then you need to compile the whole kernel and then reboot the system with the new image of the kernel. 但是对于内置模块,如果需要在模块中进行任何更改,则需要编译整个内核,然后使用内核的新映像重新引导系统。
Configuration: 组态:
You can configure a module to be either of the two by editing the .config
file in the root folder of your kernel source: 您可以通过编辑内核源根文件夹中的
.config
文件将模块配置为两者之一:
DRIVER_1=y // y indicate a builtin module
DRIVER_1=m //m inicates a loadable module
Note: lsmod
displays only the dynamically loaded modules
not the built-in
ones. 注意:
lsmod
仅显示dynamically loaded modules
而不显示built-in
dynamically loaded modules
。
Read on: http://www.tldp.org/HOWTO/Module-HOWTO/x73.html 请继续阅读: http : //www.tldp.org/HOWTO/Module-HOWTO/x73.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.