Linux内核/驱动程序开发的新手 [英] New to Linux Kernel/Driver development

查看:124
本文介绍了Linux内核/驱动程序开发的新手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我开始开发运行linux的嵌入式设备的驱动程序.

Recently, i began developing a driver of an embedded device running linux.

直到现在,我只有阅读关于linux内部的知识.
没有驾驶员发展经验,我很难踏出第一步.

Until now i have only read about linux internals.
Having no prior experience in driver devlopment, i am finding it a tad difficult to land my first step.

  • 我已经下载了内核源代码(v2.6.32).
  • 我已阅读(略过)Linux设备驱动程序(3e)
  • 我在此处阅读了StackOverflow上的一些相关文章.
  • 我了解linux具有整体"方法.
  • 我已经构建了内核(menuconfig等文件中包含了现有的驱动程序)
  • 我知道kconfig和makefile文件的基础知识,所以应该不会有问题.

有人可以描述结构(即链接)吗?
内核源代码中的各个目录.

Can someone describe the structure (i.e. the inter-links)
of the various directories in the kernel-source code.

换句话说,给定一个源代码文件,
它将为相关代码引用哪些其他文件

In other words, given a source-code file,
which other files would it refer to for related code

(#include"-提供了部分概念)

(The "#include"-s provide a partial idea)

有人可以帮助我获得更好的主意吗?
任何帮助将不胜感激

Could someone please help me in getting a better idea?
Any help will be greatly appreciated

谢谢.

推荐答案

给出一个C文件,您必须查看它调用的功能和它使用的数据结构,而不用担心特定的文件.

Given a C file, you have to look at the functions it calls and data structures it uses, rather than worrying about particular files.

开发自己的设备驱动程序有两种基本方法:

There are two basic routes to developing your own device driver:

  • 采用与您相似的驱动程序;删除不适用于您设备的代码,然后为您的设备填写新代码.
  • 从设备驱动程序的最基本部分开始,然后每次添加一点,直到您的设备开始运行.

完成此过程后,组成驱动程序的文件将更有意义.一定要考虑每个文件中的内容,但是在某种程度上,在文件之间划分驱动程序不是一门科学,而是一门艺术.较小的驱动程序通常只能容纳一个或两个文件.

The files that compose your driver will make more sense as you complete this process. Do consider what belongs in each file, but to some extent, dividing a driver among files is more an art than a science. Smaller drivers often fit into just one or two files.

有些设计可能也不错.考虑设备的功能以及驱动程序需要执行的操作.基于此,您应该能够确定设备驱动程序将需要具备的功能.

A bit of design may also be good. Consider what you device does, and what your driver will need to do. Based on that, you should be able to map out what functions a device driver will need to have.

我还相信 Linux设备驱动程序,第三版可以帮助您逐步进行驱动程序开发

I also believe Linux Device Drivers, Third Edition may help you get on your way to driver development.

Linux文件本身包括基于它们的工作,它们位于哪个层以及它们对调用堆栈的访问层的文件.大图真实地告知了每个文件与下一个文件的关系.

Linux files themselves include files based on what they do, what layer they are in, and what layer they access of the call stack. The Big Picture truly informs how each file is related to the next.

这篇关于Linux内核/驱动程序开发的新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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