Linux – a u-Boot dtb file and how to use it (BeagleBoard xM)

beagleboardbootbootloaderlinux

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!

Best Answer

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.

Related Question