Skip to main content

Crate uboot_shell

Crate uboot_shell 

Source
Expand description

§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

Modules§

crc
CRC16-CCITT checksum implementation. CRC16-CCITT checksum implementation.
ymodem
YMODEM file transfer protocol implementation. YMODEM file transfer protocol implementation.

Structs§

UbootShell
U-Boot shell communication interface.