aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/classes/image_types_sparse.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/classes/image_types_sparse.bbclass')
-rw-r--r--meta-oe/classes/image_types_sparse.bbclass25
1 files changed, 13 insertions, 12 deletions
diff --git a/meta-oe/classes/image_types_sparse.bbclass b/meta-oe/classes/image_types_sparse.bbclass
index 1459f800a5..d6ea68968e 100644
--- a/meta-oe/classes/image_types_sparse.bbclass
+++ b/meta-oe/classes/image_types_sparse.bbclass
@@ -1,16 +1,17 @@
inherit image_types
+# This sets the granularity of the sparse image conversion. Chunk sizes will be
+# specified in units of this value. Setting this value smaller than the
+# underlying image's block size will not result in any further space saving.
+# However, there is no loss in correctness if this value is larger or smaller
+# than optimal. This value should be a power of two.
+SPARSE_BLOCK_SIZE ??= "4096"
+
CONVERSIONTYPES += "sparse"
-CONVERSION_CMD_sparse() {
- in="${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
- out="${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse"
- case "${type}" in
- ext*)
- ext2simg "$in" "$out"
- ;;
- *)
- img2simg "$in" "$out"
- ;;
- esac
-}
+
+CONVERSION_CMD:sparse = " \
+ truncate --no-create --size=%${SPARSE_BLOCK_SIZE} "${IMAGE_NAME}.${type}"; \
+ img2simg -s "${IMAGE_NAME}.${type}" "${IMAGE_NAME}.${type}.sparse" ${SPARSE_BLOCK_SIZE}; \
+ "
+
CONVERSION_DEPENDS_sparse = "android-tools-native"