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