《Linux Kernel and Driver Development Training》笔记

本文详细介绍了Linux内核源码查看方法、配置流程及其相关文件存放位置,包括客户端方式、Web方式查看源码,配置工具的使用与注意事项,以及内核配置后各文件的具体存放路径。

附件是一篇介绍linux内核和驱动的英文slides,简明扼要,相比厚重的书籍更能突出重点,以下是基于该slides的一些笔记

 

linux内核源码查看(参考P59-P62)

1. 客户端方式:可利用Ubuntu12.04及之后版本自带的Kscope工具

2. Web方式:使用lxr(linux cross reference),登录http://lxr.free-electrons.com可直接使用而无需自行配置lxr。

 

linux内核配置(参考P71-P77):

1. make xconfig,图形化配置,支持全局搜索和将缺失依赖项的item显示为灰色,使用需安装libqt4-dev g++

2. make gconfig,图形化配置,不支持搜索功能,使用需安装libglade2-dev

3. make menuconfig,使用需安装libncurses-dev

注:使用上述命令配置完成之后,都会自动生成一个.config.old文件,其作用是当新的配置不正确时,可通过cp .config.old .config命令来恢复之前的配置。但是,如果是手动方式更改的.config文件,就需要自行调用make oldconfig命令来生成.config.old文件

 

根文件系统中的内核相关文件(参考P93-P95)

1.内核默认配置文件在内核源码中的arch/<arch>/configs/,生成后的配置文件在根文件系统中的位置为/boot/config-<version>

2. 生成后的内核镜像在根文件系统中的位置为/boot/vmlinuz-<version>

3. 在内核配置时选择以module方式编译的,其在根文件系统中的位置为/lib/modules/<version>/

4. 内核源码在根文件系统中的位置为/usr/src/<version>

 

编译模块时,使用“make -C (KDIR) M=$(PWD)”脚本,其中KDIR为内核源码目录,该脚本实际是借助了KDIR里的Makefile,并通过M参数让内核知晓其为模块,该内核必须是经过配置的,且还需调用make modules_param为模块编译做好准备(参考P127-P128)

 

借助内核版本X编译出的模块不能再内核版本Y的系统上运行,否则会报错“Invalid module format”(参考P129)

Linux Driver Development for Embedded Processors – Second Edition 版本: Learn to develop Linux embedded drivers with kernel 4.9 LTS The flexibility of Linux embedded, the availability of powerful, energy efficient processors designed for embedded computing and the low cost of new processors are encouraging many industrial companies to come up with new developments based on embedded processors. Current engineers have in their hands powerful tools for developing applications previously unimagined, but they need to understand the countless features that Linux offers today. This book will teach you how to develop device drivers for Device Tree Linux embedded systems. You will learn how to write different types of Linux drivers, as well as the appropriate APIs (Application Program Interfaces) and methods to interface with kernel and user spaces. This is a book is meant to be practical, but also provides an important theoretical base. More than twenty drivers are written and ported to three different processors. You can choose between NXP i.MX7D, Microchip SAMA5D2 and Broadcom BCM2837 processors to develop and test the drivers, whose implementation is described in detail in the practical lab sections of the book. Before you start reading, I encourage you to acquire any of these processor boards whenever you have access to some GPIOs, and at least one SPI and I2C controllers. One of the boards used to implement the drivers is the famous Raspberry PI 3 Model B board. You will learn how to develop drivers, from the simplest ones that do not interact with any external hardware, to drivers that manage different kind of devices: accelerometers, DACs, ADCs, RGB LEDs, Multi-Display LED controllers, I/O expanders, and Buttons. You will also develop DMA drivers, drivers that manage interrupts, and drivers that write/read on the internal registers of the processor to control external devices. To easy the development of some of these drivers, you will use different types of Frameworks: Miscellaneous framework, LED framework, UIO framework, Input framework and the IIO industrial one. This second edition has been updated to the v4.9 LTS kernel.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值