-
Notifications
You must be signed in to change notification settings - Fork 53
bmap tools
Currently the recommended way of flashing a Gumstix system image generated by the Yocto Project is to use the wic
tool to created dd
-able image, and dd
the image into a uSD card.
The process of flashing an image using dd
takes about 6 min in the case of the Gumstix Console Image. This can be shortened by tweaking parameters such as the blocksize. However finding the right values is not always straight forward.
You can use an alternative tool called bmap-tools
to speed up the process.
The theory of operation is rather simple. The bmap-tools
create a map of files and empty spaces of an image. Using this information, it can avoid spending time on writing 0
s.
Install bmap-tools
:
$ sudo apt-get install bmap-tools
Create a map:
$ bmaptool create /var/tmp/wic/build/sdimage-bootpart-gumstix-201506231653-mmcblk.direct > image.bmap
Flash uSD:
$ sudo bmaptool copy --bmap image.bmap /var/tmp/wic/build/sdimage-bootpart-gumstix-201506231653-mmcblk.direct /dev/sdb
Here is a rudimentary comparison between DD
and bmaptool
.
$ time sudo bmaptool copy --bmap image.bmap sdimage-gumstix-201508211318-mmcblk0.direct /dev/sdc
bmaptool: info: block map format version 2.0
bmaptool: info: 478004 blocks of size 4096 (1.8 GiB), mapped 475959 blocks (1.8 GiB or 99.6%)
bmaptool: info: copying image 'sdimage-gumstix-201508211318-mmcblk0.direct' to block device '/dev/sdc' using bmap file 'image.bmap'
bmaptool: info: 100% copied
bmaptool: info: synchronizing '/dev/sdc'
bmaptool: info: copying time: 2m 37.1s, copying speed 11.8 MiB/sec
real 2m37.302s
user 0m15.216s
sys 0m3.612s
$ time sudo dd if=sdimage-gumstix-201508211318-mmcblk0.direct of=/dev/sdc
3824026+0 records in
3824026+0 records out
1957901312 bytes (2.0 GB) copied, 393.04 s, 5.0 MB/s
real 6m33.053s
user 0m0.684s
sys 0m10.288s
Using the identical setup (same card, same writer, and etc...), bmaptool
performed more than twice faster than dd
. Not bad!