3 releases (1 stable)

Uses new Rust 2024

new 1.0.0 Mar 29, 2025
0.1.1 Mar 21, 2025
0.1.0 Mar 7, 2025

#265 in Development tools

Download history 121/week @ 2025-03-05 3/week @ 2025-03-12 120/week @ 2025-03-19 127/week @ 2025-03-26

371 downloads per month

MIT and maybe LGPL-2.1

32KB
747 lines

SD Card Flasher

Library to flash SD cards with OS images. Powers sd card flashing in BeagleBoard Imager.

Also allows optional extra Customization for BeagleBoard images. Currently only supports sysconf based post-install configuration.

Platform Support

  • Linux
  • Windows
  • MacOS

Features

  • udev: Dynamic permissions on Linux. Mostly useful for GUI and flatpaks
  • macos_authopen: Dynamic permissions on MacOS.

Usage

use std::path::Path;
use std::fs::File;

fn main() {
    let dst = Path::new("/tmp/dummy");
    let img = || {
        Ok((File::open("/tmp/image")?, 1024))
    };
    let (tx, rx) = futures::channel::mpsc::channel(20);

    let flash_thread = std::thread::spawn(move || {
        bb_flasher_sd::flash(
            img,
            dst,
            Some(tx),
            None,
            None
        )
    });

    let msgs = futures::executor::block_on_stream(rx);
    for m in msgs {
        println!("{:?}", m);
    }

    flash_thread.join().unwrap().unwrap()
}

Dependencies

~4–48MB
~718K SLoC