How to make a built-in device driver in linux

拜拜、爱过 提交于 2019-12-20 07:45:53

问题


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.

How to do that?


回答1:


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.

to illustrate above concept you can try below link for simple helloworld example.

http://www.agusbj.staff.ugm.ac.id/abjfile/Chap8.pdf




回答2:


You have to configure modprobe to load automatically driver after kernel boot. Here an example of configuration.

If you want to a built-in module, you must re-compile the kernel, and set Y in the configuration file on all modules that you want inside the kernel



来源:https://stackoverflow.com/questions/19542631/how-to-make-a-built-in-device-driver-in-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!