James Adams
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 94
Joined: Wed Mar 19, 2014 2:58 pm
Location: Cambridge

STICKY: Device Tree Forum Area README

Thu May 28, 2015 3:40 pm

From http://www.devicetree.org: "The Device Tree is a data structure for describing hardware. Rather than hard coding every detail of a device into an operating system, many aspects of the hardware can be described in a data structure that is passed to the operating system at boot time"

Raspberry Pi's latest kernels and firmware, including Raspbian and NOOBS releases, now by default use Device Tree (DT) to manage some resource allocation and module loading. This change is to alleviate the problem of multiple drivers contending for system resources, and to allow HAT modules to be auto-configured.

As Device Tree is 'the new way' for Raspberry Pi products we've decided to dedicate some forum area to collecting questions/feedback/issues about it. This forum area is for discussing issues specific to Linux Device Tree implementation used on the Raspberry Pi and Compute Module products, so please keep the disucssions on topic.

Documentation:

Main Raspberry Pi Linux Device Tree Docs:
https://www.raspberrypi.org/documentati ... ce-tree.md

'GPU' Device Tree (This is a DT file specifically for stuff that the GPU uses and Linux doesn't see - e.g. Camera control I2C and pins; usually you won't need to touch this though you might if you are using a Compute Module):
https://www.raspberrypi.org/documentati ... uration.md

Attaching peripherals to a Compute Module and enabling them using Device Tree (also relevant for Raspberry Pi boards):
https://www.raspberrypi.org/documentati ... w-guide.md
James Adams
Raspberry Pi - COO & Hardware Lead

Maykef
Posts: 29
Joined: Sun Mar 08, 2015 9:07 pm

Re: Device Tree Forum Area README

Wed Dec 09, 2015 2:44 pm

Hi James

I recently got the compute module and I'm trying to learn about device tree and so on. My question is probably very stupid but, how can I visualize .dts files? I have tried opening them with nano or vim but they look quite messy and senseless.

ghans
Posts: 7439
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Device Tree Forum Area README

Wed Dec 09, 2015 2:47 pm

Are you sure you are looking at the .dts files instead of .dtb ? The latter are compiled binary files and not supposed to be edited.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1419
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Forum Area README

Wed Dec 09, 2015 2:51 pm

Maykef,

Yes, it takes a while to get familiar with DTS to the point that you can read it with ease. You can help yourself by reading the source DTS files (you'll find these in the Linux tree, e.g. here), rather than the result of decompiling DTBs; the compilation process loses the labels and replaces them with phandles (small integers) which are harder to follow.

Other than that, start with the base DTS files bcm2708-rpi-cm.dts, which includes bcm2708-rpi-cm.dts, which include bcm2708.dtsi, which includes bcm2708_common.dtsi. Overlays add another level of complexity, and have to be read with the base DTS/DTB as a reference.

Maykef
Posts: 29
Joined: Sun Mar 08, 2015 9:07 pm

Re: Device Tree Forum Area README

Wed Dec 09, 2015 2:54 pm

OK.

Got it.

Thanks!

MAHaines
Posts: 2
Joined: Fri Jan 29, 2016 10:57 am

Re: Device Tree Forum Area README

Fri Jan 29, 2016 11:07 am

Hi,

I am trying to get my head around the Device Tree set up, I think I am getting my head around the files, syntax, overlays etc. The thing I am getting confused with is the attaching peripherals to the Compute Module guide.

It says that the dt-blob.bin and other files are to be placed in root of the FAT partition and overlays in '/overlays' but later on in the examples all these files are being placed in '/boot' and '/boot/overlays'. Which location should the device tree files and overlays be placed?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1419
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Forum Area README

Fri Jan 29, 2016 1:14 pm

Both statements are correct. The absolute root of the Pi's virtual filing system is usually either a Linux filing system (ext3, ext4, etc.) or a RAM disk of some description. The VFAT partition - the one a Windows PC recognises - is usually mounted within the root filing system on /boot. Hence /boot/overlays is the overlays directory in the root of the VFAT partition.

MAHaines
Posts: 2
Joined: Fri Jan 29, 2016 10:57 am

Re: Device Tree Forum Area README

Fri Jan 29, 2016 1:34 pm

Right, okay thank you, I am used to root in linux being '/' so I was a bit confused as to why it was /boot/overlays in the examples, but being the root of FAT and not absolute root makes sense.

Thank you for your help.

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 3 guests