14

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!

2
  • 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.
    – Jeremy
    Apr 2, 2014 at 20:24
  • Minimal example with QEMU virtual device to better understand the concept: stackoverflow.com/questions/17488320/… Jul 16, 2017 at 12:36

3 Answers 3

15

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.

3
  • 3
    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.
    – BatchyX
    Apr 2, 2014 at 20:38
  • 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?
    – Jeremy
    Apr 13, 2014 at 20:54
  • 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? Jul 6, 2016 at 10:26
3

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.

2

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.