xref: /freebsd/share/man/man4/syscons.4 (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
1.\"
2.\" Copyright (c) 1999
3.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer as
11.\"    the first lines of this file unmodified.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" $FreeBSD$
28.\"
29.Dd June 2, 2018
30.Dt SYSCONS 4
31.Os
32.Sh NAME
33.Nm syscons ,
34.Nm sc
35.Nd the console driver
36.Sh SYNOPSIS
37.Cd "options MAXCONS=N"
38.Cd "options SC_ALT_MOUSE_IMAGE"
39.Cd "options SC_CUT_SEPCHARS=_characters_"
40.Cd "options SC_CUT_SPACES2TABS"
41.Cd "options SC_DFLT_TERM"
42.Cd "options SC_DISABLE_KDBKEY"
43.Cd "options SC_DISABLE_REBOOT"
44.Cd "options SC_HISTORY_SIZE=N"
45.Cd "options SC_MOUSE_CHAR=C"
46.Cd "options SC_NO_CUTPASTE"
47.Cd "options SC_NO_FONT_LOADING"
48.Cd "options SC_NO_HISTORY"
49.Cd "options SC_NO_PALETTE_LOADING"
50.Cd "options SC_NO_SUSPEND_VTYSWITCH"
51.Cd "options SC_NO_SYSMOUSE"
52.Cd "options SC_NO_TERM_DUMB"
53.Cd "options SC_NO_TERM_SC"
54.Cd "options SC_NO_TERM_SCTEKEN"
55.Cd "options SC_PIXEL_MODE"
56.Cd "options SC_TWOBUTTON_MOUSE"
57.Cd "options SC_NORM_ATTR=_attribute_"
58.Cd "options SC_NORM_REV_ATTR=_attribute_"
59.Cd "options SC_KERNEL_CONS_ATTR=_attribute_"
60.Cd "options SC_KERNEL_CONS_ATTRS=_attributes_"
61.Cd "options SC_KERNEL_CONS_REV_ATTR=_attribute_"
62.Cd "options SC_DFLT_FONT"
63.Cd "makeoptions SC_DFLT_FONT=_font_name_"
64.Cd "device sc"
65.Pp
66In
67.Pa /boot/device.hints :
68.Cd hint.sc.0.at="isa"
69.Cd hint.sc.0.vesa_mode=0x103
70.Pp
71In
72.Pa /boot/loader.conf :
73.Cd kern.vty=sc
74.Sh DESCRIPTION
75The
76.Nm
77driver provides multiple virtual terminals.
78It resembles the SCO color console driver.
79.Pp
80The
81.Nm
82driver is implemented on top of the keyboard driver
83.Pq Xr atkbd 4
84and the video card driver
85.Pq Xr vga 4
86and so requires both of them to be configured in the system.
87.Pp
88There can be only one
89.Nm
90device defined in the system.
91.Ss Virtual Terminals
92The
93.Nm
94driver provides multiple virtual terminals which appear as if they were
95separate terminals.
96One virtual terminal is considered current and exclusively
97occupies the screen and the keyboard; the other virtual terminals
98are placed in the background.
99.Pp
100In order to use virtual terminals, they must be individually
101marked ``on'' in
102.Pa /etc/ttys
103so that
104.Xr getty 8
105will recognize them to be active and run
106.Xr login 1
107to let the user log in to the system.
108By default, only the first eight virtual terminals are activated in
109.Pa /etc/ttys .
110.Pp
111You press the
112.Dv Alt
113key and a switch key to switch between
114virtual terminals.
115The following table summarizes the correspondence between the switch
116key and the virtual terminal.
117.Bd -literal -offset indent
118Alt-F1   ttyv0      Alt-F7   ttyv6      Shift-Alt-F1   ttyva
119Alt-F2   ttyv1      Alt-F8   ttyv7      Shift-Alt-F2   ttyvb
120Alt-F3   ttyv2      Alt-F9   ttyv8      Shift-Alt-F3   ttyvc
121Alt-F4   ttyv3      Alt-F10  ttyv9      Shift-Alt-F4   ttyvd
122Alt-F5   ttyv4      Alt-F11  ttyva      Shift-Alt-F5   ttyve
123Alt-F6   ttyv5      Alt-F12  ttyvb      Shift-Alt-F6   ttyvf
124.Ed
125.Pp
126You can also use the ``nscr'' key (usually the
127.Dv PrintScreen
128key on the AT Enhanced keyboard) to cycle available virtual terminals.
129.Pp
130The default number of available virtual terminals is 16.
131This can be changed with the kernel configuration option
132.Dv MAXCONS
133(see below).
134.Pp
135Note that the X server usually requires a virtual terminal for display
136purposes, so at least one terminal must be left unused by
137.Xr getty 8
138so that it can be used by the X server.
139.Ss Key Definitions and Function Key Strings
140The
141.Nm
142driver, in conjunction with the keyboard driver, allows the user
143to change key definitions and function key strings.
144The
145.Xr kbdcontrol 1
146command will load a key definition file (known as ``keymap'' file),
147dump the current keymap, and assign a string to a function key.
148See
149.Xr keyboard 4
150and
151.Xr kbdmap 5
152for the keymap file.
153.Pp
154You may want to set the
155.Ar keymap
156variable in
157.Pa /etc/rc.conf.local
158to the desired keymap file so that it will be automatically loaded
159when the system starts up.
160.Ss Software Font
161For most modern video cards, e.g., VGA, the
162.Nm
163driver and the video card driver allow the user to change
164the font used on the screen.
165The
166.Xr vidcontrol 1
167command can be used to load a font file from
168.Pa /usr/share/syscons/fonts .
169.Pp
170The font comes in various sizes: 8x8, 8x14 and 8x16.
171The 8x16 font is typically used for the VGA card in the
17280-column-by-25-line mode.
173Other video modes may require different font sizes.
174It is better to always load all three sizes of the same font.
175.Pp
176You may set
177.Ar font8x8 ,
178.Ar font8x14
179and
180.Ar font8x16
181variables in
182.Pa /etc/rc.conf
183to the desired font files so that they will be automatically loaded
184when the system starts up.
185.Pp
186Optionally you can specify a particular font file as the default.
187See the
188.Dv SC_DFLT_FONT
189option below.
190.Ss Screen Map
191If your video card does not support software fonts, you may still be able
192to achieve a similar effect by re-mapping the font built into your video card.
193Use
194.Xr vidcontrol 1
195to load a screen map file which defines the mapping between character codes.
196.Ss Mouse Support and Copy-and-Paste
197You can use your mouse to copy text on the screen and paste it as if
198it was typed by hand.
199You must be running the mouse daemon
200.Xr moused 8
201and enable the mouse cursor in the virtual terminal via
202.Xr vidcontrol 1 .
203.Pp
204Pressing mouse button 1 (usually the left button) will start selection.
205Releasing button 1 will end the selection process.
206The selected text will be marked by inverting foreground and
207background colors.
208You can press button 3 (usually the right button) to extend
209the selected region.
210The selected text is placed in the copy buffer and can be pasted
211at the cursor position by pressing button 2 (usually the
212middle button) as many times as you like.
213.Pp
214If your mouse has only two buttons, you may want to use the
215.Dv SC_TWOBUTTON_MOUSE
216option below to make the right button to paste the text.
217Alternatively you can make the mouse daemon
218emulate the middle button.
219See the man page for
220.Xr moused 8
221for more details.
222.Ss Back Scrolling
223The
224.Nm
225driver allows the user to browse the output which has ``scrolled off''
226the top of the screen.
227.Pp
228Press the ``slock'' key (usually
229.Dv ScrllLock
230/
231.Dv Scroll Lock
232or
233.Dv Pause
234on many keyboards) and the terminal is
235in the ``scrollback'' mode.
236It is indicated by the
237.Dv Scroll Lock
238LED.
239Use the arrow keys, the
240.Dv Page Up/Down
241keys and the
242.Dv Home/End
243keys to scroll buffered terminal output.
244Press the ``slock'' key again to get back to the normal terminal mode.
245.Pp
246The size of the scrollback buffer can be set by the
247.Dv SC_HISTORY_SIZE
248option described below.
249.Ss Screen Saver
250The
251.Nm
252driver can be made to put up the screen saver if the current
253virtual terminal is idle, that is, the user is not typing
254on the keyboard nor moving the mouse.
255See
256.Xr splash 4
257and
258.Xr vidcontrol 1
259for more details.
260.Sh DRIVER CONFIGURATION
261.Ss Kernel Configuration Options
262The following kernel configuration options control the
263.Nm
264driver.
265.Bl -tag -width MOUSE
266.It Dv MAXCONS=N
267This option sets the number of virtual terminals to
268.Fa N .
269The default value is 16.
270.It Dv SC_ALT_MOUSE_IMAGE
271This option selects the alternative way of displaying the mouse cursor
272in the virtual terminal.
273It may be expensive for some video cards to draw the arrow-shaped
274cursor, and you may want to try this option.
275However, the appearance of the alternative mouse cursor may not be
276very appealing.
277Note that if you use the
278.Dv SC_NO_FONT_LOADING
279option then you must also use this option if you wish to be able to use
280the mouse.
281.It Dv SC_CUT_SEPCHARS=_characters_
282This options specifies characters that will be looked for when the
283driver searches for words boundaries when doing cut operation.
284By default, its value is
285.Qq Li \ex20
286\(em a space character.
287.It Dv SC_CUT_SPACES2TABS
288This options instructs the driver to convert leading spaces into tabs
289when copying data into cut buffer.
290This might be useful to preserve
291indentation when copying tab-indented text.
292.It Dv SC_DFLT_TERM=_name_
293This option specifies the name of the preferred terminal emulator.
294.It Dv SC_DISABLE_KDBKEY
295This option disables the ``debug'' key combination (by default, it is
296.Dv Alt-Esc ,
297or
298.Dv Ctl-PrintScreen ) .
299It will prevent users from
300entering the kernel debugger (KDB) by pressing the key combination.
301KDB will still be invoked when the kernel panics or hits a break point
302if it is included in the kernel.
303If this option is not defined, this behavior may be controlled at runtime
304by the
305.Xr sysctl 8
306variable
307.Va hw.syscons.kbd_debug .
308.It Dv SC_DISABLE_REBOOT
309This option disables the ``reboot'' key (by default, it is
310.Dv Ctl-Alt-Del ) ,
311so that the casual user may not accidentally reboot the system.
312If this option is not defined, this behavior may be controlled at runtime
313by the
314.Xr sysctl 8
315variable
316.Va hw.syscons.kbd_reboot .
317.It Dv SC_HISTORY_SIZE=N
318Sets the size of back scroll buffer to
319.Fa N
320lines.
321The default value is 100.
322.It Dv SC_MOUSE_CHAR=C
323Unless the
324.Dv SC_ALT_MOUSE_IMAGE
325option above is specified, the
326.Nm
327driver reserves four consecutive character codes in order to display the
328mouse cursor in the virtual terminals in some systems.
329This option specifies the first character code to
330.Fa C
331to be used for this purpose.
332The default value is 0xd0.
333A good candidate is 0x03.
334.It Dv SC_PIXEL_MODE
335Adds support for pixel (raster) mode console.
336This mode is useful on some laptop computers, but less so on
337most other systems, and it adds substantial amount of code to syscons.
338If this option is NOT defined, you can reduce the kernel size a lot.
339See the
340.Dv VESAMODE
341flag below.
342.It Dv SC_TWOBUTTON_MOUSE
343If you have a two button mouse, you may want to add this option
344to use the right button of the mouse to paste text.
345See
346.Sx Mouse Support and Copy-and-Paste
347above.
348.It Dv SC_NORM_ATTR=_attribute_
349.It Dv SC_NORM_REV_ATTR=_attribute_
350.It Dv SC_KERNEL_CONS_ATTR=_attribute_
351.It Dv SC_KERNEL_CONS_ATTRS=_attributes_
352.It Dv SC_KERNEL_CONS_REV_ATTR=_attribute_
353These options will set the default colors.
354Available colors are defined in
355.In machine/pc/display.h .
356See
357.Sx EXAMPLES
358below.
359.Dv SC_KERNEL_CONS_ATTRS
360is a character string giving a sequence of attributes in binary format.
361The sequence will be repeated up to the number of CPUs.
362Beware that the string must not be null,
363since the kernel divides by its length.
364.It Dv SC_DFLT_FONT
365This option will specify the default font.
366Available fonts are: iso, iso2, koi8-r, koi8-u, cp437, cp850, cp865,
367cp866 and cp866u.
36816-line, 14-line and 8-line font data will be compiled in.
369Without this option, the
370.Nm
371driver will use whatever font is already loaded in the video card,
372unless you explicitly load a software font at startup.
373See
374.Sx EXAMPLES
375below.
376.It Dv SC_NO_SUSPEND_VTYSWITCH
377This option, which is also available as
378.Xr loader 8
379tunable and
380.Xr sysctl 8
381variable
382.Va hw.syscons.sc_no_suspend_vtswitch ,
383disables switching between virtual terminals (graphics <-> text) during
384suspend/resume (ACPI and APM).
385Use this option if your system is freezing
386when you are running X and trying to suspend.
387.El
388.Pp
389The following options will remove some features from the
390.Nm
391driver and save kernel memory.
392.Bl -tag -width MOUSE
393.It Dv SC_NO_CUTPASTE
394This option disables ``copy and paste'' operation in virtual
395terminals.
396.It Dv SC_NO_FONT_LOADING
397The
398.Nm
399driver can load software fonts on some video cards.
400This option removes this feature.
401Note that if you still wish to use
402the mouse with this option then you must also use the
403.Dv SC_ALT_MOUSE_IMAGE
404option.
405.It Dv SC_NO_HISTORY
406This option disables back-scrolling in virtual terminals.
407.\".It Dv SC_NO_PALETTE_LOADING
408.It Dv SC_NO_SYSMOUSE
409This option removes mouse support in the
410.Nm
411driver.
412The mouse daemon
413.Xr moused 8
414will fail if this option is defined.
415This option implies the
416.Dv SC_NO_CUTPASTE
417option too.
418.It Dv SC_NO_TERM_DUMB
419.It Dv SC_NO_TERM_SC
420.It Dv SC_NO_TERM_SCTEKEN
421These options remove the
422.Qq dumb ,
423.Qq sc ,
424and
425.Qq scteken
426terminal emulators, respectively.
427.El
428.Ss Driver Flags
429The following driver flags can be used to control the
430.Nm
431driver.
432Driver flags can be set with the
433.Cd hint.sc.0.flags
434tunable, either in
435.Pa /boot/device.hints ,
436or else at the loader prompt (see
437.Xr loader 8 ) .
438.Bl -tag -width bit_0
439.\".It bit 0 (VISUAL_BELL)
440.\"Uses the ``visual'' bell.
441.\"The screen will blink instead of generating audible sound.
442.\".It bit 1,2 (CURSOR_TYPE)
443.\"This option specifies the cursor appearance.
444.\"Possible values are:
445.\".Bl -tag -width TYPE -compact
446.\".It Dv 0
447.\"normal block cursor
448.\".It Dv 2
449.\"blinking block cursor
450.\".It Dv 4
451.\"underline cursor
452.\".It Dv 6
453.\"blinking underline (aka destructive) cursor
454.\".El
455.\".It bit 6 (QUIET_BELL)
456.\"This option suppresses the bell, whether audible or visual,
457.\"if it is rung in a background virtual terminal.
458.It 0x0080 (VESAMODE)
459This option puts the video card in the VESA mode specified by
460.Pa /boot/device.hints
461variable
462.Va vesa_mode
463during kernel initialization.
464Note that in order for this flag to work, the kernel must be
465compiled with the
466.Dv SC_PIXEL_MODE
467option explained above.
468A list of the available mode can be obtained via
469.Xr vidcontrol 1 .
470.\"Note also that the ``copy-and-paste'' function is not currently supported
471.\"in this mode and the mouse pointer will not be displayed.
472.It 0x0100 (AUTODETECT_KBD)
473This option instructs the syscons driver to periodically scan
474for a keyboard device if it is not currently attached to one.
475Otherwise, the driver only probes for a keyboard once during bootup.
476.El
477.Ss Loader Tunables
478These settings can be entered at the
479.Xr loader 8
480prompt or in
481.Xr loader.conf 5 .
482.Bl -tag -width indent
483.It Va kern.vty
484When both
485.Nm
486and
487.Xr vt 4
488have been compiled into the kernel, the one to use for the system console can
489be selected by setting this variable to
490.Ql sc
491or
492.Ql vt .
493The
494.Pa GENERIC
495kernel uses
496.Xr vt 4
497when this value is not set.
498.El
499.Sh FILES
500.Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact
501.It Pa /dev/console
502.It Pa /dev/consolectl
503.It Pa /dev/ttyv?
504virtual terminals
505.It Pa /etc/ttys
506terminal initialization information
507.It Pa /usr/share/syscons/fonts/*
508font files
509.It Pa /usr/share/syscons/keymaps/*
510key map files
511.It Pa /usr/share/syscons/scrmaps/*
512screen map files
513.El
514.Sh EXAMPLES
515As the
516.Nm
517driver requires the keyboard driver and the video card driver,
518the kernel configuration file should contain the following lines.
519.Bd -literal -offset indent
520device atkbdc
521device atkbd
522device vga
523device sc
524device splash
525.Ed
526.Pp
527You also need the following lines in
528.Pa /boot/device.hints
529for these drivers.
530.Bd -literal -offset indent
531hint.atkbdc.0.at="isa"
532hint.atkbdc.0.port="0x060"
533hint.atkbd.0.at="atkbdc"
534hint.atkbd.0.irq="1"
535hint.vga.0.at="isa"
536hint.sc.0.at="isa"
537.Ed
538.Pp
539If you do not intend to load the splash image or use the screen saver,
540the last line is not necessary, and can be omitted.
541.Pp
542Note that the keyboard controller driver
543.Nm atkbdc
544is required by the keyboard driver
545.Nm atkbd .
546.Pp
547The following lines will set the default colors.
548The normal text will be green on black background.
549The reversed text will be yellow on green background.
550Note that you cannot put any white space inside the quoted string,
551because of the current implementation of
552.Xr config 8 .
553.Pp
554.Dl "options SC_NORM_ATTR=(FG_GREEN|BG_BLACK)"
555.Dl "options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)"
556.Pp
557The following lines will set the default colors of the kernel message.
558The kernel message will be printed bright red on black background.
559The reversed message will be black on red background.
560.Pp
561.Dl "options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)"
562.Dl "options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)"
563.Pp
564Provided
565.Dv SC_KERNEL_CONS_ATTR
566is not set, or is set to its default of bright white on black,
567the following line will set 4 red-ish colors
568for printing kernel messages in colors depending on the CPU.
569.Pp
570.Dl options SC_KERNEL_CONS_ATTRS=\e"\ex0c\ex04\ex40\ex0e\e"
571.Pp
572The default scheme is probably better for up to 8 CPUs.
573Use a long string to get unique colors for more than 8 CPUs.
574.Pp
575To turn off all per-CPU coloring of kernel messages,
576set SC_KERNEL_CONS_ATTR to a non-default value,
577or use the default in a pattern of length 1.
578.Pp
579.Dl options SC_KERNEL_CONS_ATTRS=\e"\ex0f\e"
580.Pp
581The following example adds the font files
582.Pa cp850-8x16.fnt ,
583.Pa cp850-8x14.font
584and
585.Pa cp850-8x8.font
586to the kernel.
587.Pp
588.Dl "options SC_DFLT_FONT"
589.Dl "makeoptions SC_DFLT_FONT=cp850"
590.Dl "device sc"
591.\".Sh DIAGNOSTICS
592.Sh SEE ALSO
593.Xr kbdcontrol 1 ,
594.Xr login 1 ,
595.Xr vidcontrol 1 ,
596.Xr atkbd 4 ,
597.Xr atkbdc 4 ,
598.Xr keyboard 4 ,
599.Xr screen 4 ,
600.Xr splash 4 ,
601.Xr ukbd 4 ,
602.Xr vga 4 ,
603.Xr vt 4 ,
604.Xr kbdmap 5 ,
605.Xr rc.conf 5 ,
606.Xr ttys 5 ,
607.Xr config 8 ,
608.Xr getty 8 ,
609.Xr kldload 8 ,
610.Xr moused 8
611.Sh HISTORY
612The
613.Nm
614driver first appeared in
615.Fx 1.0 .
616.Sh AUTHORS
617.An -nosplit
618The
619.Nm
620driver was written by
621.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org .
622This manual page was written by
623.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org .
624.Sh CAVEATS
625The amount of data that is possible to insert from the cut buffer is limited
626by the
627.Brq Dv MAX_INPUT ,
628a system limit on the number of bytes that may be stored in the terminal
629input queue - usually 1024 bytes
630(see
631.Xr termios 4 ) .
632.Sh BUGS
633This manual page is incomplete and urgently needs revision.
634