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

64,566

Solution 1

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.

Solution 2

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.

Solution 3

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.

Share:
64,566

Related videos on Youtube

Jeremy
Author by

Jeremy

Updated on September 18, 2022

Comments

  • Jeremy
    Jeremy over 1 year

    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!

    • Admin
      Admin about 10 years
      It turns out that I misread the file name - I originally thought it was a ".dtd" file but it is ACTUALLY ".dtb" - which is why I couldn't find information about it. The question has now been updated.
    • Admin
      Admin almost 7 years
      Minimal example with QEMU virtual device to better understand the concept: stackoverflow.com/questions/17488320/…
  • BatchyX
    BatchyX about 10 years
    It's the new(er) way to pass hardware information about the board to the Linux kernel. There were no previous way to pass hardware information to the kernel. Instead, the kernel would have to statically include all the information and so would have a board-specific C file to list all those mappings. This was a maintenance nightmare from the kernel point of view.
  • Jeremy
    Jeremy about 10 years
    Thanks! I figured out how to load the dtb file, and Linux now boots up and issues various messages about loading drivers, but I can't see any USB devices (including the ethernet module). See new question: link. Maybe there is something I need to manually configure in Linux?
  • André van Schoubroeck
    André van Schoubroeck almost 8 years
    But what address to use for the dtb file? For example, if my zImage goes to address 0x43000000 (in stead of the example above 0x80300000), where should the dtb go?