Serial Console
Output to Serial Console
Make sure the kernel is started with the following parameter…
console=ttyS0,115200
Change Size (rows/cols)
Often the expected size of the TTY session isn't what you would want and feels constrained. You can change a bunch of setting using the stty
command. Below will change the number of columns because that is what I most often feel I need to change…
stty cols 140
Dual Output
It is possible to have the kernel write to both the standard pseudo-terminal (tty0
) and the serial console (ttyS0
) by adding the following kernel parameters…
console=ttyS0,9600 console=tty0
View Console
It is possible to view serial console output using the screen
command. With a USB-to-Serial adapter plugged in you may see a device called something like /dev/tty.usbserial-AG0JL5ZB
that will act as the tty device.
screen /dev/tty.usbserial-AG0JL5ZB 115200,cs8,ixon
Parameters explained from man screen
Parameter | Description |
---|---|
<baud_rate> |
This affects transmission as well as receive speed (usually 300, 1200, 9600 or 19200) |
cs8 or cs7 |
Specify the transmission of eight (or seven) bits per byte |
ixon or -ixon |
Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending data |
ixoff or -ixon |
Enables (or disables) software flow-control for receiving data |
istrip or -istrip |
Clear (or keep) the eight bit in each received byte |