A utility that converts disk images with block map (bmap) sparse information to the Android sparse image format. The tool reads bmap files that describe which blocks of a disk image contain actual data, then creates an Android sparse image that efficiently stores only the mapped blocks whilst preserving the original image structure. This is particularly useful for creating compact, flashable images from larger disk images that contain significant amounts of empty space. Many fastboot implementations directly support sparse images.
This project is packaged as a native Debian package and uses Debian's librust-* packages for dependencies rather than downloading crates from crates.io, ensuring an isolated and reproducible build environment.
Install build tools:
sudo apt install git-buildpackage sbuildBuild the package in a dedicated chroot:
gbp buildpackageTo build for a specific CPU architecture:
gbp buildpackage --arch=arm64Note: this is not cross-compilation — a chroot is prepared for the architecture
you request and qemu-user emulation is used (qemu-user package) if this does
not match your host architecture; arch-native tools are always used for builds.
The build artifacts can be found in the ../build-area directory.
Incremental builds, used during development, require build-deps to be installed on the host:
sudo mk-build-deps --install --removeThese can be later removed (if they're no longer required) with:
sudo apt-get remove --auto-remove bmap2simg-build-depsPrepare a package-specific cargo home and registry:
dpkg-buildpackage -T dev-configure -ncCargo can then be used with the CARGO_HOME environment variable set, e.g.:
CARGO_HOME=debian/cargo_home cargo checkAll Rust dependencies are satisfied by Debian's librust-* packages as specified in debian/control. This ensures the build is completely isolated from external package registries and uses only packages that have been reviewed and packaged by Debian maintainers.