]> git.sur5r.net Git - u-boot/blobdiff - scripts/dtc/dtc-parser.y
fit: Verify all configuration signatures
[u-boot] / scripts / dtc / dtc-parser.y
index ca3f5003427cb5e280eb6ec4343547f7f37bd428..44af170abfeaca34a94217d0cf7519568e27b72a 100644 (file)
@@ -166,7 +166,17 @@ devicetree:
                {
                        $$ = merge_nodes($1, $3);
                }
-
+       | DT_REF nodedef
+               {
+                       /*
+                        * We rely on the rule being always:
+                        *   versioninfo plugindecl memreserves devicetree
+                        * so $-1 is what we want (plugindecl)
+                        */
+                       if (!($<flags>-1 & DTSF_PLUGIN))
+                               ERROR(&@2, "Label or path %s not found", $1);
+                       $$ = add_orphan_node(name_node(build_node(NULL, NULL), ""), $2, $1);
+               }
        | devicetree DT_LABEL DT_REF nodedef
                {
                        struct node *target = get_node_by_ref($1, $3);
@@ -182,10 +192,19 @@ devicetree:
                {
                        struct node *target = get_node_by_ref($1, $2);
 
-                       if (target)
+                       if (target) {
                                merge_nodes(target, $3);
-                       else
-                               ERROR(&@2, "Label or path %s not found", $2);
+                       } else {
+                               /*
+                                * We rely on the rule being always:
+                                *   versioninfo plugindecl memreserves devicetree
+                                * so $-1 is what we want (plugindecl)
+                                */
+                               if ($<flags>-1 & DTSF_PLUGIN)
+                                       add_orphan_node($1, $3, $2);
+                               else
+                                       ERROR(&@2, "Label or path %s not found", $2);
+                       }
                        $$ = $1;
                }
        | devicetree DT_DEL_NODE DT_REF ';'