Discussion:
Is here way to have 9600+ serial console and see boot0 message?
Lev Serebryakov
2018-09-05 17:12:08 UTC
Permalink
I want to have my serial console 115200 (of course), *including* BIOS
redirection (which goes before boot0sio).

But boot0sio supports only speeds up to 9600 (due to int 14h limitations).

Is it possible to solve this clash somehow?
--
// Lev Serebryakov
Allan Jude
2018-09-05 17:19:06 UTC
Permalink
Post by Lev Serebryakov
I want to have my serial console 115200 (of course), *including* BIOS
redirection (which goes before boot0sio).
But boot0sio supports only speeds up to 9600 (due to int 14h limitations).
Is it possible to solve this clash somehow?
/boot/loader reads /boot.config where you can put -S115200

Try that
--
Allan Jude
Lev Serebryakov
2018-09-05 17:22:32 UTC
Permalink
Post by Allan Jude
Post by Lev Serebryakov
I want to have my serial console 115200 (of course), *including* BIOS
redirection (which goes before boot0sio).
But boot0sio supports only speeds up to 9600 (due to int 14h limitations).
Is it possible to solve this clash somehow?
/boot/loader reads /boot.config where you can put -S115200
I think, /boot/boot reads /boot.config, and it works for me.

My question is somewhat more tricky: I have 115200 BEFORE boot0sio
(from BIOS) and I have 115200 AFTER boot0sio (from /boot/boot and
/boot/loader later). And I want to see "F1 / F2" boot selection from
boot0sio.
--
// Lev Serebryakov
Jung-uk Kim
2018-09-05 18:12:55 UTC
Permalink
Post by Lev Serebryakov
Post by Allan Jude
Post by Lev Serebryakov
I want to have my serial console 115200 (of course), *including* BIOS
redirection (which goes before boot0sio).
But boot0sio supports only speeds up to 9600 (due to int 14h limitations).
Is it possible to solve this clash somehow?
/boot/loader reads /boot.config where you can put -S115200
I think, /boot/boot reads /boot.config, and it works for me.
My question is somewhat more tricky: I have 115200 BEFORE boot0sio
(from BIOS) and I have 115200 AFTER boot0sio (from /boot/boot and
/boot/loader later). And I want to see "F1 / F2" boot selection from
boot0sio.
Put this line in /etc/make.conf.

BOOT_BOOT0_COMCONSOLE_SPEED=0

Then, boot0sio will not change serial port configuration.

Jung-uk Kim
Lev Serebryakov
2018-09-06 15:30:12 UTC
Permalink
Post by Jung-uk Kim
Put this line in /etc/make.conf.
BOOT_BOOT0_COMCONSOLE_SPEED=0
Then, boot0sio will not change serial port configuration.
I've tried this, and it doesn't help. Maybe, BIOS reset settings before
calling boot code.
--
// Lev Serebryakov
Gary Jennejohn
2018-09-06 17:11:09 UTC
Permalink
On Thu, 6 Sep 2018 18:30:12 +0300
Post by Lev Serebryakov
Post by Jung-uk Kim
Put this line in /etc/make.conf.
BOOT_BOOT0_COMCONSOLE_SPEED=0
Then, boot0sio will not change serial port configuration.
I've tried this, and it doesn't help. Maybe, BIOS reset settings before
calling boot code.
The answer is in the Makefile. All possible supported baud rates
are checked there. If the value set in
BOOT_BOOT0_COMCONSOLE_SPEED does not match one of the
pre-defined values, it defaults to 9600 baud. Since 0 is not a
valid baudrate, 9600 is used.
--
Gary Jennejohn
Lev Serebryakov
2018-09-06 17:17:28 UTC
Permalink
Post by Gary Jennejohn
Post by Lev Serebryakov
Post by Jung-uk Kim
Put this line in /etc/make.conf.
BOOT_BOOT0_COMCONSOLE_SPEED=0
Then, boot0sio will not change serial port configuration.
I've tried this, and it doesn't help. Maybe, BIOS reset settings before
calling boot code.
The answer is in the Makefile. All possible supported baud rates
are checked there. If the value set in
BOOT_BOOT0_COMCONSOLE_SPEED does not match one of the
pre-defined values, it defaults to 9600 baud. Since 0 is not a
valid baudrate, 9600 is used.
Nope. If BOOT_BOOT0_COMCONSOLE_SPEED defined, it is used as-is. If it
is not defined it is derived from BOOT_COMCONSOLE_SPEED. So, defining it
to "0" should work. And disassembling boot0sio confirms it.

.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED)
BOOT_COMCONSOLE_SPEED?= 9600
.if ${BOOT_COMCONSOLE_SPEED} == 9600
BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 4800
BOOT_BOOT0_COMCONSOLE_SPEED= "6 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 2400
BOOT_BOOT0_COMCONSOLE_SPEED= "5 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 1200
BOOT_BOOT0_COMCONSOLE_SPEED= "4 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 600
BOOT_BOOT0_COMCONSOLE_SPEED= "3 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 300
BOOT_BOOT0_COMCONSOLE_SPEED= "2 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 150
BOOT_BOOT0_COMCONSOLE_SPEED= "1 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 110
BOOT_BOOT0_COMCONSOLE_SPEED= "0 << 5 + 3"
.else
BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
.endif
.endif
--
// Lev Serebryakov
Craig Leres
2018-09-06 19:45:04 UTC
Permalink
Post by Lev Serebryakov
Nope. If BOOT_BOOT0_COMCONSOLE_SPEED defined, it is used as-is. If it
is not defined it is derived from BOOT_COMCONSOLE_SPEED. So, defining it
to "0" should work. And disassembling boot0sio confirms it.
.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED)
BOOT_COMCONSOLE_SPEED?= 9600
.if ${BOOT_COMCONSOLE_SPEED} == 9600
BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 4800
BOOT_BOOT0_COMCONSOLE_SPEED= "6 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 2400
BOOT_BOOT0_COMCONSOLE_SPEED= "5 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 1200
BOOT_BOOT0_COMCONSOLE_SPEED= "4 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 600
BOOT_BOOT0_COMCONSOLE_SPEED= "3 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 300
BOOT_BOOT0_COMCONSOLE_SPEED= "2 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 150
BOOT_BOOT0_COMCONSOLE_SPEED= "1 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 110
BOOT_BOOT0_COMCONSOLE_SPEED= "0 << 5 + 3"
.else
BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
.endif
.endif
Maybe I don't understand what you're saying but I don't think defining
to "0" is the same as not defining.

Craig

hot 84 % cat c.c
#include <stdio.h>
#include <stdlib.h>

int main(int, char **);

#define FOO
#define BAR 0
#define BLETCH 1

int
main(int argc, char **argv)
{
#ifdef FOO
printf("#ifdef FOO\n");
#endif
#if defined(FOO)
printf("#if defined(FOO)\n");
#endif

#ifdef BAR
printf("#ifdef BAR\n");
#endif
#if defined(BAR)
printf("#if defined(BAR)\n");
#endif

#ifdef BLETCH
printf("#ifdef BLETCH\n");
#endif
#if defined(BLETCH)
printf("#if defined(BLETCH)\n");
#endif

#ifdef FNORD
printf("#ifdef FNORD\n");
#endif
#if defined(FNORD)
printf("#if defined(FNORD)\n");
#endif

exit(0);
}
hot 85 % cc c.c && ./a.out
#ifdef FOO
#if defined(FOO)
#ifdef BAR
#if defined(BAR)
#ifdef BLETCH
#if defined(BLETCH)
Jung-uk Kim
2018-09-06 20:01:13 UTC
Permalink
Post by Craig Leres
   Nope. If BOOT_BOOT0_COMCONSOLE_SPEED defined, it is used as-is. If it
is not defined it is derived from BOOT_COMCONSOLE_SPEED. So, defining it
to "0" should work. And disassembling boot0sio confirms it.
.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED)
BOOT_COMCONSOLE_SPEED?=    9600
.if ${BOOT_COMCONSOLE_SPEED} == 9600
BOOT_BOOT0_COMCONSOLE_SPEED=    "7 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 4800
BOOT_BOOT0_COMCONSOLE_SPEED=    "6 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 2400
BOOT_BOOT0_COMCONSOLE_SPEED=    "5 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 1200
BOOT_BOOT0_COMCONSOLE_SPEED=    "4 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 600
BOOT_BOOT0_COMCONSOLE_SPEED=    "3 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 300
BOOT_BOOT0_COMCONSOLE_SPEED=    "2 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 150
BOOT_BOOT0_COMCONSOLE_SPEED=    "1 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 110
BOOT_BOOT0_COMCONSOLE_SPEED=    "0 << 5 + 3"
.else
BOOT_BOOT0_COMCONSOLE_SPEED=    "7 << 5 + 3"
.endif
.endif
Maybe I don't understand what you're saying but I don't think defining
to "0" is the same as not defining.
...

Defining BOOT_BOOT0_COMCONSOLE_SPEED to 0 is not the same as not
defining, of course. However, setting it to 0 lets us add
"-DCOMSPEED=0" to CFLAGS[1] and we can skip port configuration[2].

Jung-uk Kim

1.
https://svnweb.freebsd.org/base/head/stand/i386/boot0/Makefile?revision=328769&view=markup#l75
2.
https://svnweb.freebsd.org/base/head/stand/i386/boot0/boot0.S?revision=325834&view=markup#l211
Lev Serebryakov
2018-09-06 20:08:38 UTC
Permalink
Post by Craig Leres
   Nope. If BOOT_BOOT0_COMCONSOLE_SPEED defined, it is used as-is. If it
is not defined it is derived from BOOT_COMCONSOLE_SPEED. So, defining it
to "0" should work. And disassembling boot0sio confirms it.
.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED)
BOOT_COMCONSOLE_SPEED?=    9600
.if ${BOOT_COMCONSOLE_SPEED} == 9600
BOOT_BOOT0_COMCONSOLE_SPEED=    "7 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 4800
BOOT_BOOT0_COMCONSOLE_SPEED=    "6 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 2400
BOOT_BOOT0_COMCONSOLE_SPEED=    "5 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 1200
BOOT_BOOT0_COMCONSOLE_SPEED=    "4 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 600
BOOT_BOOT0_COMCONSOLE_SPEED=    "3 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 300
BOOT_BOOT0_COMCONSOLE_SPEED=    "2 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 150
BOOT_BOOT0_COMCONSOLE_SPEED=    "1 << 5 + 3"
.elif ${BOOT_COMCONSOLE_SPEED} == 110
BOOT_BOOT0_COMCONSOLE_SPEED=    "0 << 5 + 3"
.else
BOOT_BOOT0_COMCONSOLE_SPEED=    "7 << 5 + 3"
.endif
.endif
Maybe I don't understand what you're saying but I don't think defining
to "0" is the same as not defining.
It is exactly what I've said: defining it to "0" bypass all these
checks for permitted value.
--
// Lev Serebryakov
Dimitry Andric
2018-09-05 18:14:41 UTC
Permalink
Post by Lev Serebryakov
Post by Allan Jude
Post by Lev Serebryakov
I want to have my serial console 115200 (of course), *including* BIOS
redirection (which goes before boot0sio).
But boot0sio supports only speeds up to 9600 (due to int 14h limitations).
Is it possible to solve this clash somehow?
/boot/loader reads /boot.config where you can put -S115200
I think, /boot/boot reads /boot.config, and it works for me.
My question is somewhat more tricky: I have 115200 BEFORE boot0sio
(from BIOS) and I have 115200 AFTER boot0sio (from /boot/boot and
/boot/loader later). And I want to see "F1 / F2" boot selection from
boot0sio.
Recompile stand/i386 with BOOT_BOOT0_COMCONSOLE_SPEED=115200, I would
normally say, but apparently stand/i386/boot0 is limited to a maximum
of 9600 baud. This looks like a BIOS int 0x14 limitation. :(

-Dimitry
Warner Losh
2018-09-05 18:56:19 UTC
Permalink
Post by Lev Serebryakov
Post by Lev Serebryakov
Post by Allan Jude
Post by Lev Serebryakov
I want to have my serial console 115200 (of course), *including* BIOS
redirection (which goes before boot0sio).
But boot0sio supports only speeds up to 9600 (due to int 14h
limitations).
Post by Lev Serebryakov
Post by Allan Jude
Post by Lev Serebryakov
Is it possible to solve this clash somehow?
/boot/loader reads /boot.config where you can put -S115200
I think, /boot/boot reads /boot.config, and it works for me.
My question is somewhat more tricky: I have 115200 BEFORE boot0sio
(from BIOS) and I have 115200 AFTER boot0sio (from /boot/boot and
/boot/loader later). And I want to see "F1 / F2" boot selection from
boot0sio.
Recompile stand/i386 with BOOT_BOOT0_COMCONSOLE_SPEED=115200, I would
normally say, but apparently stand/i386/boot0 is limited to a maximum
of 9600 baud. This looks like a BIOS int 0x14 limitation. :(
Only way around this I know is to recede boot0sio to go right to the
uart... I tried this years ago, but overflowed 512 limits...

Warner
Lev Serebryakov
2018-09-06 15:16:05 UTC
Permalink
Post by Warner Losh
Only way around this I know is to recede boot0sio to go right to the
uart...  I tried this years ago, but overflowed 512 limits...
I've tried it just now, and, yes, it needs space for another 18
commands to init UART…
--
// Lev Serebryakov
Ian Lepore
2018-09-06 15:31:24 UTC
Permalink
Post by Warner Losh
Only way around this I know is to recede boot0sio to go right to the
uart...  I tried this years ago, but overflowed 512 limits...
 I've tried it just now, and, yes, it needs space for another 18
commands to init UART…
Did you miss the suggestion to set BOOT_BOOT0_COMCONSOLE_SPEED=0 in
make.conf, so that whatever speed is configured in the BIOS is left
unchanged?

-- Ian
Lev Serebryakov
2018-09-06 15:43:31 UTC
Permalink
Post by Ian Lepore
Post by Warner Losh
uart...  I tried this years ago, but overflowed 512 limits...
 I've tried it just now, and, yes, it needs space for another 18
commands to init UART…
Did you miss the suggestion to set BOOT_BOOT0_COMCONSOLE_SPEED=0 in
make.conf, so that whatever speed is configured in the BIOS is left
unchanged?
I've tried this. It doesn't help. I don't know why, but symptoms are
the same: after BIOS messages terminal (it is software one, of course)
clears, cursor moves chaotically without any real output, and this
behavior continues till I issue "Reset Terminal" command via terminal
program menu. After terminal reset all output (from loader, kernel and,
later, getty) shows normally.

I've even dumped & disassembled new MBR code to be sure, that I
installed new version. Yep, it doesn't contain this call in the
beginning (after relocation).
--
// Lev Serebryakov
Lev Serebryakov
2018-09-07 09:13:05 UTC
Permalink
Hello Lev,
Post by Lev Serebryakov
I've tried this. It doesn't help. I don't know why, but symptoms are
the same: after BIOS messages terminal (it is software one, of course)
clears, cursor moves chaotically without any real output, and this
behavior continues till I issue "Reset Terminal" command via terminal
program menu. After terminal reset all output (from loader, kernel and,
later, getty) shows normally.
Ok, I found "<ESC>[2;30;40m" in BIOS output. Set "Black on black".

Now I'm trying to squeeze sending of "<ESC>c" (reset) into boot0sio.
--
Best regards,
Lev mailto:***@FreeBSD.org
Continue reading on narkive:
Loading...