If the path we are trying to print doesn't exist see if it matches an
aliases.  We don't do anything fancy at this point, but just strip the
leading '/' if it exists and see if we have an exact match to an alias.

In the future we could try and prefix matching so the alias could be used
as a shorter path reference.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 common/cmd_fdt.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 97b9dd7..65c5cdf 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -678,9 +678,23 @@ static int fdt_print(const char *pathp, char *prop, int 
depth)
                /*
                 * Not found or something else bad happened.
                 */
-               printf ("libfdt fdt_path_offset() returned %s\n",
-                       fdt_strerror(nodeoffset));
-               return 1;
+
+               /* see if we match an alias */
+               int aliasoffset = fdt_path_offset(working_fdt, "/aliases");
+               if (aliasoffset >= 0) {
+                       const char *aliasp = pathp;
+                       if (pathp[0] == '/')
+                               aliasp++;
+                       aliasp = fdt_getprop(working_fdt,
+                                               aliasoffset, aliasp, NULL);
+                       nodeoffset = fdt_path_offset(working_fdt, aliasp);
+               }
+
+               if (nodeoffset < 0) {
+                       printf("libfdt fdt_path_offset() returned %s\n",
+                                       fdt_strerror(nodeoffset));
+                       return 1;
+               }
        }
        /*
         * The user passed in a property as well as node path.
-- 
1.5.5.1


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to