User Tools

Site Tools


usersguide:serialconsoles

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

usersguide:serialconsoles [2014/11/11 14:52]
127.0.0.1 external edit
usersguide:serialconsoles [2014/11/11 16:15] (current)
lionelsambuc [Transfering Files via ZMODEM]
Line 1: Line 1:
 +====== Serial Consoles ======
 +
 +
 +===== Introduction =====
 +
 +With a little configuration,​ it's possible to use a dumb terminal connected to a minix host. Alternatively,​ one could connect a PC to a minix host via a null-modem cable and run a terminal emulator program on the PC to act as a dumb terminal.
 +
 +===== Configuring the Minix Host =====
 +
 +On the minix host edit ///​etc/​ttys//​. The **tty00** and **tty01** lines should be edited to look like this:
 +<​code>​
 +tty00           ​getty ​          ​vt100 ​           on secure
 +tty01           ​getty ​          ​vt100 ​           on secure
 +</​code>​
 +
 +Minix 3.2.1 (as of commit a458e9d) you can append the baud rate to getty (in quotes) if you want to set the speed to something else than the default 9600. For example, to configure tty00 to use a baud rate of 115200, the line should like this:
 +<​code>​
 +tty00           "​getty 115200" ​ vt100            on secure
 +</​code>​
 +
 +Then reboot the system.
 +
 +===== Hardware Setup =====
 +
 +Connect the terminal or null-modem cable to one of the serial ports on the minix host. Press //enter// a couple of times on the terminal and the login prompt should appear. Log in and have fun.
 +
 +===== Using a Terminal Emulator =====
 +
 +[[http://​www.gnu.org/​software/​screen/​|GNU Screen]] can be used as a terminal emulator on a Linux PC connected to a minix host via a null-modem cable with no setup needed.
 +<​code>​
 +screen /​dev/​ttyUSB0
 +</​code>​
 +In case you're wondering about //​ttyUSB0//,​ it's a USB-to-serial adapter. Using ///​dev/​ttyS0//​ should also work.
 +
 +You may also use
 +
 +<​code>​
 +cu -s 9600 -l /​dev/​ttyUSB0
 +</​code>​
 +
 +The '​-s'​ option sets the baud rate, so you can change this to 115200 if you prefer.
 +
 +===== Transfering Files via ZMODEM =====
 +
 +Files can be transfered over a serial console using the [[http://​en.wikipedia.org/​wiki/​ZMODEM|ZMODEM]] protocol. It's not the fastest method for transfering files, but if you're using a system that isn't connected to the network, then it isn't too bad.
 +
 +The first step is to install [[http://​ohse.de/​uwe/​software/​lrzsz.html|lrzsz]] on your development machine (i.e. non-Minix computer) as well as a terminal program that can use it. This guide assumes you're using [[http://​code.google.com/​p/​picocom/​|picocom]]. Example:
 +<​code>​
 +emerge lrzsz picocom
 +</​code>​
 +
 +Then, create a test file so we have something to try transfering. Example:
 +<​code>​
 +echo "​Hallo,​ Wereld"​ > test.txt
 +</​code>​
 +
 +Next, start picocom with these options on the development machine, changing /​dev/​ttyUSB0 to the serial device your target Minix system is attached to.
 +<​code>​
 +picocom -b 115200 /​dev/​ttyUSB0 --send-cmd "sz -vv -y"
 +</​code>​
 +
 +Once you're logged into the target Minix system over the serial connection, do ''​Ctrl+s a''​ to initiate a transfer (i.e. hold down the control key, press and release '​a',​ press and release '​s',​ and finally release the control key). You will be prompted to enter the name of the file you want to transfer. Below I entered the name of the example file (''​test.txt''​) and pressed the enter key. The transfer should go and end with "%%*** exit status: 0%%" Here's what the output looks like:
 +<​code>​
 +#
 +*** file: test.txt
 +sz -vv -y test.txt
 +Sending: test.txt
 +Bytes Sent:     ​14 ​  ​BPS:​14 ​                            
 +
 +Transfer complete
 +
 +*** exit status: 0
 +# cat test.txt
 +Hallo, Wereld
 +
 +</​code>​
 +
 +===== Gotchas =====
 +
 +  * Logging in via a serial console is handled slightly differently than logging in normally with a keyboard. The user you are logging in as must have a password set. Trying to log into an account without a password will not work.
 +  * Serial connections are slow. If you're doing a //make build// or something with a lot of output that you don't care to read, you can redirect **stdout** to ///​dev/​null//​ like this: 
 +<​code>​
 +make build 1> /dev/null
 +</​code>​
 +  * Don't set 'ctty 0' for serial debugging.
  
usersguide/serialconsoles.txt · Last modified: 2014/11/11 16:15 by lionelsambuc