Difference between revisions of "Device Tree Source Undocumented"

From eLinux.org
Jump to: navigation, search
(Overlays: mention dtc "-@" option)
(Overlays: add basic info about "syntax sugar")
Line 172: Line 172:
  
 
These items require an out of tree dtc compiler, with the "-@" option.
 
These items require an out of tree dtc compiler, with the "-@" option.
 +
 +
Pantelis Antoniou has created dtc patches to allow "syntax sugar".
 +
This syntax allows the device tree source file to contain a reference
 +
to a node and dtc automatically creates the __*__ nodes.
 +
 +
If the "syntax sugar" is available, then the need to allow node names
 +
in device tree source to begin with an underscore is removed, and
 +
hopefully dtc will be further modified to disallow node names
 +
beginning with an underscore in device tree source files.

Revision as of 17:49, 20 June 2017


Top Device Tree page

Deleting nodes and properties

Node can be deleted with the /delete-node/ directive.

Properties can be deleted with the /delete-property/ directive.

Examples of syntax in a source file and resulting output from dtc are:

$ cat test_delete_syntax_B.dts

/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
		node-2-pa = "def";
	};


	node-3@3 {
		node-3-pa = "ghi";
		node-3-pb = "jkl";
	};

	node-4@4 {
		node-4-pa = "mno";
	};

	node_5_label: node-5@5 {
		node-5-pa = "pqr";
	};

};

/ {

	node-2@2 {
		/delete-property/ node-2-pa;
	};

	node-3@3 {
		/delete-property/ node-3-pa;
	};

	/delete-node/ node-4@4;

};

/delete-node/ &node_5_label;

/ {

	node-4@4 {
		node-4-pc = "stu";
		node-4-pd = "vwx";
	};

};



$ dtc -O dts test_delete_syntax_A.dts
/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
	};

	node-3@3 {
		node-3-pb = "jkl";
	};
};
$ cat test_delete_syntax_A.dts

/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
		node-2-pa = "def";
	};


	node-3@3 {
		node-3-pa = "ghi";
		node-3-pb = "jkl";
	};

	node-4@4 {
		node-4-pa = "mno";
	};

	node_5_label: node-5@5 {
		node-5-pa = "pqr";
	};

};

/ {

	node-2@2 {
		/delete-property/ node-2-pa;
	};

	node-3@3 {
		/delete-property/ node-3-pa;
	};

	/delete-node/ node-4@4;

};

/delete-node/ &node_5_label;



$ dtc -O dts test_delete_syntax_B.dts
/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
	};

	node-3@3 {
		node-3-pb = "jkl";
	};

	node-4@4 {
		node-4-pc = "stu";
		node-4-pd = "vwx";
	};
};

Overlays

Overlay support in the dtc compiler and in the Linux kernel is under development and may change from what appears here.

Things that may be currently visible in out of tree locations are:

  • /plugin/ directive
  • __overlay__ node
  • __symbols__ node
  • __fixups__ node
  • __local_fixups__ node

These items require an out of tree dtc compiler, with the "-@" option.

Pantelis Antoniou has created dtc patches to allow "syntax sugar". This syntax allows the device tree source file to contain a reference to a node and dtc automatically creates the __*__ nodes.

If the "syntax sugar" is available, then the need to allow node names in device tree source to begin with an underscore is removed, and hopefully dtc will be further modified to disallow node names beginning with an underscore in device tree source files.