]> git.sur5r.net Git - u-boot/blobdiff - common/fdt_support.c
Merge git://git.denx.de/u-boot-mmc
[u-boot] / common / fdt_support.c
index 7ccf8b19fd10e857cfd9f309218fcb52f2d4bbe7..f4f9543d5475d804e9059a51ccb199604605fc7b 100644 (file)
@@ -197,7 +197,7 @@ int fdt_root(void *fdt)
                return err;
        }
 
-       serial = getenv("serial#");
+       serial = env_get("serial#");
        if (serial) {
                err = fdt_setprop(fdt, 0, "serial-number", serial,
                                  strlen(serial) + 1);
@@ -289,7 +289,7 @@ int fdt_chosen(void *fdt)
        if (nodeoffset < 0)
                return nodeoffset;
 
-       str = getenv("bootargs");
+       str = env_get("bootargs");
        if (str) {
                err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
                                  strlen(str) + 1);
@@ -509,7 +509,7 @@ void fdt_fixup_ethernet(void *fdt)
                        } else {
                                continue;
                        }
-                       tmp = getenv(mac);
+                       tmp = env_get(mac);
                        if (!tmp)
                                continue;
 
@@ -1655,3 +1655,34 @@ int fdt_fixup_display(void *blob, const char *path, const char *display)
        }
        return toff;
 }
+
+#ifdef CONFIG_OF_LIBFDT_OVERLAY
+/**
+ * fdt_overlay_apply_verbose - Apply an overlay with verbose error reporting
+ *
+ * @fdt: ptr to device tree
+ * @fdto: ptr to device tree overlay
+ *
+ * Convenience function to apply an overlay and display helpful messages
+ * in the case of an error
+ */
+int fdt_overlay_apply_verbose(void *fdt, void *fdto)
+{
+       int err;
+       bool has_symbols;
+
+       err = fdt_path_offset(fdt, "/__symbols__");
+       has_symbols = err >= 0;
+
+       err = fdt_overlay_apply(fdt, fdto);
+       if (err < 0) {
+               printf("failed on fdt_overlay_apply(): %s\n",
+                               fdt_strerror(err));
+               if (!has_symbols) {
+                       printf("base fdt does did not have a /__symbols__ node\n");
+                       printf("make sure you've compiled with -@\n");
+               }
+       }
+       return err;
+}
+#endif