All Projects → weltling → convey

weltling / convey

Licence: other
Communication through a serial port or named pipe

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to convey

usbipd-win
Windows software for sharing locally connected USB devices to other machines, including Hyper-V guests and WSL 2.
Stars: ✭ 1,321 (+2771.74%)
Mutual labels:  wsl, hyper-v, wsl2
subsystemctl
Utility to run systemd in WSL2 with a Linux namespace
Stars: ✭ 313 (+580.43%)
Mutual labels:  wsl, wsl2
dotfiles
Dotbot managed dotfiles for a polyglot dev using WSL. Includes PowerShell stuff for Windows Installation
Stars: ✭ 14 (-69.57%)
Mutual labels:  wsl, wsl2
runx
Provide X server on MS Windows with cookie authentication.
Stars: ✭ 67 (+45.65%)
Mutual labels:  wsl, wsl2
idfx
Tool for flash/monitor ESP-IDF and ESP8266_SDK apps on the WSL2 ⚡
Stars: ✭ 71 (+54.35%)
Mutual labels:  com-port, wsl2
nix-config
NixOS configuration (also on WSL)
Stars: ✭ 51 (+10.87%)
Mutual labels:  wsl, wsl2
dotfiles
Cross platform home directory settings
Stars: ✭ 17 (-63.04%)
Mutual labels:  wsl, wsl2
wsl-distrod
Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
Stars: ✭ 1,637 (+3458.7%)
Mutual labels:  wsl, wsl2
proton wsl2
Proton Kernel for the Windows Subsystem for Linux 2 (WSL 2). Highly experimental and always at the mercy of Windows Update.
Stars: ✭ 23 (-50%)
Mutual labels:  wsl, wsl2
webi-installers
Primary and community-submitted packages for webinstall.dev
Stars: ✭ 421 (+815.22%)
Mutual labels:  wsl, wsl2
WSLackware
Slackware for WSL!
Stars: ✭ 38 (-17.39%)
Mutual labels:  wsl, wsl2
nvim-ghost.nvim
👻 GhostText plugin for Neovim with zero dependencies 🎉 Supports neovim running inside WSL too! 🥳 Windows/Linux/macOS supported out-of-the-box! 😄 (Other OSes need python3.6+ installed)
Stars: ✭ 32 (-30.43%)
Mutual labels:  wsl, wsl2
WSL-Context-Menu-Manager
Manages the context menu for your Linux tools in WSL/WSL2 for Windows.
Stars: ✭ 25 (-45.65%)
Mutual labels:  wsl, wsl2
Multipass
Multipass orchestrates virtual Ubuntu instances
Stars: ✭ 3,978 (+8547.83%)
Mutual labels:  virtual-machine, hyper-v
dotfiles
My shell configuration and scripts. My "dotfiles". ... Over a decade of tuning my environments. ⌚😮🤯
Stars: ✭ 20 (-56.52%)
Mutual labels:  wsl
Huhnitor
Intergalactic serial monitor for ESP8266 Deauther
Stars: ✭ 265 (+476.09%)
Mutual labels:  serial
Nodemcu Tool
🔧 Upload + Manage Lua files on NodeMCU
Stars: ✭ 248 (+439.13%)
Mutual labels:  serial
Saxi
Tools & library for driving the AxiDraw pen plotter
Stars: ✭ 234 (+408.7%)
Mutual labels:  serial
clox
A virtual machine and a tree-walk interpreter for the Lox programming language in C89 🌀
Stars: ✭ 38 (-17.39%)
Mutual labels:  virtual-machine
arduivis
a bi-directional communication paradigm for programming languages & microcontrollers
Stars: ✭ 48 (+4.35%)
Mutual labels:  serial

The convey tool

Convey is an inter-process communication tool with capabilities to communicate through a named pipe or a serial port. Notable features include the communication with Hyper-V virtual machines through an emulated COM port. Simplicity from the use point is the most point of focus for this tool.

Convey is distributed under the BSD 2-clause license.

Building

Visual C++

  • Get onto the VC++ shell
  • nmake /nologo

Clang

  • Get onto the VC++ shell
  • nmake /nologo CXX="c:\Program Files\LLVM\bin\clang-cl.exe" LD="c:\Program Files\LLVM\bin\lld-link.exe"

Usage with a physical COM port

The physical COM port usage is a simple as invoking the tool with the COM port name.

  • Invoke convey.exe COM<num>
  • For the port with number >= 10, use \.\COM<num>

There's no difference whether it's a native COM port or a USB-to-COM convertor. As long as the COM port appears under the device manager, it is usable.

Usage with Hyper-V

Hypervisors like Hyper-V provide a functionality to emulate a serial port in the VM, while exposing it as a named pipe to the host Windows machine. Using convey, it is possible to connect to a virtual machine's virtual serial port from the host system using the exposed named pipe.

Preparing Hyper-V

On host, conifgure a com port

Assign a named pipe that will be passed as a COM1 into a VM.

Set-VMComPort -VMName <vm name> -Number 1 -Path \\.\pipe\<pipe name>

View configured COM ports on a VM.

Get-VMComPort -VMName <vm name>

Inside the VM

Add console=ttyS0,115200 console=tty0 to the kernel parameters. Note, that ttyS0 is what is usually available on a typical setup. Depending on the hardware and system configuration, this device name can be different.

Optional

Configure autologin for ttyS0 or another terminal device you've chosen.

Connecting to a VM

Method 1

  • Start the VM.
  • Start an elevated cmd window and invoke convey.exe \\.\pipe\<pipe name>.

Method 2

  • Before starting the VM, invoke convey with the --poll argument.
  • Start the VM.

Debugging Linux kernel

Prerequisities

  • Download the unstripped vmlinux to your local machine, or
  • Download the vmlinux and the debug symbols.
  • Download the kernel sources corresponding to the given kernel build.

On host, create a PTY mapping to the VM named pipe

Invoke WSL on an elevated console and run

socat PTY,link=/tmp/my-vm-pty,raw,echo=0 SYSTEM:"while true; do ./convey.exe //./pipe/<pipe name>; sleep 0.1; done"

VM setup

Add nokaslr to the kernel command line.

See also a more detailed documentation on the (kgdb)[https://www.kernel.org/doc/html/v4.17/dev-tools/kgdb.html] page.

Turn on kernel debug mode

Method 1

Inside the VM, execute the commands below:

  • echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc
  • echo g > /proc/sysrq-trigger

Method 2

Add a suitable configuration to the kernel command line, for example kgdboc=ttyS0,115200 kgdbwait.

On host, start debugging

Run another WSL shell and invoke

$ gdb ./vmlinux
(gdb) set serial baud 115200
(gdb) target remote /tmp/my-vm-pty

Here you are. This doesn't need an elevated console.

Troubleshooting & Tricks

Disable input echoing

stty -F /dev/ttyS0 -echo

The serial screen size is too small

Use stty to set the desired columns and rows number, for example

stty columns 235 rows 62

Pointing gdb to the sources

(gdb) set substitute-path /sources/were/compiled/here /put/sources/here

To add multiple folders to be searched by GDB, use

(gdb) set dir /path/to/base/dir

Alternatively, unpack kernel sources under /usr/src/kernel or where ever else the kernel was built.

GDB tells Remote replied unexpectedly to 'vMustReplyEmpty': vMustReplyEmpty

Forgot to bring kernel into the debugging mode?

Not all frames are resolved

Add nokaslr to the kernel parameters.

Sysrq cannot be sent due to the lockdown

If the lockdown= option is on the kernel cmdline, it has to be removed.

Some distribution might also allow to disable lockdown at runtime. In a VM, Alt+SysRq+x can be sent by:

$ echo 1 > /proc/sys/kernel/sysrq
$ echo x > /proc/sysrq-trigger

Links

TODO

  • Check VMWare and VirtualBox.
  • Check other things like Windows VM or any other possible counter part exposing named pipes.
  • Add console options for more flexibility.
  • Implement sending/receiving a file.
  • ...
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].