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