The FreeBSD/i386 operating system can boot on a system with only a dumb terminal on a serial port as a console. Such a configuration should be useful for two classes of people; system administrators who wish to install FreeBSD on a dedicated file/compute/terminal server machines that have no keyboard or monitor attached, and developers who want to debug the kernel or device drivers.
Starting from version 3.1, FreeBSD/i386 employs a three stage bootstrap. The first two stages are in the boot block code which is stored at the beginning of the FreeBSD slice on the boot disk. The boot block will then load and run the boot loader (/boot/loader) as the third stage code. (See boot (8) and loader (8) for more details on the boot process.)
In order to set up the serial console you must configure the boot block code, the boot loader code and the kernel.
In FreeBSD version 3.0, the boot loader does not exist and there are only two stages in the bootstrap; the boot blocks directly load the kernel into memory. If you are using FreeBSD 3.0, then you should disregard any reference to the boot loader in this section. You can still use the serial port as a console.
FreeBSD versions 2.X are quite different from 3.X, in that the serial port driver, sio (4) , must be configured in a different way. This chapter will not describe the settings for version 2.X systems. If you are using these older versions of FreeBSD, please consult /sys/i386/boot/biosboot/README.serial instead.
Tip: Setting the keyboard to ``Not installed'' in the BIOS setup does not mean that you will not be able to use your keyboard. All this does is tell the BIOS not to probe for a keyboard at power-on so that it will not complain if the keyboard is not plugged in. You can leave the keyboard plugged in even with this flag set to ``Not installed'' and the keyboard will still work.
Note: If your system has a PS/2 mouse, chances are very good that you may have to unplug your mouse as well as your keyboard. This is because PS/2 mice share some hardware with the keyboard, and leaving the mouse plugged in can fool the keyboard probe into thinking the keyboard is still there. It is said that a Gateway 2000 Pentium 90Mhz system with an AMI BIOS that behaves this way. In general this is not a problem since the mouse is not much good without the keyboard anyway.
0x10 Enables console support for this unit. The other console flags are ignored unless this is set. Currently, at most one unit can have console support; the first one (in config file order) with this flag set is preferred. This option alone will not make the serial port the console. Set the following flag or use the -h option described below, together with this flag. 0x20 Forces this unit to be the console (unless there is another higher priority console), regardless of the -h option discussed below. This flag replaces the COMCONSOLE option in FreeBSD versions 2.X. The flag 0x20 must be used together with the 0x10 flag. 0x40 Reserves this unit (in conjunction with 0x10) and makes the unit unavailable for normal access. You should not set this flag to the serial port unit which you want to use as the serial console. The only use of this flag is to designate the unit for kernel remote debugging. See Chapter 23 for more information on remote debugging.
Note: In FreeBSD 4.0-CURRENT or later the semantics of the flag 0x40 are slightly different and there is another flag to specify a serial port for remote debugging.
device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4
-h Toggles internal and serial consoles. You can use this to switch console devices. For instance, if you boot from the internal (video) console, you can use -h to direct the boot loader and the kernel to use the serial port as its console device. Alternatively, if you boot from the serial port, you can use the -h to tell the boot loader and the kernel to use the video display as the console instead. -D Toggles single and dual console configurations. In the single configuration the console will be either the internal console (video display) or the serial port, depending on the state of the -h option above. In the dual console configuration, both the video display and the serial port will become the console at the same time, regardless of the state of the -h option. However, that the dual console configuration takes effect only during the boot block is running. Once the boot loader gets control, the console specified by the -h option becomes the only console. -P Makes the boot block probe the keyboard. If no keyboard is found, the -D and -h options are automatically set.
Note: Due to space constraints in the current version of the boot blocks, the -P option is capable of detecting extended keyboards only. Keyboards with less than 101 keys (and without F11 and F12 keys) may not be detected. Keyboards on some laptop computers may not be properly found because of this limitation. If this is to be the case with your system, you have to abandon using the -P option. Unfortunately there is no workaround for this problem.
/boot.config: -P Keyboard: no
The second line appears only if you put -P in /boot.config and indicates presence/absence of the keyboard. These messages go to either serial or internal console, or both, depending on the option in /boot.config.
Options | Message goes to |
---|---|
none | internal console |
-h | serial console |
-D | serial and internal consoles |
-Dh | serial and internal consoles |
-P, keyboard present | internal console |
-P, keyboard absent | serial console |
After the above messages, there will be a small pause before the boot blocks continue loading the boot loader and before any further messages printed to the console. Under normal circumstances, you do not need to interrupt the boot blocks, but you may want to do so in order to make sure things are set up correctly. Hit any key, other than Enter/Return, at the console to interrupt the boot process. The boot blocks will then prompt you for further action. You should now see something like:
>> FreeBSD/i386 BOOT Default: 0:wd(0,a)/boot/loader boot:
After the boot loader is loaded and you are in the third stage of the boot process you can still switch between the internal console and the serial console by setting appropriate environment variables in the boot loader. See Section 15.6.5.
Here is the summary of various settings discussed in this section and the console eventually selected.
device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4
Options in /boot.config | Console during boot blocks | Console during boot loader | Console in kernel |
---|---|---|---|
nothing | internal | internal | internal |
-h | serial | serial | serial |
-D | serial and internal | internal | internal |
-Dh | serial and internal | serial | serial |
-P, keyboard present | internal | internal | internal |
-P, keyboard absent | serial and internal | serial | serial |
device sio0 at isa? port "IO_COM1" tty flags 0x30 irq 4
Options in /boot.config | Console during boot blocks | Console during boot loader | Console in kernel |
---|---|---|---|
nothing | internal | internal | serial |
-h | serial | serial | serial |
-D | serial and internal | internal | serial |
-Dh | serial and internal | serial | serial |
-P, keyboard present | internal | internal | serial |
-P, keyboard absent | serial and internal | serial | serial |
By default the serial port settings are set to 9600 baud, 8 bits, no parity, 1 stop bit. If you wish to change the speed, you need to recompile at least the boot blocks. Add the following line to /etc/make.conf and compile new boot blocks:
BOOT_COMCONSOLE_SPEED=19200
If the serial console is configured in some other way than by booting with -h, or if the serial console used by the kernel is different from the one used by the boot blocks, then you must also add the following option to the kernel configuration file and compile a new kernel:
options CONSPEED=19200
Using a port other than sio0 as the console requires some recompiling. If you want to use another serial port for whatever reasons, recompile the boot blocks, the boot loader and the kernel as follows.
device sio1 at isa? port "IO_COM2" tty flags 0x10 irq 3
device sio1 at isa? port "IO_COM2" tty flags 0x30 irq 3
# cd /sys/boot/i386/boot2 # make # make install
# cd /sys/boot/i386/loader # make # make install
If you wish to drop into the kernel debugger from the serial console (useful for remote diagnostics, but also dangerous if you generate a spurious BREAK on the serial port!) then you should compile your kernel with the following options:
options BREAK_TO_DEBUGGER options DDB
While this is not required, you may wish to get a login prompt over the serial line, now that you can see boot messages and can enter the kernel debugging session through the serial console. Here is how to do it.
Open the file /etc/ttys with an editor and locate the lines:
ttyd0 "/usr/libexec/getty std.9600" unknown off secure ttyd1 "/usr/libexec/getty std.9600" unknown off secure ttyd2 "/usr/libexec/getty std.9600" unknown off secure ttyd3 "/usr/libexec/getty std.9600" unknown off secure
ttyd0 through ttyd3 corresponds to COM1 through COM4. Change off to on for the desired port. If you have changed the speed of the serial port, you need to change std.9600 to match the current setting, e.g. std.19200.
You may also want to change the terminal type from unknown to the actual type of your serial terminal.
After editing the file, you must kill -HUP 1 to make this change take effect.
Previous sections described how to set up the serial console by tweaking the boot block. This section shows that you can specify the console by entering some commands and environment variables in the boot loader. As the boot loader is invoked as the third stage of the boot process, after the boot block, the settings in the boot loader will override the settings in the boot block.
You can easily specify the boot loader and the kernel to use the serial console by writing just one line in /boot/loader.rc:
set console=comconsole
This will take effect regardless of the settings in the boot block discussed in the previous section.
You had better put the above line as the first line of /boot/loader.rc so as to see boot messages on the serial console as early as possible.
Likewise, you can specify the internal console as:
set console=vidconsole
If you do not set the boot loader environment variable console, the boot loader, and subsequently the kernel, will use whichever console indicated by the -h option in the boot block.
In versions 3.2 or later, you may specify the console in /boot/loader.conf.local or /boot/loader.conf, rather than in /boot/loader.rc. In this method your /boot/loader.rc should look like:
include /boot/loader.4th start
Then, create /boot/loader.conf.local and put the following line there.
console=comconsole
console=vidconsole
See loader.conf (5) for more information.
Note: At the moment, the boot loader has no option equivalent to the -P option in the boot block, and there is no provision to automatically select the internal console and the serial console based on the presence of the keyboard.
The idea here is to allow people to set up dedicated servers that require no graphics hardware or attached keyboards. Unfortunately, while (most?) every system will let you boot without a keyboard, there are quite a few that will not let you boot without a graphics adapter. Machines with AMI BIOSes can be configured to boot with no graphics adapter installed simply by changing the `graphics adapter' setting in the CMOS configuration to `Not installed.'
However, many machines do not support this option and will refuse to boot if you have no display hardware in the system. With these machines, you'll have to leave some kind of graphics card plugged in, (even if it's just a junky mono board) although you will not have to attach a monitor into it. You might also try installing an AMI BIOS.
Prev | Home | Next |
Dial-out Service | Up | PPP and SLIP |
For questions about FreeBSD, read the documentation before contacting .
For questions about this documentation, e-mail .