summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2019-07-04 15:10:01 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2019-07-04 15:10:01 +1000
commit5c715a44776a450106d8a59ad5abc9ac5830bc1d (patch)
treed0306c2139f9682c9c1c7d1e7b073f602aab312c
parentb99353474850969a1f856d344d273325ddb069c7 (diff)
downloaddevice-tree-compiler-5c715a44776a450106d8a59ad5abc9ac5830bc1d.tar.gz
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>
-rw-r--r--libfdt/fdt_overlay.c11
-rw-r--r--tests/stacked_overlay_addlabel.dts4
2 files changed, 11 insertions, 4 deletions
diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
index 7fbf58c..be71873 100644
--- a/libfdt/fdt_overlay.c
+++ b/libfdt/fdt_overlay.c
@@ -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)
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 */
diff --git a/tests/stacked_overlay_addlabel.dts b/tests/stacked_overlay_addlabel.dts
index e5c158f..e7187a3 100644
--- a/tests/stacked_overlay_addlabel.dts
+++ b/tests/stacked_overlay_addlabel.dts
@@ -1,8 +1,10 @@
/dts-v1/;
/plugin/;
/ {
- fragment@1 {
+ frag1: fragment@1 {
target-path = "/foonode";
+ local: localinfo {
+ };
foo: __overlay__ {
overlay-1-property;
bar: barnode {