研究设备驱动程序源文件? [英] Study device driver source files?

查看:97
本文介绍了研究设备驱动程序源文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想研究在树莓派(raspian),beaglebone(debian)或我的笔记本电脑(ubuntu)上安装和加载的某些设备驱动程序的源文件.

I want to study the source files of some of the device drivers that are installed and loaded on either a raspberry pi(raspian), beaglebone(debian) or a my laptop(ubuntu).

我的目的是通过研究一些实际起作用的驱动程序的源文件来学习如何正确实现我自己的模块.

My aim is to learn how to properly implement my own modules by studying the source files of some drivers that actually works.

我对与实际硬件(USB,I2C,SPI,UART等)通信的驱动程序特别感兴趣.

I am particularly interested in drivers that communicates with actual hardware (USB, I2C, SPI, UART etc).

有人可以告诉我如何找到这些资源吗?它们在某个特定的文件夹中是否可用,例如/usr/src/****之类,还是我必须从特定的内核发行版中下载所有内核源文件?

Can someone tell me how to find these sources? are they available in some particular folder i.e something like /usr/src/**** or do I have to download all of the kernel source files from a particular kernel release?

非常感谢所有建议,意见和建议.

All advice's, opinions and recommendations are most appreciated.

p.s我已经阅读了"Linux Kernel Development 3rd Edition",但请告诉我是否 您知道与此主题相关的其他任何免费/开源书籍.

p.s I have read "Linux Kernel Development 3rd edition" but please tell me if you know any other free/open-source books on the subject.

最诚挚的问候 亨里克

推荐答案

Linux源目录和描述:

  • arch/- arch子目录包含所有特定于体系结构的内核代码.

  • arch/ - The arch sub-directory contains all of the architecture specific kernel code.

Example :
1. 'arch/arm/' will have your board related configuration file.
    like 'arch/arm/mach-omap/' will have omap specific source code.
2. 'arch/arm/config' Generates a new kernel configuration with the
    default answer being used for all options. The default values
    are taken from a file located in the arch/$ARCH/defconfig
    file,where $ARCH refers to the specific architecture for which
    the kernel is being built.
3. arch/arm/boot have kernel zImage, dtb image after compilation.

  • 阻止/- 该文件夹包含块设备驱动程序的代码.块设备是按块接收和发送数据的设备.数据块是数据块,而不是连续流.

  • block/ - This folder holds code for block-device drivers. Block devices are devices that accept and send data in blocks. Data blocks are chunks of data instead of a continual stream.

    密码/- 此文件夹包含许多加密算法的源代码.

    crypto/ - This folder contains the source code for many encryption algorithms.

     example, "sha1_generic.c" is the file that contains the code for
               the sha1 encryption algorithm.
    

  • 文档/- 它具有文本格式的内核相关信息.

  • Documentation/ - It has kernel related information in text format.

    驱动程序/-所有系统的设备驱动程序都位于该目录中.它们进一步细分为设备驱动程序类别.

    drivers/ - All of the system's device drivers live in this directory. They are further sub-divided into classes of device driver.

     Example,
     1. drivers/video/backlight/ has blacklight driver source which
        will control display brightness.
     2. drivers/video/display/ has display driver source. 
     3. drivers/input/ has input driver source code. like touch,
        keyboard and mouse driver.
     4. drivers/char/ has charter driver source code.
     5. drivers/i2c/ has i2c subsystem and driver source code.
     6. drivers/pci/ has pci subsytem and driver related source code.
     7. drivers/bluetooth  has Bluetooth driver file.
     8. drivers/power has power and battery driver.
    

  • 固件/- 固件文件夹中包含的代码使计算机可以读取和理解设备的信号.为了进行说明,网络摄像头管理自己的硬件,但是计算机必须了解网络摄像头正在发送计算机的信号.

  • firmware/ - The firmware folder contains code that allows the computer to read and understand signals from devices. For illustration, a webcam manages its own hardware, but the computer must understand the signals that the webcam is sending the computer.

    fs/- 所有文件系统代码.进一步细分为目录,每个受支持的文件系统一个目录,例如vfat和ext2.

    fs/ - All of the file system code. This is further sub-divided into directories, one per supported file system, for example vfat and ext2.

    内核/- 此文件夹中的代码控制内核本身.例如,如果调试器需要跟踪问题,则内核将使用源于此文件夹中源文件的代码来将其执行的所有操作通知调试器.这里也有用于跟踪时间的代码.在内核文件夹中有一个名为"power"的目录.此文件夹中的某些代码为计算机提供了重新启动,关闭电源和挂起的功能.

    kernel/ - The code in this folder controls the kernel itself. For instance, if a debugger needed to trace an issue, the kernel would use code that originated from source files in this folder to inform the debugger of all of the actions that the kernel performs. There is also code here for keeping track of time. In the kernel folder is a directory titled "power". Some code in this folder provide the abilities for the computer to restart, power-off, and suspend.

    网络/- 网 内核的网络代码. LIB 该目录包含内核的库代码.特定于体系结构的库代码可以在arch/*/lib/中找到. 剧本 此目录包含配置内核时使用的脚本(例如awk和tk脚本).

    net/ - net The kernel's networking code. lib This directory contains the kernel's library code. The architecture specific library code can be found in arch/*/lib/. scripts This directory contains the scripts (for example awk and tk scripts) that are used when the kernel is configured.

    lib/- 该目录包含内核的库代码.特定于体系结构的库代码可以在arch/*/lib/中找到.

    lib/ - This directory contains the kernel's library code. The architecture specific library code can be found in arch/*/lib/.

    脚本/- 此目录包含配置内核时使用的脚本(例如awk和tk脚本).

    scripts/ - This directory contains the scripts (for example awk and tk scripts) that are used when the kernel is configured.

    mm/- 该目录包含所有内存管理代码.特定于体系结构的内存管理代码位于arch/*/mm/中,例如arch/i386/mm/fault.c.

    mm/ - This directory contains all of the memory management code. The architecture specific memory management code lives down in arch/*/mm/, for example arch/i386/mm/fault.c.

    ipc/- 该目录包含内核进程间通信代码.

    ipc/ - This directory contains the kernels inter-process communications code.

    ** init/-** init文件夹中包含处理内核启动(INITiation)的代码. main.c文件是内核的核心.这是连接所有其他文件的主要源代码文件.

    **init/ -**The init folder has code that deals with the startup of the kernel (INITiation). The main.c file is the core of the kernel. This is the main source code file the connects all of the other files.

    声音/-这是所有声卡驱动程序所在的地方.

    sound/ - This is where all of the sound card drivers are.

    目录证书,加密,安全性,包含,virt和usr等更多....

    There are few more directory certs, crypto, security, include, virt and usr etc....

    这篇关于研究设备驱动程序源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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