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

Interrupt U-Boot autoboot via the serial console

options:
  -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 [-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:
  -q, --quiet           do not show 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.0.tar.gz (22.7 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.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ubtools-0.2.0.tar.gz
  • Upload date:
  • Size: 22.7 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.0.tar.gz
Algorithm Hash digest
SHA256 a8471408c1d8b40a444005ba1ee0e14a2f584428755ffb580fc37f9ae19a514c
MD5 302ad91700027a7538ace25216798f83
BLAKE2b-256 c926278fba79ad4a855ea74dfb1f5b8f9ed90cb516b8f3393079f03ed98b0c2b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ubtools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c8fef6008bc95be0fbe637faa4a93f9658dbd041afada8cddf5bfcd91e65ba2
MD5 5b22fb78505940a501b6a47d49314940
BLAKE2b-256 e470ad83ce32f6e3d604b202667dd2db847f4d5b783af18c46cf57ce35324b61

See more details on using hashes here.

Provenance

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