Home » Linux Kernel » Core Kernel » How to recreate dts file from live Embedded device ?

How to recreate dts file from live Embedded device ?

[addthis tool="addthis_inline_share_toolbox"]

Sometimes it happens that you don’t have source code of the device on which you are working but want to know some kernel configurations or peripheral mappings etc in those case’s Linux kernel provides good insight through /proc filesystem.

In this post also, we will try to showcase how you can regenerate dts file from already booted Linux / Android device so that you can understand how the peripheral devices are mapped for this embedded target .

Note: This needs a rooted device or a device which at-least has sufficient access to proc filesystem.

For this, we will also need “dtc” binary for Ubuntu, you can check “How to Compile and Install device-tree-compiler On Ubuntu” for getting the dtc binary.

For both android and any other embedded device, you will first need to push dtc binary to device filesystem. In android you can use adb push command, or in other embedded targets you may use copy over network using “scp”.

For Android, Type Below commands on Android’s adb shell

$ su
$ cd /
$ mount -o,remount,rw /system
$ mv /sdcard/dtc /system/bin
$ chmod 777 /system/bin/dtc
$ dtc -I fs /proc/device-tree -O generated_dts_file.dts

Now, you can pull this dts on your Ubuntu desktop using “adb pull” command.

For Embedded Linux Target devices

$ su
$ chmod 777 /bin/dtc
$ dtc -I fs /proc/device-tree -O generated_dts_file.dts

2 thoughts on “How to recreate dts file from live Embedded device ?”

  1. I’m trying to get the dts of my android box.
    But when I run “mount -o,remount,rw /system” command, I have this result : “mount: ‘/system’ not in /proc/mounts”

    Reply
  2. And if I run directly “dtc -I fs /proc/device-tree -O generated_dts_file.dts”, I have this result : “tmp-mksh: dtc: not found” …
    Is there any solution for me ?

    Reply

Leave a Comment