Hi all,
I had a go at hacking up a tool to copy sparse images to cards less wastefully (and hopefully faster) by only coping to the important data: See the src/fibcp.c here:
git://git.linaro.org/people/dmart/tools.git
It's used like this:
# fibcp image.bin /dev/<sdcard>
There are some caveats, most notably:
* You have to be root, since the tool relies on the FIBMAP ioctl. * The filesystem the image file is generated on must not "optmise" explicit writing of blocks of zeros by generating a sparse file. ext[2-4] should work; not sure about btrfs. * The image must be freshly generated via a loop mount (e.g., linaro-media-create --image_file ... copied, tar'd or gzip'd images won't work).
It works well enough that e2fsck passes after a writing an image to a card which was previously full of random data.
Anyway, it's there if anyone wants to play with it -- comments welcome.
Cheers ---Dave