Browse Source

fdtoverlay: Ignore symbols in overlays which don't apply to the target tree

Symbols from overlays are merged into the target tree, and are required to
have the form:
	/fragment@XXX/__overlay__/...
If any symbols don't have this form, the overlay is rejected.

But there's not really anything wrong with an overlay having "local"
labels referring to a fragment node or some other metadata, that's not
expected to end up in a target tree.

So change our overlay application to simply ignore such symbols rather than
fail.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
David Gibson 5 years ago
parent
commit
5c715a4477
  1. 11
      libfdt/fdt_overlay.c
  2. 4
      tests/stacked_overlay_addlabel.dts

11
libfdt/fdt_overlay.c

@ -738,8 +738,11 @@ static int overlay_symbol_update(void *fdt, void *fdto) @@ -738,8 +738,11 @@ static int overlay_symbol_update(void *fdt, void *fdto)

/* get fragment name first */
s = strchr(path + 1, '/');
if (!s)
return -FDT_ERR_BADOVERLAY;
if (!s) {
/* Symbol refers to something that won't end
* up in the target tree */
continue;
}

frag_name = path + 1;
frag_name_len = s - path - 1;
@ -756,7 +759,9 @@ static int overlay_symbol_update(void *fdt, void *fdto) @@ -756,7 +759,9 @@ static int overlay_symbol_update(void *fdt, void *fdto)
rel_path = "";
rel_path_len = 0;
} else {
return -FDT_ERR_BADOVERLAY;
/* Symbol refers to something that won't end
* up in the target tree */
continue;
}

/* find the fragment index in which the symbol lies */

4
tests/stacked_overlay_addlabel.dts

@ -1,8 +1,10 @@ @@ -1,8 +1,10 @@
/dts-v1/;
/plugin/;
/ {
fragment@1 {
frag1: fragment@1 {
target-path = "/foonode";
local: localinfo {
};
foo: __overlay__ {
overlay-1-property;
bar: barnode {

Loading…
Cancel
Save