Device tree compiler throws error dtc: invalid option — '@'

Hi All,

I am trying to compile an overlay and use it for study purpose but I am not able to compile an overlay. For example I took an example device tree overlay from derek molloy blog

git clone git://github.com/derekmolloy/boneDeviceTree.git

and now I have a directory with a name overlay. In that a script build is there that have the compilation command for this overlay. this is the command inside build

<b>#!/bin/bash

echo "Compiling the overlay from .dts to .dtbo"

dtc -O dtb -o DM-GPIO-Test-00A0.dtbo -b 0 -@ DM-GPIO-Test.dts</b>
 

DM-GPIO-Test.dts file is the source overlay file and DM-GPIO-Test-00A0.dtbo is the output.

Now if I run this script I get this message

<b>./build 
Compiling the overlay from .dts to .dtbo
dtc: invalid option -- '@'
Usage: dtc [options] <input file>

Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv]
  -q, --quiet                
    Quiet: -q suppress warnings, -qq errors, -qqq all
  -I, --in-format <arg>      
    Input formats are:
        dts - device tree source text
        dtb - device tree blob
        fs  - /proc/device-tree style directory
  -o, --out <arg>            
    Output file
  -O, --out-format <arg>     
    Output formats are:
        dts - device tree source text
        dtb - device tree blob
        asm - assembler source
  -V, --out-version <arg>    
    Blob version to produce, defaults to %d (for dtb and asm output)
  -d, --out-dependency <arg> 
    Output dependency file
  -R, --reserve <arg>        
    tMake space for <number> reserve map entries (for dtb and asm output)
  -S, --space <arg>          
    Make the blob at least <bytes> long (extra space)
  -p, --pad <arg>            
    Add padding to the blob of <bytes> long (extra space)
  -b, --boot-cpu <arg>       
    Set the physical boot cpu
  -f, --force                
    Try to produce output even if the input tree has errors
  -i, --include <arg>        
    Add a path to search for include files
  -s, --sort                 
    Sort nodes and properties before outputting (useful for comparing trees)
  -H, --phandle <arg>        
    Valid phandle formats are:
        legacy - "linux,phandle" properties only
        epapr  - "phandle" properties only
        both   - Both "linux,phandle" and "phandle" properties
  -W, --warning <arg>        
    Enable/disable warnings (prefix with "no-")
  -E, --error <arg>          
    Enable/disable errors (prefix with "no-")
  -h, --help                 
    Print this help and exit
  -v, --version              
    Print version and exit

Error: unknown option</b>

 

I did install device-tree-compiler before issuing this command.

My system is ubuntu 14.04, 64 bit.

What is wrong here?

The "-@" option was added after 14.04 was released.

Now to correctly build the correct version of dtc, are you using a
3.8.13 or a 4.4.x+ based kernel on your BeagleBone?

Regards,

Hi Robert,

I am using kernel 3.8.13.

Regards,
Mrigendra

I am first trying to compile a device tree overlay, in my ubuntu 14.04.
The overlay I am compiling for, is beaglebone black kernel 3.8

Then you'll want to use this script:

wget https://raw.githubusercontent.com/RobertCNelson/boot-scripts/master/tools/dtc/dtc-3.8.x.sh
chmod +x dtc-3.8.x.sh
./dtc-3.8.x.sh

to build a compatible version of dtc.

Regards,

Yes that works.

Many thanks.

On Wed, 4 Oct 2017 23:51:26 -0700 (PDT), Mrigendra Chaubey
<mrigendra.chaubey@gmail.com> declaimed the
following:

Compiling the overlay from .dts to .dtbo
dtc: invalid option -- '@'
Usage: dtc [options] <input file>

  <snip list of options that does not include @>

Error: unknown option*

I did install device-tree-compiler before issuing this command.

My system is ubuntu 14.04, 64 bit.

What is wrong here?

  Off-hand -- nothing other than possibly not searching documentation...

  dtc for current Debian (I just installed to check) does not have an @
option. A google search for dtc options shows dtc for QEMU has/had @
https://fossies.org/linux/qemu/dtc/Documentation/manual.txt -- which does
also seem to match the text found in a link from Wikipedia

"""
  122 -@
  123 Generates a __symbols__ node at the root node of the resulting blob
  124 for any node labels used, and for any local references using
phandles
  125 it also generates a __local_fixups__ node that tracks them.
  126
  127 When using the /plugin/ tag all unresolved label references to
  128 be tracked in the __fixups__ node, making dynamic resolution
possible.
  129
  130 -A
  131 Generate automatically aliases for all node labels. This is similar
to
  132 the -@ option (the __symbols__ node contain identical information)
but
  133 the semantics are slightly different since no phandles are
automatically
  134 generated for labeled nodes.
"""

(Appears "A" is not supported anymore either).

So... Try editing the command line to remove the "-@" option

Incorrect, as that won't work, the "-@" generates symbol information,
for use as an overlay.

In 3.8.13, we an early version of "dtc: Plugin and fixup support"

A later version went mainline as of dtc-1.4.3:

https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=20f29d8d41f6d1bd2fbe466aa5676026eb012832

Debian (and thus ubuntu) only has dtc-1.4.2 in the stable branches..

Sid recently got dtc-1.4.5

Regards,

On Thu, 5 Oct 2017 10:29:53 -0500, Robert Nelson
<robertcnelson@gmail.com> declaimed the
following:

Incorrect, as that won't work, the "-@" generates symbol information,
for use as an overlay.

In 3.8.13, we an early version of "dtc: Plugin and fixup support"

A later version went mainline as of dtc-1.4.3:

https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=20f29d8d41f6d1bd2fbe466aa5676026eb012832

Debian (and thus ubuntu) only has dtc-1.4.2 in the stable branches..

Sid recently got dtc-1.4.5

  <sigh> And people complain about Windows DLL matches...

how do you figure?

news at 11, "stable" distro's don't package "in-development" code...

Regards,

One small question that is not related to upper discussion.

On beaglebone, i2c-2 instance,that is on pins p9_19 and p9_20. Is this mapped as i2c1?
If this is already mapped, why do I(or people) need to create an overlay file?Its already there.
Also if I do create an overlay file and compile it and put it into /lib/firmware, and invoke slot mechanism of bonmgr, it gets a slot. But it is not discover able on reboot again. Is it?
So how do I add an i2c device permanently whenever my bbb boots up?How is device tree better than previous board file concept?

One small question that is not related to upper discussion.

On beaglebone, i2c-2 instance,that is on pins p9_19 and p9_20. Is this
mapped as i2c1?

i2c-2/i2c-1 is a bug in 3.8.13

If this is already mapped, why do I(or people) need to create an overlay
file?Its already there.

Usually we just define the hardware at the i2c location..

Also if I do create an overlay file and compile it and put it into
/lib/firmware, and invoke slot mechanism of bonmgr, it gets a slot. But it
is not discover able on reboot again. Is it?

Not unless you tell it to load it..

So how do I add an i2c device permanently whenever my bbb boots up?

There's a few ways, since your using 3.8.13, stick the name in:

/etc/default/capemgr

or write an init scrip to do it..

How is
device tree better than previous board file concept?

if you just "booted" supported devices no difference.

If your working on new designs, modifcations, etc... it's a whole lot easer..

Regards,

Thanks for posting solution. where is the new version of dtc reside? I ran the dtc again but it’s still showing the old version (1.4.0) and dtc does not support the -@. I also tried looking through the directory where i ran that script, but dtc no where to be found.
thanks.
-Peter

Use "any" one of these official dtc release:

v1.4.4
v1.4.6
v1.4.7
v1.5.0

https://git.kernel.org/pub/scm/utils/dtc/dtc.git/

Regards,

Hello Does this mean the dtc v1.4.5 is buggy? I am using a ubuntu 18.04 OS with dtc 1.4.5 and do not succeed to compile unless using your script. May you provide a link that describe the issue? Is it due to a bad syntax of the dts?

Regards

Correct, dtc v1.4.5 is buggy.

Last i looked, ubuntu 18.04 had back-ported a few fixes into their
version of dtc 1.4.5, so it 'should' be fine..

What issue are you actually having?

Regards,