
I was hoping to get some suggestions on how to handle using aliases to set linux,stdout-path.
* Do we want this protected via some board CONFIG? - should this be mutually exclusive with OF_STDOUT_PATH? - if so, which has precedence? * Was figuring we'd use CONFIG_CONS_INDEX to find the proper alias
any other comments are welcome.. this patch is a hack that works right now.
- k
diff --git a/common/fdt_support.c b/common/fdt_support.c index 74b5a93..c50dbbd 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -72,10 +72,12 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) { - int nodeoffset; + int nodeoffset, pnode; int err; u32 tmp; /* used to set 32 bit integer properties */ char *str; /* used to set string properties */ + const char *path; + char p[100];
err = fdt_check_header(fdt); if (err < 0) { @@ -160,6 +162,18 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) printf("WARNING: could not set linux,initrd-end %s.\n", fdt_strerror(err)); } + + pnode = fdt_path_offset(fdt, "/aliases"); + if (pnode >= 0) { + int len; + path = fdt_getprop(fdt, pnode, "serial0", &len); + if (path) { + strcpy(p, path); + fdt_setprop(fdt, nodeoffset, "linux,stdout-path", + p, len); + } + } + #ifdef OF_STDOUT_PATH err = fdt_setprop(fdt, nodeoffset, "linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);