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