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

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

问题描述

我想研究在 raspberry pi(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/ - 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/- 所有系统的设备驱动程序都位于此目录中.它们进一步细分为设备驱动程序类.

    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.

    净/-网内核的网络代码.库该目录包含内核的库代码.架构特定的库代码可以在 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.

    毫米/-这个目录包含所有的内存管理代码.架构特定的内存管理代码位于 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/- 这是所有声卡驱动程序所在的位置.

    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天全站免登陆