There is a device file called /dev/console
, whose (major,minor)
is (5,1)
.
When I boot with a serial console, it connects to my UART port as /dev/ttyS0
does.
But when I boot with serial console disabled, the /dev/console
seems to connect to elsewhere, where /dev/ttyS0
always connects to the same physical device, namely UART0
.
Is there any indication (like something in /proc
or /sys
) showing such information? I have tried there but found nothing I want.
I am starting to trace the Linux kernel source to clarify their relationships.
Can anyone give me some hints? When, where, how and what to determine the physical device to which /dev/console
connects?
EDIT: The latest finding is that:
- the
/dev/console
is configured byconsole=
of the kernel parameters, which in turn is used bygetty
to openstdin/stdout/stderr
. If noconsole=
is specified,/dev/null
is opened asstdin/stdout/stderr
. But I am not sure they are exactly the same with/dev/console
, which implies/dev/console
can have its I/O connecting to different physical devices. - The
/dev/console
can be read if a USB HID keyboard is plugged and theconsole=
is not configured as UART. Therefore/dev/console
==/dev/null
seems to make little sense. Need more investigations.