Skip to main content

Tiny little tools to interact with U-Boot via the serial console

Project description

ubtools

Tiny little tools to interact with U-Boot via the serial console

Also included is a simple yet robust Python 3.11 library to talk to U-Boot.

Usage

To install the tools:

pipx install ubtools

To run without installing:

cd src
python -m ubtools.cli.COMMAND ...

To build and test:

./build
./run-tests
pipx install -e .

Configuration

Defaults are loaded from the serial section of ~/.config/ubtools/config.toml, if present:

[serial]
port = "/dev/ttyUSB0"
baud = 115200
timeout = 0.1
mode = "exclusive"
#prompt = "U-Boot #"

Environment variables of the form UBTOOLS_* (UBTOOLS_PORT, etc.) can override those values.

Commands

Command Description
ubint Interrupt U-Boot autoboot via the serial console
ubcmd Send a command to U-Boot via the serial console and print the output
ubread Read from U-Boot memory via the serial console
ubwrite Write to U-Boot memory via the serial console

ubint

Interrupt U-Boot autoboot via the serial console

usage: ubint [-i] [-q] [-r] [-s STR] [-p PORT] [-b BAUD] [--timeout SECONDS]
             [--mode {shared,exclusive,none}] [--prompt PROMPT] [-h]
             [--version]

Interrupt U-Boot autoboot via the serial console

options:
  -i, --bdinfo          query board info
  -q, --quiet           do not show progress
  -r, --reset           send reset command first
  -s STR, --string STR  interrupt using custom string
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  --prompt PROMPT       specify expected prompt
  -h, --help            show help message and exit
  --version             show version number and exit

ubcmd

Send a command to U-Boot via the serial console and print the output

usage: ubcmd [-n | -q] [-p PORT] [-b BAUD] [--timeout SECONDS]
             [--mode {shared,exclusive,none}] [--prompt PROMPT] [-h]
             [--version]
             COMMAND ...

Send a command to U-Boot via the serial console and print the output

positional arguments:
  COMMAND               command to send
  ARGS                  arguments

options:
  -n, --no-reply        do not retrieve output nor exit code
  -q, --quiet           do not show non-zero exit code
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  --prompt PROMPT       specify expected prompt
  -h, --help            show help message and exit
  --version             show version number and exit

ubread

Read from U-Boot memory via the serial console

usage: ubread [-q] [-w BITS] [-p PORT] [-b BAUD] [--timeout SECONDS]
              [--mode {shared,exclusive,none}] [--prompt PROMPT] [-h]
              [--version]
              FILE ADDRESS LENGTH

Read from U-Boot memory via the serial console

positional arguments:
  FILE                  Output file (use '-' for stdout)
  ADDRESS               memory address (decimal or hex)
  LENGTH                number of bytes (decimal or hex)

options:
  -q, --quiet           do not show progress
  -w BITS, --word BITS  use reads of specified bit width
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  --prompt PROMPT       specify expected prompt
  -h, --help            show help message and exit
  --version             show version number and exit

ubwrite

Write to U-Boot memory via the serial console

usage: ubwrite [-q] [-w BITS] [-p PORT] [-b BAUD] [--timeout SECONDS]
               [--mode {shared,exclusive,none}] [--prompt PROMPT] [-h]
               [--version]
               FILE ADDRESS

Write to U-Boot memory via the serial console

positional arguments:
  FILE                  input file (use '-' for stdin)
  ADDRESS               memory address (decimal or hex)

options:
  -q, --quiet           do not show progress
  -w BITS, --word BITS  use writes of specified bit width
  -p PORT, --port PORT  serial port device
  -b BAUD, --baud BAUD  serial port baud rate
  --timeout SECONDS     serial port receive timeout
  --mode {shared,exclusive,none}
                        serial port locking mode
  --prompt PROMPT       specify expected prompt
  -h, --help            show help message and exit
  --version             show version number and exit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ubtools-0.2.2.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ubtools-0.2.2-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file ubtools-0.2.2.tar.gz.

File metadata

  • Download URL: ubtools-0.2.2.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ubtools-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8dd7333da5594542ae3cec2898b4130d03f94eb88026512b18f1686a6543f1e9
MD5 72b3adee759660303ae3717622d6679b
BLAKE2b-256 123c49661919a7461cd54ede6172d2136a4e3d7e11ef592e860b0c01a7a87bd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubtools-0.2.2.tar.gz:

Publisher: publish.yml on Lanchon/ubtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ubtools-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ubtools-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ubtools-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58eeaa5f76183314cc5e07df71041e6c72698bfcdc8a615baa29ada248fea141
MD5 348301f205bfd0a09abf06092349914f
BLAKE2b-256 a96ad69e1a0ba66066634eb98571bbf8124672bcd34b9fa05aeec4f4453fd482

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubtools-0.2.2-py3-none-any.whl:

Publisher: publish.yml on Lanchon/ubtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page