Serial console: Difference between revisions

From coreboot
Jump to navigation Jump to search
(Created page with '== coreboot == == FILO == == GRUB == In your '''boot/grub/menu.lst''' add the following: serial '''--unit=0''' --speed='''115200''' terminal --timeout=15 serial console Ch…')
 
(spelling)
 
(54 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= Notes =
Serial is the most supported console with regard to software, it is supported in coreboot,seabios,serialice,ipxe,memtest etc...
Unfortunately it's not available on every hardware anymore, some recent devices like the Lenovo X201 or the Chromebook pixel lack a serial port.
= Supported Serial Ports controllers =
== SuperI/O with integrated UARTs ==
coreboot supports a variety of SuperI/O chips with UART functionality. If your mainboard has a serial port built-in, you can use it with no or minimal changes.
== PCIe/Mini PCIe based serial cards ==
Experimental coreboot and libpayload support is available for the [http://us.startech.com/product/MPEX2S952-2-Port-RS232-Mini-PCI-Express-Serial-Card-with-16950-UART StarTech MPEX2S952] card. Those cards are available at [http://www.amazon.com/2-PORT-Mini-Pci-Express-Card/dp/B003OCRW1Q Amazon] for around 30 USD. In order to use the card for romstage debugging, minimal setup of the PCIe bridge and  the MPEX2S952 have to be added to romstage.c, otherwise the card is only available after the resource allocator has been running.
== USB to Serial Converters ==
USB to serial converters are not supported by coreboot at this time.
= Enabling Serial Console =
In order to get '''serial console output''' from various components of your system special options may be needed. This page tries to give a short description of how to use these options.
== coreboot ==
== coreboot ==
In coreboot you have to set up serial console support during configuration. Enable Console--> Serial port console output.
You will be able to choose the UART and baud rate settings in the same menu.


== FILO ==
== FILO ==


== GRUB ==
FILO picks up coreboot's serial console configuration, if compiled with serial console support.
 
== GRUB legacy ==


In your '''boot/grub/menu.lst''' add the following:
In your '''boot/grub/menu.lst''' add the following:
Line 11: Line 39:


Change '''--unit=0''' to '''--unit=1''' for the second serial port (COM2).
Change '''--unit=0''' to '''--unit=1''' for the second serial port (COM2).
== GRUB2 ==
The usual way to get serial is to have the following in /etc/default/grub:
GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
But that depend on having console(and so graphics) working(if console fails serial isn't tried), so adding the following to the end of /etc/grub.d/40_custom
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input --append  serial
terminal_output --append serial
set timeout=1
play 480 440 1
Then regenrate the grub config:
For debian, ubuntu, trisquel:
sudo update-grub2
for arch, parabola:
grub-mkconfig -o /boot/grub/grub.cfg


== Linux kernel command line ==
== Linux kernel command line ==
Line 19: Line 65:


to send debug output to both the serial console on COM1 '''and''' to VGA.
to send debug output to both the serial console on COM1 '''and''' to VGA.
if you use grub2 you can add it to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub
Then regenrate the grub config:
For debian, ubuntu, trisquel:
sudo update-grub2
for arch, parabola:
grub-mkconfig -o /boot/grub/grub.cfg


== Linux login prompt ==
== Linux login prompt ==
Line 28: Line 82:
Change '''ttyS0''' to '''ttyS1''' for COM2.
Change '''ttyS0''' to '''ttyS1''' for COM2.


=== ubuntu, trisquel based ===
Create a file called /etc/init/ttyS0.conf containing the following:
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc or RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -L 115200 ttyS0 vt102
Then do
sudo start ttyS0
= Hardware pinouts =
=== Requirements ===
{| class="wikitable"  border="1"
! Pin
! Required for
|-
| Mainboard TX -> Your development laptop RX
|
* Getting the mainboard's coreboot logs in real time.
|-
| Mainboard RX <- Your development laptop TX
|
* gdb in coreboot(Also requires Mainboard TX)
* Interacting with payloads, and what run after them, trough the serial console.
|-
|}
=== DE-9 ===
{| class="wikitable"  border="1"
!Pin
!Function
|-
|1
|DCD
|-
|2
|RX
|-
|3
|TX
|-
|4
|DTR
|-
|5
|GND
|-
|6
|DSR
|-
|7
|RTS
|-
|8
|CTS
|-
|9
|RI
|-
|}
=== Standard 10 pins PC header (alternating pin numbers) ===
{| class="wikitable"  border="1"
!Pin
!Function
|-
|1
|DCD
|-
|2
|DSR
|-
|3
|RXD
|-
|4
|RTS
|-
|5
|TXD
|-
|6
|CTS
|-
|7
|DTR
|-
|8
|RI
|-
|9
|GND
|-
|10
|NC
|-
|}
=== Non-standard "intel configuration" 10 pins header (1:1 pin numbers) ===
{| class="wikitable"  border="1"
!Pin
!Function
|-
|1
|DCD
|-
|2
|RXD
|-
|3
|TXD
|-
|4
|DTR
|-
|5
|GND
|-
|6
|DSR
|-
|7
|RTS
|-
|8
|CTS
|-
|9
|RI
|-
|10
|NC
|-
|}
=== Tricks ===
* If you short RX and TX pins, what you send to the serial port, will be sent back. That is very usefull for debugging and finding the right pins.
* ground is easy to find since it's connected to ground, a multimeter can find it easily trough "beeping".
* If you lack a multimeter and that you want to know if 2 pins are connected, for finding the serial port's ground pin for instance, assuming you already found RX and TX, you could connect RX and TX to the pins you want to checks, and then send some data trough the serial port, if you read it back, then the pins are connected together. Warning, don't do that with voltages that are not in then range of voltages of your serial port.
= Null-modem cable =
A so-called '''null-modem cable''' is used for transmitting the output from a serial coreboot (or GRUB- or Linux-) console to another computer where a terminal program (such as minicom) can be used to display/save the messages.
<gallery>
Image:Null modem cable.jpg|A null-modem cable.
</gallery>
= Serial terminal software =
== picocom ==
Picocom is a small yet effective serial terminal program.
== minicom ==
Minicom is not just a serial terminal. It was written long before the internet existed and electronic communication was only possible with a modem to a mailbox-computer. Minicom is written with the ncurses library and provides its magic via a text interface. Other than logging, it provides z-modem up- and download-capability.
== CuteCom ==
This is an easy to use serial-terminal-program which is even able to write all communication into a log-file. It needs a computer with installed Qt-libs.
[[Image:CuteCom.png|thumb|left]]
<br clear="all" />
= See also =
[[Console_and_outputs]]


{{PD-self}}
{{PD-self}}

Latest revision as of 19:00, 13 May 2018

Notes

Serial is the most supported console with regard to software, it is supported in coreboot,seabios,serialice,ipxe,memtest etc...

Unfortunately it's not available on every hardware anymore, some recent devices like the Lenovo X201 or the Chromebook pixel lack a serial port.

Supported Serial Ports controllers

SuperI/O with integrated UARTs

coreboot supports a variety of SuperI/O chips with UART functionality. If your mainboard has a serial port built-in, you can use it with no or minimal changes.

PCIe/Mini PCIe based serial cards

Experimental coreboot and libpayload support is available for the StarTech MPEX2S952 card. Those cards are available at Amazon for around 30 USD. In order to use the card for romstage debugging, minimal setup of the PCIe bridge and the MPEX2S952 have to be added to romstage.c, otherwise the card is only available after the resource allocator has been running.

USB to Serial Converters

USB to serial converters are not supported by coreboot at this time.

Enabling Serial Console

In order to get serial console output from various components of your system special options may be needed. This page tries to give a short description of how to use these options.

coreboot

In coreboot you have to set up serial console support during configuration. Enable Console--> Serial port console output. You will be able to choose the UART and baud rate settings in the same menu.

FILO

FILO picks up coreboot's serial console configuration, if compiled with serial console support.

GRUB legacy

In your boot/grub/menu.lst add the following:

serial --unit=0 --speed=115200
terminal --timeout=15 serial console

Change --unit=0 to --unit=1 for the second serial port (COM2).

GRUB2

The usual way to get serial is to have the following in /etc/default/grub:

GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

But that depend on having console(and so graphics) working(if console fails serial isn't tried), so adding the following to the end of /etc/grub.d/40_custom

serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input --append  serial
terminal_output --append serial
set timeout=1
play 480 440 1

Then regenrate the grub config: For debian, ubuntu, trisquel:

sudo update-grub2

for arch, parabola:

grub-mkconfig -o /boot/grub/grub.cfg

Linux kernel command line

Add

console=ttyS0,115200 console=tty0

to send debug output to both the serial console on COM1 and to VGA.

if you use grub2 you can add it to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub

Then regenrate the grub config: For debian, ubuntu, trisquel:

sudo update-grub2

for arch, parabola:

grub-mkconfig -o /boot/grub/grub.cfg

Linux login prompt

In /etc/inittab add/enable a line like this:

T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100

Change ttyS0 to ttyS1 for COM2.


ubuntu, trisquel based

Create a file called /etc/init/ttyS0.conf containing the following:

# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc or RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 115200 ttyS0 vt102

Then do

sudo start ttyS0

Hardware pinouts

Requirements

Pin Required for
Mainboard TX -> Your development laptop RX
  • Getting the mainboard's coreboot logs in real time.
Mainboard RX <- Your development laptop TX
  • gdb in coreboot(Also requires Mainboard TX)
  • Interacting with payloads, and what run after them, trough the serial console.

DE-9

Pin Function
1 DCD
2 RX
3 TX
4 DTR
5 GND
6 DSR
7 RTS
8 CTS
9 RI

Standard 10 pins PC header (alternating pin numbers)

Pin Function
1 DCD
2 DSR
3 RXD
4 RTS
5 TXD
6 CTS
7 DTR
8 RI
9 GND
10 NC

Non-standard "intel configuration" 10 pins header (1:1 pin numbers)

Pin Function
1 DCD
2 RXD
3 TXD
4 DTR
5 GND
6 DSR
7 RTS
8 CTS
9 RI
10 NC

Tricks

  • If you short RX and TX pins, what you send to the serial port, will be sent back. That is very usefull for debugging and finding the right pins.
  • ground is easy to find since it's connected to ground, a multimeter can find it easily trough "beeping".
  • If you lack a multimeter and that you want to know if 2 pins are connected, for finding the serial port's ground pin for instance, assuming you already found RX and TX, you could connect RX and TX to the pins you want to checks, and then send some data trough the serial port, if you read it back, then the pins are connected together. Warning, don't do that with voltages that are not in then range of voltages of your serial port.

Null-modem cable

A so-called null-modem cable is used for transmitting the output from a serial coreboot (or GRUB- or Linux-) console to another computer where a terminal program (such as minicom) can be used to display/save the messages.

Serial terminal software

picocom

Picocom is a small yet effective serial terminal program.

minicom

Minicom is not just a serial terminal. It was written long before the internet existed and electronic communication was only possible with a modem to a mailbox-computer. Minicom is written with the ncurses library and provides its magic via a text interface. Other than logging, it provides z-modem up- and download-capability.

CuteCom

This is an easy to use serial-terminal-program which is even able to write all communication into a log-file. It needs a computer with installed Qt-libs.


See also

Console_and_outputs

Public domain I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide.

In case this is not legally possible:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.