[U-Boot] [PATCH v3 04/14] fdt: Allow stacked overlays phandle references

Simon Glass sjg at chromium.org
Sat Sep 9 04:53:40 UTC 2017


On 4 September 2017 at 14:12, Pantelis Antoniou
<pantelis.antoniou at konsulko.com> wrote:
> 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 at 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 at 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 at konsulko.com>
> Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
> ---
>  lib/libfdt/fdt_overlay.c | 228 ++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 206 insertions(+), 22 deletions(-)
>

Acked-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list