Edit device tree at run time

From RidgeRun Developer Wiki


Introduction

Sometimes, when we are working on an embedded device adding a new module or debugging an existing one, we need to constantly modify the device tree. This wiki page explains an easy way of doing it from the same target board without the need of going to the source code. For this purpose we'll use a tool called devocet-tree-compitler

Using the tool

Install the tool

sudo apt-get install device-tree-compiler

After this should have these tools installed: fdtdump fdtget fdtput

Dumping the dtb

To dump the dtb you can use fdtdump as follows:

fdtdump [options] <file>

For instance:

fdtdump /boot/tegra186-quill-p3310-1000-c03-00-base.dtb

Getting a property

To get a property you can use fdtget as follows:

fdtget <options> <dt file> [<node> <property>]...

For instance, to get the clock frequency for i2c0:

fdtget /boot/tegra186-quill-p3310-1000-c03-00-base.dtb i2c0 clock-frequency

Setting a property

To set a property you can use fdtput as follows:

fdtput <options> <dt file> <node> <property> [<value>...]

So for example, to set the clock frequency for i2c0:

sudo fdtput -t i /boot/tegra186-quill-p3310-1000-c03-00-base.dtb i2c0 clock-frequency 100000

After this you should restart your board for the changes to take effect.


RidgeRun Resources

Quick Start Client Engagement Process RidgeRun Blog Homepage
Technical and Sales Support RidgeRun Online Store RidgeRun Videos Contact Us
RidgeRun.ai: Artificial Intelligence | Generative AI | Machine Learning

Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering informations are available in RidgeRun Professional Services, RidgeRun Subscription Model and Client Engagement Process wiki pages. Please email to support@ridgerun.com for technical questions and contactus@ridgerun.com for other queries. Contact details for sponsoring the RidgeRun GStreamer projects are available in Sponsor Projects page.