I wonder if it is allowed and by this possible that duplicate labels within a *.dts device tree file appear and if so what happens then?

Does a new label allow to overwrite/redefine the old label, for instance?

To make the question more transparent and clearer I would like to state the question what happens to this example dts data.

/ {
    #address-cells = <1>;
    #size-cells = <1>;
    chosen { 
        labelname: bootargs = "lalalallal";
        labelname: bootargs2 = "lalalallal";
    aliases { };
    memory { device_type = "memory"; reg = <0 0>; };

in which the we have a duplicate use of the label labelname.

The motivation to this question was the inability to find a clear and crisp documentation on the dts syntax telling that labels need to be unique

  • 1
    Please try to state your problem clearer, it is quite confusing the way it is. – Kira Nov 12 '15 at 15:12
  • @Kira Indeed I took your comment and added an example. Also by generating the example I was able to find out the answer myself using the example. Maybe somebody will yet be able to complement , enhance the issue (quesiton/answer) by a reference to a docu on the syntax. The reference to the rule "labels need to be unique" – humanityANDpeace Nov 12 '15 at 15:18

In a device tree one must not use duplicate labels. If doing so anyway and a duplicate is encountered by dtc it will yield an error like this:

ERROR (duplicate_label): Duplicate label 'labelX' on 'node' in /path and 'node2' in /path

I now just wished to have a reference to add to the documentation that would have made me aware of this "labels must be unique". Maybe some comment or additional/alternative answer can point to this resource I was yet unable to spot :)

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.