public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] pxe: automatically add console= to bootargs when not specified in append
@ 2014-08-01  7:46 Hans de Goede
  2014-08-01  8:20 ` Hans de Goede
  2014-08-01 19:01 ` Stephen Warren
  0 siblings, 2 replies; 4+ messages in thread
From: Hans de Goede @ 2014-08-01  7:46 UTC (permalink / raw)
  To: u-boot

From: Dennis Gilmore <dennis@ausil.us>

if there is a console variable in the u-boot environment and not one on
the append line from syslinux config add what is in the environment to
the bootargs.

This is necessary to allow distros to have a single extlinux/extlinux.conf
file which will work on multiple boards, even if these boards have different
consoles (e.g. ttyS0 vs ttyAMA0).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 common/cmd_pxe.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index ba48692..147d7d1 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -606,6 +606,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 	char initrd_str[22];
 	char mac_str[29] = "";
 	char ip_str[68] = "";
+	char console[30] = "";
 	char *bootargs;
 	int bootm_argc = 3;
 	int len = 0;
@@ -665,8 +666,14 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 	}
 #endif
 
-	if (label->append)
+	if (label->append) {
 		len += strlen(label->append);
+		/* If no console in append and $console is set, use it */
+		if (!strstr(label->append, "console=") && getenv("console")) {
+			sprintf(console, " console=%s", getenv("console"));
+			len += strlen(console);
+		}
+	}
 
 	if (len) {
 		bootargs = malloc(len + 1);
@@ -675,6 +682,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		bootargs[0] = '\0';
 		if (label->append)
 			strcpy(bootargs, label->append);
+		strcat(bootargs, console);
 		strcat(bootargs, ip_str);
 		strcat(bootargs, mac_str);
 
-- 
2.0.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-01 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-01  7:46 [U-Boot] [PATCH] pxe: automatically add console= to bootargs when not specified in append Hans de Goede
2014-08-01  8:20 ` Hans de Goede
2014-08-01  8:35   ` Hans de Goede
2014-08-01 19:01 ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox