linux开发摘要

1.linux内核文档连接点击打开连接linux

2.配置文件ide

在out\target\product\project\obj\KERNEL_OBJ\.config中能够看到函数

 

[plain]  view plain  copy
 
 在CODE上查看代码片派生到个人代码片
  1. # CONFIG_MTD_LPDDR is not set  
  2. # CONFIG_MTD_UBI is not set  
  3. CONFIG_DTC=y  
  4. CONFIG_OF=y  
  5.   
  6.   
  7. #  
  8. # Device Tree and Open Firmware support  
  9. #  
  10. # CONFIG_PROC_DEVICETREE is not set  
  11. # CONFIG_OF_SELFTEST is not set  
  12. CONFIG_OF_FLATTREE=y  
  13. CONFIG_OF_EARLY_FLATTREE=y  
  14. CONFIG_OF_ADDRESS=y  
  15. CONFIG_OF_IRQ=y  
  16. CONFIG_OF_DEVICE=y  
  17. CONFIG_OF_I2C=y  
  18. CONFIG_OF_NET=y  
  19. CONFIG_OF_MDIO=y  
  20. CONFIG_OF_SPMI=y  
  21. CONFIG_OF_MTD=y  
  22. CONFIG_OF_SLIMBUS=y  
  23. CONFIG_OF_BATTERYDATA=y  
  24. CONFIG_OF_RESERVED_MEM=y  
  25. ...  

但这个文件是自动生成的,应该主要是由\kernel\arch\arm\configs下的文件汇总的,可是没有找到定义CONFIG_OF=y的源头。ui

对于msm8909平台user版本,.config文件是由msm8909-1gb_defconfig、kernel下Kconfig文件内容汇总在一块儿。每一个Kconfig分别描述了所属目录源文件相关的内核配置菜单spa

但若是msm8909-1gb_defconfig注释了#CONFIG_QPNP_VM_BMS=y,但W:\kernel\drivers\power\Kconfig下对应的下有default=y,最后是以Kconfig的为准的操作系统

config QPNP_VM_BMS
tristate "QPNP Voltage-Mode Battery Monitoring System driver"
depends on SPMI
depends on MSM_QPNP_INT
default y
help
  Say Y here to enable support for QPNP chip vm-bms device.
  The voltage-mode (vm) BMS driver uses periodic VBATT
  readings from the battery to calculate the State of
  Charge..net

若是Kconfig没有default,msm8909-1gb_defconfig的为#CONFIG_QPNP_VM_BMS=y或是CONFIG_QPNP_VM_BMS=,也就是没有选择或是没有设置,就在.config文件中插入一行注释# CONFIG_QPNP_VM_BMS is not setcode

3.主要的设备树文件orm

 \kernel\Documentation\devicetree\bindings\fb\mdss-dsi-panel.txt描述显示屏panel的配置信息
kernel\Documentation\devicetree\bindings\arm\gic.txt-----ARM Generic Interrupt Controller,ARM通常中断控制器设备树信息描述
kernel\Documentation\devicetree\bindings\interrupt-controller\interrupts.txt----Specifying interrupt information for devicesblog

 \kernel\Documentation\input\input.txt和input-programming.txt介绍输入子系统

\kernel\Documentation\devicetree\bindings\pinctrl\msm-pinctrl.txt------------MSM TLMM pinmux controller

kernel\Documentation\devicetree\bindings\pinctrl\pinctrl-bindings.txt

 

4..CONFIG_OF

在一些驱动中常常看到#ifdef CONFIG_OF,这里的OF是Open Firmware。

Open Firmware. This was invented long time ago when Apple was producing laptops based on PowerPC CPUs. Openfirmware provides a good description of the devices connected to the platform. In Linux kernel the part that works with device data is called Device Tree (DT). More details in the Usage model.

详细参考kernel\Documentation\devicetree\usage-model.txt

 

5.mk文件(makefile)

 

 += (在现有的文件上,追加)
:= (以前的值清空,从新赋值)

 

6.fdt:flatteneddevice tree

 

7.modules.order:这个文件记录了Makefile中模块出现的顺序。modprobe经过它来肯定解决多个模块匹配的别名(指定模块的绝对路径)。
如:kernel//home/cjz/Desktop/test/driver/input/vms.ko
 modules.builtin:这个文件列出了全部编译到内核的模块,经过这个当modprobe加载一些内核模块时就不会失败。

 

8.注册驱动的时候,经过对应的总线匹配到对应的设备,设备在设备树中有对应的描述,在bootloader阶段会传递设备树内容给内核,匹配到对应的设备后调用驱动的probe函数

设备树中每一个表示一个设备的节点都须要一个 compatible 属性。compatible 属性是操做系统用来决定使用哪一个设备驱动来绑定到一个设备上的关键因素

 

9.典型的外设、核心和主机驱动图

10.设备树英文文档连接点击打开连接

11.驱动加载顺序

优先级定义在include/linux/init.h,其中对于同一级别的 __initcall的次序 主要由MakeFile中.o文件的连接次序决定,具体看Kernel下的主Makefile ---- Build vmlinux以及kernel/driver 下的obj-y

12.linux为何要挂载到/mnt或其它目录,直接访问/dev不行吗?

/dev是不加文件系统的,只能经过read/write命令对他进行读写。可是你看不到的。想要看到他里面有那个文件或者文件夹,只有加载了文件系统,才能够。因此你用mount命令的时候要加-t指定文件系统,例如:mount -t vfat /dev/hda1 /mnt,挂载/dev/hda1设备到/mnt,文件系统是vfat。

相关文章
相关标签/搜索