What is a u-Boot dtb file and how do I use it (BeagleBoard xM)?

I'm trying to build a custom Linux for a BeagleBoard xM (Rev. C). I do a lot of C/C++ but am a beginner at building and installing Linux from scratch.

I used the Yocto Project build appliance (https://www.yoctoproject.org/) which seemed promising - it built files for the u-Boot boot loader, Linux kernel and root file system.

This page gives instructions for setting up the micro SD card with the Yocto-generated files. However, the image files include a ".dtb" file which is not mentioned in the set up instructions.

Does this file have something to do with the board hardware? Various sites mention loading dtd files (maybe in uEnv.txt?) but I haven't found any detailed information.

I used the above instructions to set up the boot partition with MLO and u-boot.img, and messed about a bit with the uEnv.txt. I also set up a second partition with the root file system.

I was able to boot and log in (via serial port console), but it looked like most of the board hardware - e.g. video and all USB devices including ethernet - were not working. Could this be because I wasn't using the .dtb file?

Can someone explain the dtb and how to use it on a beagle board? Thanks!


Answering my own question, after I figured out what to search for. A "dtb" file contains a Device Tree Blob (or Binary)(nice description here). It's the new(er) way to pass hardware information about the board to the Linux kernel.

It can be loaded into memory and passed to the kernel by u-Boot.

Here are the u-Boot commands I used:

setenv bootargs 'console=tty0 console=ttyO2,115200n8 root=/dev/mmcblk0p2 rootwait rootfstype=ext4 rw'
fatload mmc 0:1 0x80300000 zImage
fatload mmc 0:1 0x815f0000 beagle-xm.dtb
bootz 0x80300000 - 0x815f0000

zImage being the kernel, and beagle-xm.dtb being the device tree blob. I automated the boot process by setting up a "uenvcmd=..." variable in uEnv.txt (with the above in it), but it's a bit ugly and there are probably better ways.

Note that this boots up, and says that it loaded the device tree OK. However, I still have no USB devices or video (as far as I can tell). However, I suspect that may be a different problem.


Note that there are 2 dtb. The u-boot dtb and the kernel dtb. They are 2 different things. U-boot board dts/dtb is not always used, not mandatory, btw in u-boot you can use the "u-boot" dtb embedding it into u-boot or concatenating it to u-boot.


I am using Ubuntu 14.04 on the beaglebone black, so my setup may be a bit different, but here is how I loaded a custom dtb:

In uEnv.txt, add a line with: dtb=name-of-desired.dtb

The locations searched should be as specified here. For me this was /boot/dtbs/linux-kernel/ where linux-kernel is the name of the loaded version.