1 unstable release
new 0.1.0 | Mar 7, 2025 |
---|
#542 in Filesystem
29KB
657 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 flatpaksmacos_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,
true,
Some(tx),
None,
None
)
});
let msgs = futures::executor::block_on_stream(rx);
for m in msgs {
println!("{:?}", m);
}
flash_thread.join().unwrap().unwrap()
}
Dependencies
~5–48MB
~743K SLoC