In your config file of virtual machine you need the following:
# grep serial openwrt.vmx
serial0.present = "TRUE"
serial0.fileType = "pipe"
serial0.fileName = "./serial1"
serial0.pipe.endPoint = "server"
serial0.hardwareFlowControl = "TRUE"
Redirect output to stdio or a port:
# socat <path_to_virtual_machine_dir>/serial1 <stdio |tcp4-listen:<port>>