1. 程式人生 > >dtimg轉dtb,dtb反編譯為dts方法

dtimg轉dtb,dtb反編譯為dts方法

一、QCDT Version

目前dt.img裡的QCDT表規範最新的為version 3 
比version 2增加了幾個定義。 
這裡寫圖片描述
可以同時支援verion2和version3。

二、使用方法

軟體需要.net framework 2.0執行環境 
開啟軟體->選單File->OpenDtimg,用來開啟dt.img檔案 
開啟後會自動識別表頭,如下圖所示 
這裡寫圖片描述
pmic0~3是version3才支援的引數,如果開啟的dt.img是version 2,則這4列是空的

dtimg表內部做了優化,不同platform id或variant id但dtb有可能一樣,所以dtb都不重複地整合進了dt.img,具體說來就是相同的dtb都會在表頭裡使用同樣的offset地址。

單獨匯出某行dtb:直接點某行右側的 Save按鈕 
批量匯出所有dtb:點選選單File->ExportAllDtb

注意事項: 
因為dt.img裡,一般以page=2048的整數倍來儲存,所以匯出的每段dtb,結尾如果不足2048的整數倍會以0補齊 
這裡寫圖片描述

三、程式下載&原始碼下載

四 dtb反編譯為dts

<span style="font-size:18px;">kernel/scripts/dtc$  ./dtc -I dtb -O dts xxx.dtb > xxx.dts</span>

五 dts編譯

Compiling a Device Tree Blob (.dtb) file from the DTS

A utility called device tree compiler (DTC) is used to compile the DTS file into a DTB file. DTC is part of the Linux source directory. linux-xlnx/scripts/dtc/ contains the source code for DTC and needs to be compiled in order to be used. One way to compile the DTC is to build the Linux tree. The DTC might also be available through your OS's package manager.


Once the DTC is available, the tool may be invoked to generate the DTB:
./scripts/dtc/dtc -I dts -O dtb -o <devicetree name>.dtb <devicetree name>.dts
DTC may also be used to convert a DTB back into a DTS:
./scripts/dtc/dtc -I dtb -O dts -o <devicetree name>.dts <devicetree name>.dtb
Alternative: For ARM only
In the Linux source directory, making the target 'dtbs' will compile all DTS files from linux-xlnx/arch/arm/boot/dts/ into DTB files.
make ARCH=arm dtbs
The compiled DTB files will be located in linux-xlnx/arch/arm/boot/dts/.
A single linux-xlnx/arch/arm/boot/dts/<devicetree name>.dts may be compiled into linux-xlnx/arch/arm/boot/dts/<devicetree name>.dtb:
make ARCH=arm <devicetree name>.dtb

參考文獻

Enjoy it !