Repository navigation
Capturing boot logs
boot-log-diff reads plain text. Any tool that writes what came over the serial console to a file works. A few things make the comparison cleaner.
- ANSI colour codes and carriage returns are removed.
- Blank lines are skipped.
- ISO timestamps that capture tools put in front of each line are masked,
like the kernel's own
[ 1.234567]timestamps. - Bytes that are not valid UTF-8 (line noise while the board powers up) are replaced, not an error.
picocom — log to a file, quit with Ctrl-A Ctrl-X:
$ picocom -b 115200 --logfile dut.log /dev/ttyUSB0minicom — -C captures to a file:
$ minicom -D /dev/ttyUSB0 -b 115200 -C dut.loggrabserial — made for boot logs; stops after a time or a pattern, which is what a test station needs:
$ grabserial -d /dev/ttyUSB0 -b 115200 -e 60 -q 'login:' -o dut.logNo tool at all — set the port and read it for a fixed time, straight into
boot-log-diff (- reads the DUT log from stdin):
$ stty -F /dev/ttyUSB0 115200 raw -echo
$ timeout 60 cat /dev/ttyUSB0 | boot-log-diff golden.log -Power-cycle the board after the capture has started, so the log begins with the first bootloader line, as the golden log does.
PuTTY: Session → Logging → Printable output, choose a file name, then open the serial connection. Tera Term: File → Log. Both write plain text that boot-log-diff reads directly; Windows line endings are handled.
Boards in a rack are often reached through a terminal server or ser2net.
Read the TCP port the same way:
$ timeout 60 nc terminal-server 7001 | boot-log-diff golden.log -- Same baud rate as the golden log. A wrong rate gives garbage that differs everywhere.
-
Capture until the same point. If the golden log ends at the login
prompt, stop the DUT capture there too (
grabserial -q 'login:'), or every line after it is "new". - Do not log in or type during the capture. Your typing ends up in the log.
-
Long lines split in the capture file? Some terminal programs break
lines at the window width. Switch line wrapping off, or use a tool that
writes the raw stream (picocom, grabserial,
cat).
boot-log-diff · MIT licensed · the example logs are from a fictitious board (Acme EPC-8M).