User Tools

Site Tools


releases:3.2.0:developersguide:serialout

Introduction

It's sometimes useful to add debugging prints to servers or drivers and have the output not show up on your screen, but redirected to serial. This way, you can log the prints to a text file or terminal on another box.

Enable serial on your Minix box

First you have to tell Minix to redirect printf's from system processes to serial out. You do this by providing the cttyline and cttybaud parameters to the kernel upon boot up. To modify the boot menu, add the following to /etc/boot.cfg.local (create the file if it doesn't exist; it is only a single line, do not insert newlines in between):

menu=Start latest serial MINIX 3:load_mods /boot/minix_latest/mod*;multiboot /boot/minix_latest/kernel rootdevname=c0d0p0s0 cttyline=0 cttybaud=115200

After you've created that, run

# update_bootcfg

to update the boot configuration. If you also want the boot menu to be sent over serial instead of showing up on the screen, add

consdev=com0

to /etc/boot.cfg.local as well. Note that if add this line but you don't attach a null modem or terminal to your serial port, you won't see and be able to pick an option from the boot menu. Finally, make sure to use a recent boot loader which enables a baud rate of 115200 instead of 9600:

# cd /usr/src/sys
# make clean install
# updateboot

Setting up the receivers end

We can use serial out on real hardware and on VMs.

Qemu

To log the serial output to a file add the following option

-serial file:/path/to/file

If you want to be able to pick an option from the boot menu over serial, use

-serial stdio

If you want both, use tee to multiplex the output and sed to sanitize the output:

-serial stdio | sed -u 's/^M//g' | tee /path/to/file

VMware

Before you run a VM, edit the VM settings and add a Serial Port device. There you have a number of options such as redirecting to a physical device or a file.

It takes a little setting up, but the most pleasant resulting usage is to redirect it to a pipe and then connect to the pipe using e.g. a telnet client.

VMware under Windows

To do that under windows, redirect the serial output to a named pipe, and call it “\\.\pipe\com_1”. Then download, install and run “Named Pipe TCP proxy.” Make a new connection and set Pipe name to “\\.\pipe\com_1”, description “vmware.” Start it. Set TCP port to e.g. 1001. Then configure a telnet client (e.g. putty works well) to connect to localhost port 1001. If your vmware is running, you should see it connected and you have access to your serial console.

Real hardware

Connect your Minix box to a receiving box using a null modem . Then start a terminal client on the receiving box such as kermit:

$ kermit -l /dev/ttyS0

However, this way kermit will stop working upon every reboot. You can use following script to prevent that (save as a file and make it executable):

#!/usr/bin/kermit +
kermit -E -l /dev/ttyS0
set speed 115200
set reliable
fast
set carrier-watch off
set flow-control none
set prefixing all
connect

FreeBSD

In the FreeBSD base system you can use tip. Edit /etc/remote to set the right parameters, e.g.:

uart0|com1:dv=/dev/cuau0:br#115200:pa=none:

Then:

# tip uart0

and you're in.

releases/3.2.0/developersguide/serialout.txt · Last modified: 2014/11/14 17:56 by lionelsambuc