littlefs2-pack
A Rust crate for building a file system into a LittleFS binary file to be flashed to an embedded device.
This crate wraps the LittleFS C library using the littlefs2-sys crate. The littlefs2 crate might have been an easier starting point but it doesn't currently allow setting the image configuration dynamically at runtime, such as the block size and count.
littlefs2-pack is tested for compatibility with the C++ mklittlefs project. This is ensured with the cross-compat.rs test that packs with one tool then unpack with the other, in both directions. These tests are ran against the version of mklittlefs in the submodule and requires that tool to be built prior to running the tests.
API
The crate can be called directly to create a LittleFS image from a target directory.
use ;
let config = LfsImageConfig ;
let mut image = new.unwrap;
image.format.unwrap;
image.mount_and_then.unwrap;
let binary = image.into_data;
write.unwrap;