如何在Linux中制作内置设备驱动程序 [英] How to make a built-in device driver in linux

查看:130
本文介绍了如何在Linux中制作内置设备驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何在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中制作内置设备驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆