全部博文(478)
分类: Android平台
2016-09-09 19:57:58
一、DTS 学习
1. kernel/arch/arm/boot/dts 目录下包含所有的dts.
a. board , msm8226.dtsi
b. pmic, msm-pm8226.dtsi
2. kernel/Androidkernel.mk; Android makefile to build kernel as a part of Android Build
3. kernel/arch/arm/configs 目录下保存对应的config定义, CONFIG_XXXXXX
4. 可参考 jb-mr1-rhine/kernel/arch/arm/boot/dts/msm8974-rhine_togari_row.dtsi
十、device tree source(DTS)
0. http://devicetree.org/Main_Page
1. *.dts/dtsi 文件一般位于 kernel/arch/arm/boot/dts,比如msm8226-cn3ii.dts msm8226-cn3ii.dtsi
2. 如何决定用那个*.dts文件?
@kernel/arch/arm/mach-msm/Makefile.boot
# MSM8226
zreladdr-$(CONFIG_ARCH_MSM8226) := 0x00008000 //是啥地址?
dtb-$(CONFIG_MACH_SONY_CN3II) += msm8226-cn3ii.dtb
@kernel/arch/arm/configs/cn3ii_defconfig
CONFIG_ARCH_MSM8226=y
CONFIG_MACH_SONY_CN3II=y
3. 编译dts为dtb的工具为DTC,位于kernel/scripts/dtc
hostprogs-y := dtc //@Makefile中,该行表示用hostprogs编译生成dtc
最后生成的dtc可执行文件位于out/target/product/cn3ii/obj/KERNEL_OBJ/scripts/dtc/dtc
4.用dtc编译*.dts生成的*.dtb文件位于
out/target/product/cn3ii/obj/KERNEL_OBJ/arch/arm/boot/msm8226-cn3ii.dtb
存放在手机什么地方?
bootloader如何读取?如何传递给kernel?
head-common.S@kernel\arch\arm\kernel中有
.long __atags_pointer @ r6 //表示保存dtb的地址通过r6传递给kernel
5. kernel中解析DTS
setup_machine_fdt@kernel/arch/arm/kernel/devtree.c
struct boot_param_header *devtree = phys_to_virt(dt_phys); //注意boot_param_header结构
setup_machine_fdt将分析dtb最后所有devices生成树,如何和以前的版本结果就一样了
6. kernel中各个device和driver谁先加载?