platform_external_dtc/libfdt
Pantelis Antoniou 1bb00655d3 fdt: Allow stacked overlays phandle references
This patch enables an overlay to refer to a previous overlay's
labels by performing a merge of symbol information at application
time.

In a nutshell it allows an overlay to refer to a symbol that a previous
overlay has defined. It requires both the base and all the overlays
to be compiled with the -@ command line switch so that symbol
information is included.

base.dts
--------

	/dts-v1/;
	/ {
		foo: foonode {
			foo-property;
		};
	};

	$ dtc -@ -I dts -O dtb -o base.dtb base.dts

bar.dts
-------

	/dts-v1/;
	/plugin/;
	/ {
		fragment@1 {
			target = <&foo>;
			__overlay__ {
				overlay-1-property;
				bar: barnode {
					bar-property;
				};
			};
		};
	};

	$ dtc -@ -I dts -O dtb -o bar.dtb bar.dts

baz.dts
-------

	/dts-v1/;
	/plugin/;
	/ {
		fragment@1 {
			target = <&bar>;
			__overlay__ {
				overlay-2-property;
				baz: baznode {
					baz-property;
				};
			};
		};
	};

	$ dtc -@ -I dts -O dtb -o baz.dtb baz.dts

Applying the overlays:

	$ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtb

Dumping:

	$ fdtdump target.dtb
	/ {
            foonode {
                overlay-1-property;
                foo-property;
                linux,phandle = <0x00000001>;
                phandle = <0x00000001>;
                barnode {
                    overlay-2-property;
                    phandle = <0x00000002>;
                    linux,phandle = <0x00000002>;
                    bar-property;
                    baznode {
                        phandle = <0x00000003>;
                        linux,phandle = <0x00000003>;
                        baz-property;
                    };
                };
            };
            __symbols__ {
                baz = "/foonode/barnode/baznode";
                bar = "/foonode/barnode";
                foo = "/foonode";
            };
	};

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-09 17:18:47 +10:00
..
fdt.c libfdt: Fix undefined behaviour in fdt_offset_ptr() 2015-12-17 17:19:11 +11:00
fdt.h Added license header to dtc/libfdt/fdt.h and libfdt_env.h 2013-02-18 08:03:50 -06:00
fdt_addresses.c libfdt: Add helpers to read #address-cells and #size-cells 2014-05-12 16:01:09 +10:00
fdt_empty_tree.c Fix a few whitespace and style nits 2017-04-09 20:56:37 +10:00
fdt_overlay.c fdt: Allow stacked overlays phandle references 2017-08-09 17:18:47 +10:00
fdt_ro.c Fix a few whitespace and style nits 2017-04-09 20:56:37 +10:00
fdt_rw.c Introduce fdt_setprop_placeholder() method 2017-07-28 14:34:36 +10:00
fdt_strerror.c libfdt: add missing errors to fdt_strerror() 2016-11-04 07:17:20 +11:00
fdt_sw.c Add a libfdt function to write a property placeholder 2017-04-02 13:38:46 +10:00
fdt_wip.c Fix a few whitespace and style nits 2017-04-09 20:56:37 +10:00
libfdt.h Introduce fdt_setprop_placeholder() method 2017-07-28 14:34:36 +10:00
libfdt_env.h libfdt: Change names of sparse helper macros 2017-03-06 12:16:56 +11:00
libfdt_internal.h libfdt: avoid shadowing "err" in FDT_CHECK_HEADER 2014-01-25 15:11:20 +11:00
Makefile.libfdt libfdt: Add overlay application function 2016-10-06 19:22:41 +11:00
TODO dtc: Update TODO files 2007-12-19 08:20:26 -06:00
version.lds libfdt: Add fdt_overlay_apply to the exported symbols 2016-10-11 20:08:38 +11:00