Step 1: OEMs can create their own device tree by adding "qcom,msm-id/qcom,board-id" entry at the top of their file. The hardware variant ID has to be unique and created by the OEMs. Please refer to slides 10-13 in doc # 80-ND928-80

,
  DALCHIPINFO_ID_MSM8226    = 158,

boot_images\core\api\systemdrivers\DDIPlatformInfo.h
  ...
  DALPLATFORMINFO_TYPE_CDP          = 0x01, /**< Target is a MSM CDP/SURF device. */
  DALPLATFORMINFO_TYPE_MTP_MSM      = 0x08,  /**< Target is a MSM MTP device. */
  DALPLATFORMINFO_TYPE_QRD          = 0x0B,  /**< Target is a QRD device. */

DT Header

About dt.img format, please refer to dtbtool.txt and bootable\bootloader\lk\platform\msm_shared\smem.h
kernel\arch\arm\boot\dts\msm8226-cdp.dts
    model = "Qualcomm MSM 8226 CDP";
    compatible = "qcom,msm8226-cdp", "qcom,msm8226", "qcom,cdp";
    qcom,msm-id = <145 1 0>;
kernel\arch\arm\boot\dts\msm8226-mtp.dts
    model = "Qualcomm MSM 8226 MTP";
    compatible = "qcom,msm8226-mtp", "qcom,msm8226", "qcom,mtp";
    qcom,msm-id = <145 8 0>;
kernel\arch\arm\boot\dts\msm8226-qrd.dts
    model = "Qualcomm MSM 8226 QRD";
    compatible = "qcom,msm8226-qrd", "qcom,msm8226", "qcom,qrd";
    qcom,msm-id = <145 11 0>;

kernel\arch\arm\boot\dts\msm8916-qrd-skuh.dts
    model = "Qualcomm Technologies, Inc. MSM 8916 QRD SKUH";
    compatible = "qcom,msm8916-qrd-skuh", "qcom,msm8916-qrd", "qcom,msm8916", "qcom,qrd";
    qcom,board-id = <0x1000b 0> , <0x1000b 4>;
    
    Notes: Here subtype = 0/4; major version= 01 minor version = 00, platform type = 0b

CDT Description XML

boot_images\core\boot\secboot3\scripts\jedec_lpddr2_single_channel.xml
      <device id="cdb0">
        <props name="platform_id" type="DALPROP_ATTR_TYPE_BYTE_SEQ">
         
          0x03, 0x00, 0x00, 0x00, 0x00, 0x00, end
       
        </props>
      </device>

Example of 8x26 device
CDP:
0x03, 0x01, 0x01, 0x00, 0x00, 0x00, end
MTP:
0x03, 0x08, 0x01, 0x00, 0x00, 0x00, end
QRD:
0x03, 0x0B, 0x01, 0x00, 0x00, 0x00, end

Example of 8916 device
QRD SKUH:
0x03, 0x0B, 0x01, 0x00, 0x04, 0x00, end

Byte 0: platform_id Version
Byte 1: platform_id type:
           0x01: Target is a SURF device
           0x08: Target is a MTP device
           0x0B: Target is a QRD device
Byte 2: platform_id major platform version
Byte 3: platform_id minor platform version
Byte 4: platform_id subtype

What's you need do?

Generate CDT image and boot_cdt_array.c

  • cd boot_images\core\boot\secboot3\scripts
  • modify <jedec_lpddr2_single_channel.xml>
  • python cdt_generator.py jedec_lpddr2_single_channel.xml  <cdt image>.bin

Program CDT image on device

cd boot_images/core/boot/secboot3/scripts/emmc_cdt_program_scripts
python ../../../../storage/tools/ptool/ptool.py  -x partition.xml -p 2
modify <jedec_lpddr2_single_channel.xml>

QRD HW V2:
0x03, 0x0B, 0x02, 0x00, 0x00, 0x00, end

python cdt_generator.py jedec_lpddr2_single_channel.xml  platform_ddr.bin
cp platform_ddr.bin emmc_cdt_program_scripts

T32
run platform_ddr_emmc_cdt_program.cmm
QPST
platform_ddr_prog_cfg.xml

Change default CDT in sbl1 image

  • copy boot_cdt_array.c to boot_images\core\boot\secboot3\hw\msm8x26
  • modify config_data_table[] in boot_cdt_array.c
  • rebuild sbl1
  • program sbl1 image

> fastboot flash sbl1 sb1.mbn or use QPST emmcdownload.exe

Generate DT Binary

  • <modify dts>
  • dtc -p 1024 -O dtb -o msm8626.dtb msm8626.dts
  • cat zImage msm8626.dtb > boot.img
  • program boot image

> fastboot flash boot boot.img

Temp workaround

After previous step, if the device still stop at LK(usb port fastboot),  you can try this temp workaround

bootable\bootloader\lk\platform\msm_shared\dev_tree.c
struct dt_entry * dev_tree_get_entry_ptr(struct dt_table *table)
{
<snip>                              
//workaround:  find out the DTB entry index from boot.img(or dt.img)

//                   change below code, force return expected expected dt_entry_ptr,

                               if((dt_entry_ptr->platform_id == board_platform_id()) /* &&

                               (dt_entry_ptr->variant_id == 1) &&

                               (dt_entry_ptr->soc_rev == 0)*/  )

                                               {

                                                                return dt_entry_ptr ++;

How to debug

When mismatch issue happens, lk normally will print error log with below format: 
ERROR: Unable to find suitable device tree for device ( [ chipset id ] [ soc version ] [ platform id type] [ platform subtype] ) 

for example as below 
ERROR: Unable to find suitable device tree for device (164/0x00010001/11/0) 

Match Procedure 
1. SBL will get chipset id, soc version from H/W regiser 
2. SBL fetch platform id type and platform subtype from CDT partitioin 
3. SBL write those information into share memory 
4. LK get those information and try to find suitable DTS entry. 

[chipset id] and [soc version]: 
For device: 
read from H/W register, can not modify 
For DTS: 
qcom,msm-id = <chipset_id, soc version> 

[Platform id type] and [platform subtype]: 
For device, defined in CDT xml file with below format: 
boot_images\core\boot\secboot3\scripts\jedec_lpddr2_single_channel.xml 
<device id="cdb0"> 
<props name="platform_id" type="DALPROP_ATTR_TYPE_BYTE_SEQ"> 

0x03, 0x0B, 0x01, 0x00, 0x04, 0x00, end 

</props> 
</device> 
Byte 0: platform_id Version 
Byte 1: platform_id type: 
0x01: Target is a SURF device 
0x08: Target is a MTP device 
0x0B: Target is a QRD device 
Byte 2: platform_id major platform version 
Byte 3: platform_id minor platform version 
Byte 4: platform_id subtype 
So what you need is to care about Byte 1 and Byte 4 
For DTS: 
qcom,board-id = <platform_id, subtype_id>

Device tree customization的更多相关文章

  1. Device Tree(二):基本概念

    转自:http://www.wowotech.net/linux_kenrel/dt_basic_concept.html 一.前言 一些背景知识(例如:为何要引入Device Tree,这个机制是用 ...

  2. Linux and the Device Tree

    来之\kernel\Documentation\devicetree\usage-model.txt Linux and the Device Tree ----------------------- ...

  3. linux下的device tree

    在我个人的理解,device tree就是描述硬件设备的,目前有什么配置,把这些配置信息告诉linux内核,让内核去识别,增强了内核的通用性,不用因为平台不同而每次都要编译新内核了. 配置device ...

  4. Device Tree(三):代码分析【转】

    转自:http://www.wowotech.net/linux_kenrel/dt-code-analysis.html Device Tree(三):代码分析 作者:linuxer 发布于:201 ...

  5. ARM Linux 3.x的设备树(Device Tree)

    http://blog.csdn.net/21cnbao/article/details/8457546 宋宝华 Barry Song <21cnbao@gmail.com> 1.     ...

  6. Device Tree Usage( DTS文件语法)

    http://elinux.org/Device_Tree_Usage Device Tree Usage     Top Device Tree page This page walks throu ...

  7. ARM Linux 3.x的设备树(Device Tree)

    1. ARM Device Tree起源 Linus Torvalds在2011年3月17日的ARM Linux邮件列表宣称“this whole ARM thing is a f*cking pai ...

  8. Device Tree(三):代码分析

    一.前言 Device Tree总共有三篇,分别是: 1.为何要引入Device Tree,这个机制是用来解决什么问题的?(请参考引入Device Tree的原因) 2.Device Tree的基础概 ...

  9. Device Tree(一):背景介绍

    一.前言 作为一个多年耕耘在linux 2.6.23内核的开发者,各个不同项目中各种不同周边外设驱动的开发以及各种琐碎的.扯皮的俗务占据了大部分的时间.当有机会下载3.14的内核并准备学习的时候,突然 ...

随机推荐

  1. c++ 深入理解虚函数

    为什么使用虚函数?什么是虚函数?虚函数是为了解决什么问题? 面向对象的三大特征: 封装 多态 继承 普通虚函数 虚析构函数 纯虚函数 抽象类 接口类 隐藏 vs 覆盖 隐藏与覆盖之间的关系 早绑定和晚 ...

  2. 剑指架构师系列-Nginx的安装与使用

    Nginx可以干许多事情,在这里我们主要使用Nginx的反向代理与负载均衡功能. 1.Nginx的下载安装 在安装Nginx前需要安装如下软件: GCC  Nginx是C写的,需要用GCC编译 PCR ...

  3. file的基本操作;file的修改

    file的基本操作 # Author:nadech # 文件读写/修改/ #data = open("yesterday",encoding="utf-8"). ...

  4. linux系统性能监控--内存利用率

    Linux提供了对物理内存进行合理.高效的访问并可以访问潜在的海量虚存的技术.虚存通常稍多于操作系统实际拥有的内存容量,以便将较少使用的数据卸载到磁盘存储器上,同时又呈现出系统拥有大量物理内存的假象. ...

  5. 潜谈IT从业人员在传统IT和互联网之间的择业问题(下)-互联网公司

    互联网带来的一片晴天 相对于传统行业来说,互联网行业要显得相对对技术人员尊重些. 在互联网行业中,采用的技术.概念也较传统形行业来说要新,技术人员也容易在此找到自己的一方净土. 因为互联网这个行当讲究 ...

  6. Dynamics CRM 不同的站点地图下设置默认不同的仪表板

    CRM的默认仪表板只能设置一个,也就是说每个引用仪表板的站点地图下点开仪表板后都是看到的默认仪表板,例如我下图中的"日常维修仪表板" 那如果我要在不同的站点地图下看到的默认仪表板不 ...

  7. logstash处理文件进度记录机制

    假如使用如下配置处理日志 input { file { path => "/home/vagrant/logstash/logstash-2.2.2/dbpool-logs/dev/c ...

  8. Google图片加载库Glide的简单封装GlideUtils

    Google图片加载库Glide的简单封装GlideUtils 因为项目里用的Glide的地方比较多,所有简单的封装了以下,其实也没什么,就是写了个工具类,但是还是要把基础说下 Glide的Githu ...

  9. 一个环形公路,上面有N个站点,A1, ..., AN,其中Ai和Ai+1之间的距离为Di,AN和A1之间的距离为D0。 高效的求第i和第j个站点之间的距离,空间复杂度不超过O(N)。

    //点数 #define N 10 //点间距 int D[N]; //A1到每个Ai的距离 int A1ToX[N]; void preprocess() { srand(time(0)); //随 ...

  10. [tornado]使用webscoket的使用总是403错误

    使用的tornado版本为4.0+ 后台: PS D:\CodeHouse\tornado\websocket> python .\ws_app.py WARNING:tornado.acces ...