设备树dtc反编译

目录

前言:

1、Ubuntu 中安装工具

2、dtb 反编译成 dts 

3、实例


前言:

        在设备树调试的过程中,没有达到预期时需先确定修改内容在dts设备树文件中是否生效,我们可通过dtc反编译来实现。dtc是设备树的编译器,它能实现设备树反编译功能,如:将dtb文件反编译为dts文件。

1、Ubuntu 中安装工具

$ sudo apt install device-tree-compiler

2、dtb 反编译成 dts 命令

$ dtc -I dtb -O dts -o file.dts file.dtb
  • -I dtb 表示输入格式为 dtb;
  • -O dts 表示输出格式为 dts;
  • -o file.dts 表示输出的文件为 file.dts,名字可自己定义;
  • file.dtb 表示设备树的二进制 dtb 文件,也就是被反编译的 dtb 文件;

3、实例

将 dtb.img 反编译成 file.dts

$ dtc -I dtb -O dts -o file.dts dtb.img

查看生成的 file.dts 文件内容如下:

/dts-v1/;

/ {
        interrupt-parent = <0x1>;
        #address-cells = <0x2>;
        #size-cells = <0x2>;
        cpuinfo_hardware = "Unisoc uis7870sc";
        soc-module = "UIS7870SC";
        soc-manufacturer = "Spreadtrum";
        model = "Spreadtrum UIS7870SC SoC";
        compatible = "sprd,uis7870sc";
        sprd,sc-id = "uis7870sc 1000 1000";

        aliases {
                i2c0 = "/soc/ap-ahb/i2c@2240000";
                i2c1 = "/soc/ap-ahb/i2c@2250000";
                i2c2 = "/soc/ap-ahb/i2c@2260000";
                i2c3 = "/soc/ap-ahb/i2c@2270000";
                i2c4 = "/soc/ap-ahb/i2c@2280000";
                i2c5 = "/soc/ap-ahb/i2c@2290000";
                i2c6 = "/soc/ap-ahb/i2c@22a0000";
                i2c7 = "/soc/ap-ahb/i2c@22b0000";
                i2c8 = "/soc/ap-ahb/i2c@22c0000";
                i2c9 = "/soc/ap-ahb/i2c@22d0000";
                spi0 = "/soc/ap-apb/spi@60000";
                spi1 = "/soc/ap-apb/spi@70000";
                spi2 = "/soc/ap-apb/spi@80000";
                spi4 = "/soc/aon/spi@400000";
                eth0 = "/sipa-eth0";
                eth1 = "/sipa-eth1";
                eth2 = "/sipa-eth2";
                eth3 = "/sipa-eth3";
                eth4 = "/sipa-eth4";
                eth5 = "/sipa-eth5";
... ...

通过反编译结果文件可以看出我们对设备树的配置是否生效。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值