summaryrefslogtreecommitdiffstats
path: root/meta-oe/classes
diff options
context:
space:
mode:
authorSean Anderson <sean.anderson@seco.com>2022-08-12 15:44:03 -0400
committerKhem Raj <raj.khem@gmail.com>2022-08-13 07:05:31 -0700
commitfb331cb62eafd1e534dee292525084ccee0ef3e1 (patch)
treed13fca8d63365652f8ad36ad78d2314c4a331d1f /meta-oe/classes
parentd2e903b5d60c72e4afe79fd317f321314892d19a (diff)
downloadmeta-openembedded-fb331cb62eafd1e534dee292525084ccee0ef3e1.tar.gz
image_types_sparse: Pad source image to block size
If the source image's size is not aligned to the sparse image's block size, then conversion will fail with img2simg: libsparse/sparse.cpp:133: int write_all_blocks(sparse_file*, output_file*): Assertion `pad >= 0' failed. This is a bug in img2simg, but an easy way to work around it is to pad the source image ourselves. The default block size of 4096 matches img2simg's default block size. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/classes')
-rw-r--r--meta-oe/classes/image_types_sparse.bbclass16
1 files changed, 12 insertions, 4 deletions
diff --git a/meta-oe/classes/image_types_sparse.bbclass b/meta-oe/classes/image_types_sparse.bbclass
index 4263593a8..355a3dafc 100644
--- a/meta-oe/classes/image_types_sparse.bbclass
+++ b/meta-oe/classes/image_types_sparse.bbclass
@@ -1,8 +1,16 @@
1inherit image_types 1inherit image_types
2 2
3# 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
3CONVERSIONTYPES += "sparse" 10CONVERSIONTYPES += "sparse"
4CONVERSION_CMD:sparse = " \ 11CONVERSION_CMD:sparse() {
5 img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \ 12 INPUT="${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
6 "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \ 13 truncate --no-create --size=%${SPARSE_BLOCK_SIZE} "$INPUT"
7" 14 img2simg "$INPUT" "$INPUT.sparse" ${SPARSE_BLOCK_SIZE}
15}
8CONVERSION_DEPENDS_sparse = "android-tools-native" 16CONVERSION_DEPENDS_sparse = "android-tools-native"