Edit device tree at run time: Difference between revisions

From RidgeRun Developer Wiki
mNo edit summary
 
mNo edit summary
 
Line 1: Line 1:
<seo title="Linux Device Tree | How To Edit Device Tree at Run Time" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, Nvidia, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework."  description="This page contains simple instructions on how to edit a device tree at run time. Learn how to modify a Linux device tree from RidgeRun Developer today."></seo>
{{#seo:
|title=Linux Device Tree
|title_mode=replace
|description={{{description|This page contains simple instructions on how to edit a device tree at run time. Learn how to modify a Linux device tree from RidgeRun Developer today.}}}
}}
{{NVIDIA & NXP logo and RR Contact}}


== Introduction ==
== Introduction ==

Latest revision as of 18:57, 3 December 2024





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.



For direct inquiries, please refer to the contact information available on our Contact page. Alternatively, you may complete and submit the form provided at the same link. We will respond to your request at our earliest opportunity.


Links to RidgeRun Resources and RidgeRun Artificial Intelligence Solutions can be found in the footer below.