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.
This commit is contained in:
cinap_lenrek 2022-10-31 12:44:09 +00:00
parent 297c6d8c49
commit 8b5714139b
2 changed files with 17 additions and 4 deletions

4
sys/lib/dist/mkfile vendored
View file

@ -92,7 +92,9 @@ cd:V: /tmp/9front.386.iso.gz
@{
objtype=arm64
kernel=/n/src9/$objtype/9reform.u
echo 'bootargs=local!/dev/sdM0/fs' > /env/plan9.ini
> /env/plan9.ini {
echo 'console=0'
}
fatfiles=(/n/src9/sys/src/boot/reform/boot.scr /env/plan9.ini $kernel)
mb=1885 # storage vendors idea of 2GB
mk $target.$pid.disk

View file

@ -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();
}