Mendel Development Tool (mdt)
Mendel Development Tool (mdt) is a command-line tool that lets you communicate with a device running
Mendel Linux. The mdt
command
facilitates a variety of device actions such as opening a shell, installing Debian packages, pushing
and pulling files, and more.
Install MDT
The server-side component that runs on the Mendel device is included with the Mendel system image.
So you only need to install the mdt
client on your host computer.
You can install it with pip
as follows:
pip3 install --user mendel-development-tool
pip3
is not found, then you probably don't
have Python3. To resolve, install Homebrew, run
brew install python3
, and then try again.
--user
flag installs the mdt
executable in your
user directory. On Linux, that's ~/.local/bin/
.
On a Mac, it's something like /Users/yourname/Library/Python/3.7/bin/
.
If you remove that flag, it requires root access and will install at /usr/local/bin
.
So make sure that the appropriate path is in your PATH
environment variable.
Alternatively, you can use apt-get
as follows:
# Add the repo: echo "deb https://packages.cloud.google.com/apt coral-mdt-stable main" | sudo tee /etc/apt/sources.list.d/mdt.list # Add Google keys curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - # Then install the package: sudo apt-get update sudo apt-get install mendel-development-tool
Connect to a board's shell
MDT can access the shell on any Mendel device that's visible on your network, but the easiest option is to connect with a USB-C cable as shown in figure 1.

Then if you have just one device, run this command:
mdt shell
If multiple devices are available, you need to specify the name or IP address (you can list
all devices with mdt devices
).
Internally, this is a normal SSH connection using OpenSSH with key-based
authentication. So before you can connect to the device shell with MDT or any other SSH tools, you
must push a public key to the device's /home/mendel/.ssh/authorized_keys
file. If no such key
exists there, the mdt shell
command creates it and pushes it (you can also do this manually with
mdt genkey
and then mdt pushkey
). This key created by MDT is PEM-formatted, passwordless,
and saved on your host computer at ~/.config/mdt/keys/mdt.key
(this key is used only when
connecting with mdt shell
).
If you prefer to use other SSH tools, simply generate your own key and then push that one
to the device with mdt pushkey
. For example, run the following on your host computer:
ssh-keygen
# Follow steps to create key
mdt pushkey ~/.ssh/id_rsa.pub
ssh mendel@192.168.100.2
MDT commands
The following table provides a reference of the available commands you can use with mdt
using
this syntax:
mdt subcommand arguments
mdt help
and man mdt
for information about what commands are available in your version of MDT.
Subcommand | Description |
---|---|
devices |
Returns a list of device names and IP addresses found on the local network
segment. Also indicates if a given device is marked as your default.
Uses the Note: MDT uses a python implementation of mDNS ZeroConf for discovery, so it does not require a running Avahi daemon. |
wait-for-device |
Waits for a device to be discovered on the network. |
get variable-name |
Returns the value currently set for a given variable name. Some useful
variables are:
If no variable name is provided, 'mdt get' will print out the list of all known stored variables and their values. Note: default values are not printed. |
set variable-name |
Sets the value for a given variable name. See example variables for the corresponding
get command above.
Note that setting a variable to the empty string does not clear it back to
the default value. Use |
clear variable-name |
Clears the value for a given variable name, resetting it back to its default value. |
genkey |
Generates an SSH key and stores it to disk on the Mendel device.
If you already have an MDT key, this replaces it, effectively locking you out from any
boards that require authentication using that existing key. You must also remove
the keys previously stored on the Mendel device in |
pushkey path-to-ssh-public-key |
Copies an SSH public key to the Mendel device's ~/.ssh/authorized_keys
file. If an MDT private key is provided, will push the public half of that key
to the device's authorized_keys file.
If no public key is provided, it attempts to push MDTs previously generated
public key from ~/.config/mdt/keys/mdt.key .
|
setkey path-to-private-key |
Copies a PEM-format SSH private key into the Mendel device's MDT keystore for use with authentication later. |
resetkeys device-or-ip-address |
Resets a device to it's pre-MDT state by removing all MDT keys and restarting the mdt-keymaster on the device so that new keys can be pushed again. |
shell [device-or-ip-address] |
Opens an interactive shell to either your preferred device or to the first
device found.
If device-or-ip-address is specified, shell attempts to connect to that
device name or directly to the IP address provided instead.
Uses the variables If no SSH key is available on disk (you didn't run |
exec [shell-command...] |
Opens a non-interactive shell to either your preferred device or to the first
device found, runs a shell command and returns the output and the exit code.
If no SSH key is available on disk, it follows the same steps as the |
install deb-package-file |
Installs a given Debian package file to the connected device via
mdt-install-package . Uses the variables preferred-device ,
username , and password (see the get command above).
Note: if the package provided has dependencies that are not already installed on the device, this will require internet connectivity to fetch and install those dependencies. |
push local-path... [remote-path] |
Pushes (copies) a local file or set of files to the remote device. If you specify a directory for
local-path, then that directory is added to the remote location and the contents are
copied recursively.
local-path may be an absolute path or a relative path.
If you omit remote-path, MDT uses Uses the variables |
pull remote-path... local-path |
Pulls (copies) a set of files from the remote device to a local path. If you specify a directory
for remote-path, then that directory is added to the local location and the contents are
copied recursively.
remote-path may be an absolute path or a path relative to
Uses the variables |
reboot |
Reboots a device. |
reboot-bootloader |
Reboots a device to the bootloader and starts fastboot mode. After running this,
you should see your device listed when you run fastboot devices , making it easy to
then flash the device. |
version |
Prints which version of MDT this is. |
Is this content helpful?