Skip to main content.

How to use hardware monitors with NetBSD

Today, there are various environmental sensor ICs available on modern mainboards, which are able of monitoring fan speed, cpu and system temperature, and voltage for example. NetBSD currently supports the National Semiconductor LM78, LM79 and compatible hardware monitors (the lm(4) device), the VIA VT82C686A hardware monitor (the viaenv(4) device) and ACPI aware hardware monitors (the acpi(4) subsystem) through its Environmental Systems API. These devices are not enabled by default, you need to recompile your kernel with the following additional lines in your kernel config file:

For the National Semiconductor LM78, LM79 and compatible monitors (you may need to adjust the I/O port settings):

lm0 at isa? port 0x290

For the VIA VT82C686A hardware monitor:

viapm* at pci? dev ? function ?
viaenv* at viapm?

For ACPI enabled monitors (thanks to Joel Carnat for the hint):

options MPACPI
acpi0 at mainbus0
acpiacad at acpi?
acpibat* at acpi?
acpibut* at acpi?
acpiec* at acpi?
acpilid* at acpi?
acpitz* at acpi?

After booting your new kernel, you can access your hardware sensors, using the envstat(8) command. For example, to display all supported sensors, type envstat -l, and to actually read the environmental sensors, simply type envstat. For more information about using the envstat(8) tool, refer to the manpage.

What to put in /etc/mk.conf

In order to get a sane build environment and to build sane packages out of your environment, you should consider overriding some default values in your /etc/mk.conf. For example, if you are running NetBSD/alpha, you shouldn't use any optimizations to cc(1), because gcc is still buggy on Alpha. And in general you should think twice before setting the optimization level above 2, because this might cause several programs to segfault frequently or not run at all. Here are some lines from my mk.conf, which might help you (they will honor all default values but -O*):


When trying to fix bugs in packages, it is helpful to append -Wall -Werror to COMMONCFLAGS, but beware: This might break a lot of configure scripts (so, you have the chance to fix them too ;-). Another needful thing to have in your mk.conf is support for sudo instead of the default su(1), so you may need not to type the root password everytime you install a package as a user. Here are the lines from my mk.conf:

.if exists(/usr/pkg/bin/sudo)
SU_CMD=/usr/pkg/bin/sudo /bin/sh -c

Another helpful thing to do, is to override the default MASTER_SITE with faster (local) mirrors. E.g. I have a local NetBSD mirror (thats the tatooine.kosmos.all line, so don't simply copy&paste to your mk.conf :-), from where pkgsrc should try to fetch the needed distfiles first and after that fails, it will try several other mirrors, and only if a distfile cannot be found there, it'll try to fetch it from the MASTER_SITEs specified for the package. Here are the lines from my mk.conf:

 ftp://tatooine.kosmos.all/pub/NetBSD/packages/distfiles/ \ \ \ \

How to get NetBSD running on your Sega Dreamcast game console

Josh Tolbert <hemi at puresimplicity dot net> recently put together a lot of stuff related to the NetBSD/dreamcast port and created an easy to install NetBSD Dreamcast system along with a short introduction on how to setup your Dreamcast and what need to be done to increase the usuability of the NetBSD/dreamcast port (for now, focus on wscons(4) support for the Dreamcast framebuffer and getting POSIX threads to work). Josh's How-To and all stuff needed to get NetBSD working on your Dreamcast can found here.