Commit 151c8b09 authored by Kumar Gala's avatar Kumar Gala Committed by Gerald Van Baren
Browse files

Added fdt_fixup_stdout that uses aliases to set linux,stdout-path

We use a combination of the serialN alias and CONFIG_CONS_INDEX to
determine which serial alias we should set linux,stdout-path to.
Signed-off-by: default avatarKumar Gala <>
parent 3c927281
......@@ -28,6 +28,7 @@
#include <fdt.h>
#include <libfdt.h>
#include <fdt_support.h>
#include <exports.h>
* Global data (for the gd->bd)
......@@ -67,6 +68,43 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
return fdt_setprop(fdt, nodeoff, prop, val, len);
static int fdt_fixup_stdout(void *fdt, int choosenoff)
int err = 0;
int node;
char sername[9] = { 0 };
const char *path;
sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
err = node = fdt_path_offset(fdt, "/aliases");
if (node >= 0) {
int len;
path = fdt_getprop(fdt, node, sername, &len);
if (path) {
char *p = malloc(len);
if (p) {
memcpy(p, path, len);
err = fdt_setprop(fdt, choosenoff,
"linux,stdout-path", p, len);
} else {
err = len;
if (err < 0)
printf("WARNING: could not set linux,stdout-path %s.\n",
return err;
int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
int nodeoffset;
......@@ -157,6 +195,11 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
printf("WARNING: could not set linux,initrd-end %s.\n",
err = fdt_fixup_stdout(fdt, nodeoffset);
err = fdt_setprop(fdt, nodeoffset,
"linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment