Index: lib/cros_image_common.sh |
diff --git a/lib/cros_image_common.sh b/lib/cros_image_common.sh |
index abfdbc57c9bf7e50f70e2b042220b022c58eda67..b9e2802c09fa0e037bb94a24570fa486fc54ff4a 100644 |
--- a/lib/cros_image_common.sh |
+++ b/lib/cros_image_common.sh |
@@ -185,6 +185,16 @@ image_partition_copy() { |
exit 1 |
fi |
+ # Try to use larger buffer if offset/size can be re-aligned. |
+ # 2M / 512 = 4096 |
+ local buffer_ratio=4096 |
+ local bs=512 |
+ if [ $((dstoffset % buffer_ratio)) -eq 0 -a \ |
+ $((length % buffer_ratio)) -eq 0 ]; then |
+ dstoffset=$((dstoffset / buffer_ratio)) |
+ bs=$((bs * buffer_ratio)) |
+ fi |
+ |
image_dump_partition "${src}" "${srcpart}" | |
- dd of="${dst}" bs=512 seek="${dstoffset}" conv=notrunc |
+ dd of="${dst}" bs="${bs}" seek="${dstoffset}" conv=notrunc oflag=dsync |
} |