Crate flashkit_ubi_linux
Expand description
UBI devices and volumes on Linux.
use std::fs::File;
use std::io::BufReader;
use flashkit_ubi_linux::DeviceInfo;
let device = DeviceInfo::attach(23).run()?;
let volume = device
.volume_by_name(b"rootfs")?
.ok_or("no rootfs volume")?;
let image = File::open("rootfs.squashfs")?;
let size = image.metadata()?.len();
volume.update(BufReader::new(image), size)?;
device.detach()?;DeviceInfo finds UBI devices in sysfs, and attaches and detaches them.
DeviceInfo::attach returns AttachOptions for the options of an
attach. VolumeInfo reads and
updates the volumes of a device. The crate doesnβt detach devices or wait
for device files on its own. Callers decide when to do that.
See flashkit-ubi for the on-flash format and UBI images.
Re-exportsΒ§
pub use flashkit_ubi as ubi;
ModulesΒ§
- attach_
options π - device_
error π - device_
info π - sysfs_
dir π - volume_
info π
StructsΒ§
- Attach
Options - Attach of an MTD device to UBI, returned by
DeviceInfo::attach. - Device
Info - UBI device attached to an MTD device, with its attributes from sysfs.
- Devices
- Iterator over all UBI devices, returned by
DeviceInfo::all. - Volume
Info - Volume of a UBI device, with its attributes from sysfs.
- Volumes
- Iterator over the volumes of a UBI device, returned by
super::DeviceInfo::volumes.
EnumsΒ§
- Device
Error - Failure of a UBI device or volume operation.