回复 9# zebao
You can use either the graphical user interface or the command-line VBoxManage tool to set up virtual serial ports. For the latter, please refer to Section 8.5, “VBoxManage modifyvm”; in that section, look for the -uart and -uartmode options.
In either case, you can configure up to two virtual serial ports simultaneously. For each such device, you will need to determine
what kind of serial port the virtual machine should see by selecting an I/O base address and interrupt (IRQ). For these, we recommend to use the traditional values[8], which are:
COM1: I/O base 0x3F8, IRQ 4
COM2: I/O base 0x2F8, IRQ 3
COM3: I/O base 0x3E8, IRQ 4
COM4: I/O base 0x2E8, IRQ 3
Then, you will need to determine what this virtual port should be connected to. For each virtual serial port, you have the following options:
You can elect to have the virtual serial port "disconnected", which means that the guest will see it as hardware, but it will behave as if no cable had been connected to it.
You can connect the virtual serial port to a physical serial port on your host. (On a Windows host, this will be a name like COM1; on Linux or OpenSolaris hosts, it will be a device node like /dev/ttyS0). VirtualBox will then simply redirect all data received from and sent to the virtual serial port to the physical device.
You can tell VirtualBox to connect the virtual serial port to a software pipe on the host. This depends on your host operating system:
On a Windows host, data will be sent and received through a named pipe. You can use a helper program called VMWare Serial Line Gateway, available for download at http://www.l4ka.org/tools/vmwaregateway.php. This tool provides a fixed server mode named pipe at \\.\pipe\vmwaredebug and connects incoming TCP connections on port 567 with the named pipe.
On a Mac, Linux or OpenSolaris host, a local domain socket is used instead. On Linux there are various tools which can connect to a local domain socket or create one in server mode. The most flexible tool is socat and is available as part of many distributions.
In this case, you can configure whether VirtualBox should create the named pipe (or, on non-Windows hosts, the local domain socket) itself or whether VirtualBox should assume that the pipe (or socket) exists already. With the VBoxManage command-line options, this is referred to as "server" or "client" mode, respectively.
Up to two serial ports can be configured simultaneously per virtual machine, but you can pick any port numbers out of the above. For example, you can configure two serial ports to be able to work with COM2 and COM4 in the guest.
理解起来 比较苦难啊 |