问题描述
我知道如何在Linux中制作可加载的内核模块.但是我希望该可加载内核模块成为内核的一部分,并且在启动后,该驱动程序应该像大多数其他通用驱动程序一样自动加载.
I know how to make loadable kernel modules in Linux.But i want that loadable kernel module to be a part of the kernel , and after booting that driver should automatically load, like most of the other general driver.
该怎么做?
推荐答案
有两种查询方法1)构建您的module as statically compiled along with kernel
(您的源代码应驻留在内核树中),因此在构建它作为内核的一部分进行静态构建时,因此,当内核启动时,您的模块将被加载.2)与上述相同,但while building build as dynamic loadable module so that wheneever required you can load it
.
There are two ways to do for your query 1) building your module as statically compiled along with kernel
(your source code should reside in kernel tree ),so while building build it static which come as a part of kernel,so when kernel boots your module will be loaded.2)Same as above but while building build as dynamic loadable module so that wheneever required you can load it
.
为了说明上述概念,您可以在下面的链接中尝试一个简单的helloworld示例.
to illustrate above concept you can try below link for simple helloworld example.
http://www.agusbj.staff.ugm.ac. id/abjfile/Chap8.pdf
这篇关于如何在Linux中制作内置设备驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!