Blob Blame History Raw
From 8c3c5af7d22366bcebd48817190b22ddbb119f9d Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Fri, 6 Mar 2015 10:32:40 +0000
Subject: [PATCH 05/14] add back adding console= to the bootargs if not
 present.

A better soloution is needed, not upstreamable
---
 common/cmd_pxe.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 7e32c95..4f3c15d 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -673,18 +673,34 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 	if ((label->ipappend & 0x3) || label->append) {
 		char bootargs[CONFIG_SYS_CBSIZE] = "";
 		char finalbootargs[CONFIG_SYS_CBSIZE];
+		char console[30] = "";
+		/* check for a console line in the boot args passed in from the
+		 * config file. If there is no console line and the enviornment
+		 * has a console variable add it to the bootargs
+		 */
+		if ( !strstr(label->append, "console=") ) {
+		      printf("no console= \n");
+		        if (getenv("console")) {
+		                sprintf(console, " console=%s",
+		                        getenv("console"));
+		        }
+		}
 
 		if (strlen(label->append ?: "") +
-		    strlen(ip_str) + strlen(mac_str) + 1 > sizeof(bootargs)) {
-			printf("bootarg overflow %zd+%zd+%zd+1 > %zd\n",
+		    strlen(ip_str) + strlen(mac_str) + strlen(console) +
+		    1 > sizeof(bootargs)) {
+			printf("bootarg overflow %zd+%zd+%zd+%zd+1 > %zd\n",
 			       strlen(label->append ?: ""),
 			       strlen(ip_str), strlen(mac_str),
+			       strlen(console),
 			       sizeof(bootargs));
 			return 1;
 		}
 
 		if (label->append)
 			strcpy(bootargs, label->append);
+		if (strlen(console) > 0)
+			strcat(bootargs, console);
 		strcat(bootargs, ip_str);
 		strcat(bootargs, mac_str);
 
-- 
2.3.2