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"

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 [-r] [-s STR] [-p PORT] [-b BAUD] [--timeout SECONDS]
             [--mode {shared,exclusive,none}] [-h] [--version]

Interrupt U-Boot autoboot via the serial console

options:
  -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
  -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}] [-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
  -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}] [-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
  -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}] [-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
  -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.1.tar.gz (22.9 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.1-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ubtools-0.2.1.tar.gz
  • Upload date:
  • Size: 22.9 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.1.tar.gz
Algorithm Hash digest
SHA256 3666fe1510e9debeb5f3b1fdff0ccc689a3165bbc04930f2a5ba5d4f6ab66e98
MD5 da183d440eab92e87a9b31087db000a5
BLAKE2b-256 dd9e9f73b1c68875a6f3ddf1fb888486646184207bbf9b147eebf3e616456f00

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubtools-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: ubtools-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c0dc586141325429a2410f143ca47f428977f625a4e807faea4339016286db2
MD5 43fe8f989c889babb61547d89bff8f71
BLAKE2b-256 9278a5e0901bcaceb7cb3c624ba92f6792ce195ace0097d1a0faad697f75791b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubtools-0.2.1-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