Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Unified Diff: lib/cros_image_common.sh

Issue 6050006: Allow disk image target for copy machine. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: . Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | make_factory_package.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/cros_image_common.sh
diff --git a/lib/cros_image_common.sh b/lib/cros_image_common.sh
index 86bba755047e612d69916d14876d6df1a6bb0f0e..abfdbc57c9bf7e50f70e2b042220b022c58eda67 100644
--- a/lib/cros_image_common.sh
+++ b/lib/cros_image_common.sh
@@ -168,3 +168,23 @@ image_umount_partition() {
umount -d "$mount_point"
}
+
+# Copy a partition from one image to another.
+image_partition_copy() {
+ local src="$1"
+ local srcpart="$2"
+ local dst="$3"
+ local dstpart="$4"
+
+ local srcoffset=$(image_part_offset "${src}" "${srcpart}")
+ local dstoffset=$(image_part_offset "${dst}" "${dstpart}")
+ local length=$(image_part_size "${src}" "${srcpart}")
+ local dstlength=$(image_part_size "${dst}" "${dstpart}")
+
+ if [ "${length}" -gt "${dstlength}" ]; then
+ exit 1
+ fi
+
+ image_dump_partition "${src}" "${srcpart}" |
+ dd of="${dst}" bs=512 seek="${dstoffset}" conv=notrunc
+}
« no previous file with comments | « no previous file | make_factory_package.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698