FreeBSD Handbook : Serial Communications : Dialin Service : Kernel Configuration
Previous: Quick Overview
Next: Device Special Files

14.3.3. Kernel Configuration

FreeBSD kernels typically come prepared to search for four serial ports, known in the PC-DOS world as COM1:, COM2:, COM3:, and COM4:. FreeBSD can presently also handle ``dumb'' multiport serial interface cards, such as the Boca Board 1008 and 2016 (please see the manual page sio(4) for kernel configuration information if you have a multiport serial card). The default kernel only looks for the standard COM ports, though.

To see if your kernel recognizes any of your serial ports, watch for messages while the kernel is booting, or use the /sbin/dmesg command to replay the kernel's boot messages. In particular, look for messages that start with the characters sio. Hint: to view just the messages that have the word sio, use the command:

/sbin/dmesg | grep 'sio'

For example, on a system with four serial ports, these are the serial-port specific kernel boot messages:

sio0 at 0x3f8-0x3ff irq 4 on isa
sio0: type 16550A
sio1 at 0x2f8-0x2ff irq 3 on isa
sio1: type 16550A
sio2 at 0x3e8-0x3ef irq 5 on isa
sio2: type 16550A
sio3 at 0x2e8-0x2ef irq 9 on isa
sio3: type 16550A

If your kernel does not recognize all of your serial ports, you will probably need to configure a custom FreeBSD kernel for your system.

Please see the BSD System Manager's Manual chapter on ``Building Berkeley Kernels with Config'' [the source for which is in /usr/src/share/doc/smm] and ``FreeBSD Configuration Options'' [in /sys/conf/options and in /sys/arch/conf/options.arch, with arch for example being i386] for more information on configuring and building kernels. You may have to unpack the kernel source distribution if have not installed the system sources already (srcdist/srcsys.?? in FreeBSD 1.1, srcdist/sys.?? in FreeBSD 1.1.5.1, or the entire source distribution in FreeBSD 2.0) to be able to configure and build kernels.

Create a kernel configuration file for your system (if you have not already) by cding to /sys/i386/conf. Then, if you are creating a new custom configuration file, copy the file GENERICAH (or GENERICBT, if you have a BusTek SCSI controller on FreeBSD 1.x) to YOURSYS, where YOURSYS is the name of your system, but in upper-case letters. Edit the file, and change the device lines:

device		sio0	at isa? port "IO_COM1" tty irq 4 vector siointr
device		sio1	at isa? port "IO_COM2" tty irq 3 vector siointr
device		sio2	at isa? port "IO_COM3" tty irq 5 vector siointr
device		sio3	at isa? port "IO_COM4" tty irq 9 vector siointr

You can comment-out or completely remove lines for devices you do not have. If you have a multiport serial board, such as the Boca Board BB2016, please see the sio(4) man page for complete information on how to write configuration lines for multiport boards. Be careful if you are using a configuration file that was previously used for a different version of FreeBSD because the device flags have changed between versions.

Note that port "IO_COM1" is a substitution for port 0x3f8, IO_COM2 is 0x2f8, IO_COM3 is 0x3e8, and IO_COM4 is 0x2e8, which are fairly common port addresses for their respective serial ports; interrupts 4, 3, 5, and 9 are fairly common interrupt request lines. Also note that regular serial ports cannot share interrupts on ISA-bus PCs (multiport boards have on-board electronics that allow all the 16550A's on the board to share one or two interrupt request lines).

When you are finished adjusting the kernel configuration file, use the program config as documented in ``Building Berkeley Kernels with Config'' and the config(8) manual page to prepare a kernel building directory, then build, install, and test the new kernel.


FreeBSD Handbook : Serial Communications : Dialin Service : Kernel Configuration
Previous: Quick Overview
Next: Device Special Files