Linux 中的设备驱动程序开发

发布于 01-03 13:22 字数 413 浏览 4 评论 0 原文

我打算学习嵌入式linux,编写linux设备驱动。 在阅读了有关设备驱动程序并浏览了一些教程之后,我对用于编译的内核源代码有点困惑。

我使用的是 ubuntu 11.04,在我的 /usr/src/ 中找到以下内容:

tijin@tijin-Vostro-460:/usr/src$ ls

gcc-4.4 linux-headers-2.6.38-10-generic-pae linux-headers-2.6.38-10 linux-headers-2.6.38-8

我的问题:

1)我需要内核源代码来编译驱动程序代码还是标头就足够了?

2)哪里可以获得内核源代码以及安装源代码的步骤是什么。请告诉我详细信息。

I plan to learn embedded linux and writing linux device drivers.
After reading about device drivers and walking through some tutorials, I'm a little confused about the kernel-source that to be used for compilation.

I am using ubuntu 11.04 and in my /usr/src/ me find the following:

tijin@tijin-Vostro-460:/usr/src$ ls

gcc-4.4 linux-headers-2.6.38-10-generic-pae
linux-headers-2.6.38-10 linux-headers-2.6.38-8

my questions:

1)do I need a kernel-source to compile the driver code or the headers are enough?

2)where can I get the kernel source code and what is the procedure to install the source code. Please let me know the details.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无风消散 2025-01-10 13:22:53
  1. 来自 kernel.org的标头就足够了
  2. - 或者对于 Ubuntu 特定内核,请遵循 文档

有关模块编译说明,请参阅这个问题

  1. Headers is enough
  2. from kernel.org - or for Ubuntu specific kernels, follow the documentation

For module compilation instructions, see this question

梅倚清风 2025-01-10 13:22:53
  1. 是的。您不仅需要源代码,还需要“make”源代码(已编译的内核源代码)。 是的

  2. 获取内核源码的主要位置是:http://www.kernel.org

当您使用Ubuntu 您只需从存储库下载源代码即可。
这是 Ubuntu 帮助中指示的页面,作为在 Natty (11.04) 上从源代码编译内核的指南:
http: //blog.avirtualhome.com/2011/08/03/how-to-compile-a-new-ubuntu-11-04-natty-kernel/

  1. Yes. You need not only the source but a "make"d source (a compiled kernel source).

  2. The main location to get the kernel source is: http://www.kernel.org

As you're using Ubuntu you can just download the source from the repositories.
Here's the page indicated at Ubuntu's help as a guide for compiling a kernel from source on Natty (11.04):
http://blog.avirtualhome.com/2011/08/03/how-to-compile-a-new-ubuntu-11-04-natty-kernel/

灼疼热情 2025-01-10 13:22:53

对于较新的设备驱动程序编码“hello world”驱动程序代码参考如下:

"="">http://www.linuxquestions.org/questions/linux-kernel-70/simple-makefile-error-all-nothing-need-to-be-done-600403/ 。
此链接还讨论了与 Makefile 相关的问题。我从参考文献中得到的重要想法是:永远不要复制粘贴文档内容来创建 Makefile。

如果您在查看日志时遇到问题,请参阅链接:

http://www.cyberciti.biz/faq/linux-log-files-location-and-how-do-i-view-logs-files/

谢谢。

For a fresher to device driver coding the "hello world" driver code reference is here :

http://www.linuxquestions.org/questions/linux-kernel-70/simple-makefile-error-all-nothing-need-to-be-done-600403/ .
This link also discussing the issues related to the Makefile. Important idea that i got from the reference is: Never ever copy-paste the content of a document for creating Makefile.

If you are getting trouble with seeing logs then please refer the link :

http://www.cyberciti.biz/faq/linux-log-files-location-and-how-do-i-view-logs-files/

thanks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文