14 releases
Uses new Rust 2024
| 0.2.2 | Jan 29, 2026 |
|---|---|
| 0.2.1 | Jan 29, 2026 |
| 0.2.0 | Nov 13, 2025 |
| 0.1.10 | Sep 28, 2025 |
| 0.1.5 | Mar 27, 2025 |
#704 in Operating systems
178 downloads per month
Used in ostool
30KB
479 lines
uboot-shell
A Rust library for communicating with U-Boot bootloader over serial connection.
This crate provides functionality to interact with U-Boot shell, execute commands, transfer files via YMODEM protocol, and manage environment variables.
Features
- Automatic U-Boot shell detection and synchronization
- Command execution with retry support
- YMODEM file transfer protocol implementation
- Environment variable management
- CRC16-CCITT checksum support
Quick Start
use uboot_shell::UbootShell;
use std::io::{Read, Write};
// Open serial port (using serialport crate)
let port = serialport::new("/dev/ttyUSB0", 115200)
.open()
.unwrap();
let rx = port.try_clone().unwrap();
let tx = port;
// Create U-Boot shell instance (blocks until shell is ready)
let mut uboot = UbootShell::new(tx, rx).unwrap();
// Execute commands
let output = uboot.cmd("help").unwrap();
println!("{}", output);
// Get/set environment variables
let bootargs = uboot.env("bootargs").unwrap();
uboot.set_env("myvar", "myvalue").unwrap();
// Transfer file via YMODEM
uboot.loady(0x80000000, "kernel.bin", |sent, total| {
println!("Progress: {}/{}", sent, total);
}).unwrap();
Modules
- [
crc] - CRC16-CCITT checksum implementation ymodem- YMODEM file transfer protocol
U-Boot Shell
A crate for communicating with u-boot.
Usage
use uboot_shell::UbootShell;
let port = "/dev/ttyUSB0";
let baud = 115200;
let rx = serialport::new(port, baud)
.open()
.unwrap();
let tx = rx.try_clone().unwrap();
println!("wait for u-boot shell...");
let mut uboot = UbootShell::new(tx, rx).unwrap();
println!("u-boot shell ready");
let res = uboot.cmd("help").unwrap();
println!("{}", res);
Dependencies
~0.1–2MB
~36K SLoC