VMware Fusion will, if appropriately coerced, emulate UARTs in guests and
expose them to the host as UNIX domain sockets. This tool allows you to attach
your terminal emulator directly to one of those sockets without having to
lark about with socat
and screen
.
Assuming you have Xcode installed, and thus gcc
:
$ git clone git://github.com/jclulow/vmware-sercons.git
$ cd vmware-sercons
$ make
gcc -o sercons sercons.c
While the GUI for VMware Fusion does not presently support adding serial
ports as sockets, you can edit the vmx
file directly. Add the following
snippet (amending for the desired socket path):
serial0.present = "TRUE"
serial0.fileType = "pipe"
serial0.yieldOnMsrRead = "TRUE"
serial0.startConnected = "TRUE"
serial0.fileName = "/tmp/.vmware.com1"
serial1.present = "TRUE"
serial1.fileType = "pipe"
serial1.yieldOnMsrRead = "TRUE"
serial1.startConnected = "TRUE"
serial1.fileName = "/tmp/.vmware.com2"
One can also ask VMware Fusion to run a virtual telnet server on a specified port (just like an "old-school" terminal server). Assuming we'll run telnet like this: telnet 10.1.2.3 5432 the snipped of the vmx file would be:
serial0.fileType = "network"
serial0.fileName = "telnet://10.1.2.3:5432"
serial0.present = "TRUE"
serial0.startConnected = "TRUE"
serial0.yieldOnMsrRead = "TRUE"
Before starting up the VM, fire up sercons
with the path you nominated
for the serial port you want to connect to:
$ sudo ./sercons /tmp/.vmware.com2
* Waiting for socket...........
The program will continue to retry until a connection is made to the socket.
* Waiting for socket...........
* Connected. Escape sequence is <CR>#.
You should be able to catch pretty much every byte out of the serial port on boot this way, e.g. a grub menu, etc.
Once you're finished, press Enter and then Hash, then Period to end the session.
MIT