From 8b5714139bb0d965eb626f87115964d8dcad04af Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 31 Oct 2022 12:44:09 +0000 Subject: reform: only override console=0 when no plan9.ini is passed The kernel used to always set console=0, which as usefull during bring-up, but makes it impossible to use the uart for other purposes. We now have the ability to pass plan9.ini using the u-boot script, so add the console=0 line there. To make debugging easy, we still apply console=0 if no plan9.ini has been passed. --- sys/src/9/imx8/main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'sys/src') diff --git a/sys/src/9/imx8/main.c b/sys/src/9/imx8/main.c index 3ccd91ee1..901a41c68 100644 --- a/sys/src/9/imx8/main.c +++ b/sys/src/9/imx8/main.c @@ -17,7 +17,7 @@ Conf conf; #define MAXCONF 64 static char *confname[MAXCONF]; static char *confval[MAXCONF]; -static int nconf; +static int nconf = -1; void bootargsinit(void) @@ -28,7 +28,7 @@ bootargsinit(void) /* * parse configuration args from dos file plan9.ini */ - cp = BOOTARGS; /* where b.com leaves its config */ + cp = BOOTARGS; cp[BOOTARGSLEN-1] = 0; /* @@ -47,6 +47,12 @@ bootargsinit(void) *p = 0; n = getfields(cp, line, MAXCONF, 1, "\n"); + if(n <= 0){ + /* empty plan9.ini, no configuration passed */ + return; + } + + nconf = 0; for(i = 0; i < n; i++){ if(*line[i] == '#') continue; @@ -81,6 +87,12 @@ setconfenv(void) { int i; + if(nconf < 0){ + /* use defaults when there was no configuration */ + ksetenv("console", "0", 0); + return; + } + for(i = 0; i < nconf; i++){ if(confname[i][0] != '*') ksetenv(confname[i], confval[i], 0); @@ -138,7 +150,6 @@ init0(void) ksetenv("service", "cpu", 0); else ksetenv("service", "terminal", 0); - ksetenv("console", "0", 0); setconfenv(); poperror(); } -- cgit v1.2.3