Patching the Device Tree Compiler for Ubuntu

 dtc: invalid option -- '@' 

This is an error familiar to anyone trying to compile device tree overlays for the BeagleBone Black (BBB) on the latest Ubuntu image (2013-07-22). These overlays are required to enable the various devices on board, such as the CANBus in my previous post.

There are plenty of places out there which direct you to Robert C Nelsons Script for building the patched version. But for some reason or other this does not work for me. It gets as far as fetching the dtc source files, but does not patch them or compile/install anything. So if anyone else is having similar troubles, here is how to do it manually (from the comments here).

Firstly, install the packages needed to build the dtc binary.

sudo apt-get install build-essential bison flex

Grab the dtc source code

git clone
cd dtc

Go to the specific state which the patch is for

git reset --hard f8cb5dd94903a5cfa1609695328b8f1d5557367f

Grab the patch

wget -O dynamic-symbols.patch

Apply the patch

git apply dynamic-symbols.patch

Now build and install dtc

sudo cp dtc /usr/local/bin

Now you should be able to compile device tree overlays with the following prototype

dtc -O dtb -o <overlay filename> -b 0 -@ <source filename>
Posted in BeagleBone Black
6 comments on “Patching the Device Tree Compiler for Ubuntu
  1. OMendoza says:

    Great post, thanks!, Now I can compile dts to dtbo with no problem.

  2. Jon says:

    Very nice instructions, thanks! I got the same "dtc: invalid option -- '@'" error on the BBB after I built and copied the executable though. Finally I worked on some other items and happened to reboot and now the new dtc works? No idea why a reboot might have been required, but noting it here in case it helps someone else. I am running Debian Wheezy 7.2 Hard Float Minimal.

  3. BG says:

    High thanks for the post.

    I have an error :

    When I do wget -O dynamic-symbols.patch

    I get the error :

    "ERROR: The certificate of '' is not trusted.
    The certificate has not yet been activated"

    What I can do to do not have this error again?

    Thanks a lot

  4. Abel says:

    Jon: try to execute the command with the complete path "/usr/local/bin/dtc -O dtb ...etc.."
    I tried this post in Ubuntu and it worked fine. The only isue was that ubuntu has the binary dtc originaly installed in /usr/bin/, not in /usr/local/bin, so the last copy of the recompiled one did not replace the original.

  5. tucitos says:

    Hi,thanks for the instructions!Great post!

  6. trigpoint says:

    The line git clone no longer works, I have used in in the past but the site seems to have gone.

    Is there another source of this file?

Leave a Reply to Jon Cancel reply

Your email address will not be published. Required fields are marked *


× 1 = three

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>