Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: serial console device, and installboot vs. /boot.cfg



On Thu, Feb 08, 2024 at 11:34:58AM +0100, Martin Husemann wrote:
> You can use consdev in /boot.cfg and it works for me (but with a different
> syntax):
> 
> --8<--
> consdev=com0
> menu=Native amd64:boot hd0e:/netbsd
> ...
>
> The "consdev" command is independend from menu, otherwise you would see the
> menu on the framebuffer and only switch to serial once you selected one
> of the options.

This was very useful -- thanks!  boot.cfg(5) examples only showed consdev
in-line with menu= keywords, and I glossed over the fact that it's also a
standalone keyword itself. 

To start with a simple experiment, I merely added consdev at top of the
default /boot.cfg, e.g.

consdev=com0,115200
menu=Boot normally:rndseed /var/db/entropy-file;boot
menu=Boot single user:rndseed /var/db/entropy-file;boot -s
menu=Drop to boot prompt:prompt
default=1
timeout=5
clear=1

and rebooted. My previously-installed serial boot blocks were still in
so I expected no behavior change, and there weren't -- serial console is
still active, from loader banner to boot messages to login: as before.

Then I removed the serial console boot blocks, putting the config back
to what the NetBSD 9.3 install originally gave me:

raptor# installboot -v -e -o console=pc,speed=9600 /dev/wd0a
File system:         /dev/rwd0a
Boot options:        timeout 5, flags 0, speed 9600, ioaddr 0, console pc

On reboot, I was quite pleased to see the serial console just as active
as before, and:

raptor# dmesg | grep console
[     1.053590] com0: console

Finally, I commmented consdev= in /boot.cfg and rebooted to un-do the
successful experiment; console reverted to the PC keyboard as expected.

So a standalone "consdev=" line early in /boot.cfg is indeed useful, e.g.
if you want to avoid changing default bootstrap config for some reason.

Overall, I now believe for serial console you need one of:

  - installed serial bootstrap config
Or
  - consdev=com0[,speed] in /boot.cfg

but both are apparently not required. And e.g. in my semi- real-world
keyboard+VGA crash cart scenario, to switch consoles you'd (un)comment
the consdev line in /boot.cfg rather than rewriting bootstrap options;
this feels less intrusive to me.

In retrospect, maybe this is all expected and I'm the only one being
"enlightened" :-) .

But, the relationship and interaction between bootstrap programs and
their options vs. boot options in /boot.cfg for console selection wasn't
entirely clear to me from the man pages -- spending more time trying to
follow boot(8) for starters might have helped me.

Also, examples you're likely to find online and in the mailing lists
archives typically configure both of bootstrap and /boot.cfg , perhaps
out of habit, or other folks simply have different configuration needs.

> For 10: there should be no relevant differences.

We'll find out. :-)  I need to put a new sysdisk in this PC anyway, and
that seems a good time to validate this same config procedure with 10.

Thanks again, this is turning out quite well for my purposes!

sr.


Home | Main Index | Thread Index | Old Index