Skip to contentSkip to conversation

Set linux,stdout-path via aliases

RFC PATCH New Kumar Gala 2 participants 3 messages Nov 21, 2007 – Nov 26, 2007

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

RFC PATCH 1/1 Set linux,stdout-path via aliases

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

common/fdt_support.c +15 -1
index 74b5a93..c50dbbd 100644
@@ -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);
#1 lore raw

RFC PATCH 1/1 Set linux,stdout-path via aliases

Quoted 1 line · Kumar Gala
common/fdt_support.c +1 -0
+	char p[100];

[snip]

common/fdt_support.c int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) · line 171

Quoted 3 lines
common/fdt_support.c +3 -0
+ 		path = fdt_getprop(fdt, pnode, "serial0", &len);
+ 		if (path) {
+ 			strcpy(p, path);

Tsk, tsk.

-Scott

author
#2 lore raw

RFC PATCH 1/1 Set linux,stdout-path via aliases

Quoted 8 lines · Scott Wood
Quoted 1 line · Kumar Gala
common/fdt_support.c +1 -0
+	char p[100];

[snip]

common/fdt_support.c int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) · line 171

Quoted 3 lines
common/fdt_support.c +3 -0
+ 		path = fdt_getprop(fdt, pnode, "serial0", &len);
+ 		if (path) {
+ 			strcpy(p, path);

Tsk, tsk.

yes, I was being lazy for the RFC purposes :)

- k