blob: 69e24cbb796ac6800dd9413f27fa7da7b0ce430d [file] [log] [blame]
Andrew Geissler32b11992021-03-31 13:37:05 -05001inherit image_types
2
Patrick Williams92b42cb2022-09-03 06:53:57 -05003# This sets the granularity of the sparse image conversion. Chunk sizes will be
4# specified in units of this value. Setting this value smaller than the
5# underlying image's block size will not result in any further space saving.
6# However, there is no loss in correctness if this value is larger or smaller
7# than optimal. This value should be a power of two.
8SPARSE_BLOCK_SIZE ??= "4096"
9
Andrew Geissler32b11992021-03-31 13:37:05 -050010CONVERSIONTYPES += "sparse"
Patrick Williams92b42cb2022-09-03 06:53:57 -050011CONVERSION_CMD:sparse() {
12 INPUT="${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
13 truncate --no-create --size=%${SPARSE_BLOCK_SIZE} "$INPUT"
14 img2simg -s "$INPUT" "$INPUT.sparse" ${SPARSE_BLOCK_SIZE}
15}
Andrew Geissler32b11992021-03-31 13:37:05 -050016CONVERSION_DEPENDS_sparse = "android-tools-native"