summaryrefslogtreecommitdiff
path: root/sys/src/9/imx8/main.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-10-31 12:44:09 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-10-31 12:44:09 +0000
commit8b5714139bb0d965eb626f87115964d8dcad04af (patch)
tree89adc3a525d83f30c3773e8c2614609120c54405 /sys/src/9/imx8/main.c
parent297c6d8c490ea934a4cd968d9edc5656ecd209a4 (diff)
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.
Diffstat (limited to 'sys/src/9/imx8/main.c')
-rw-r--r--sys/src/9/imx8/main.c17
1 files changed, 14 insertions, 3 deletions
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();
}