diff options
| author | Sean Anderson <sean.anderson@seco.com> | 2025-09-25 22:59:29 +0530 |
|---|---|---|
| committer | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-09-26 13:19:48 +0200 |
| commit | b414502a084681cd2c4104c482aa9c30f97a1fb2 (patch) | |
| tree | a670db96ede93569baacd1b3e043f3c22fb88f0c | |
| parent | 033f224986c46c111fd3cff4ce4a25b1875b39c3 (diff) | |
| download | meta-openembedded-b414502a084681cd2c4104c482aa9c30f97a1fb2.tar.gz | |
image_types_sparse: backport fix 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.
This change corresponds to upstream fb331cb62eafd1e534dee292525084ccee0ef3e1
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
| -rw-r--r-- | meta-oe/classes/image_types_sparse.bbclass | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/meta-oe/classes/image_types_sparse.bbclass b/meta-oe/classes/image_types_sparse.bbclass index 4263593a8d..b092f68406 100644 --- a/meta-oe/classes/image_types_sparse.bbclass +++ b/meta-oe/classes/image_types_sparse.bbclass | |||
| @@ -1,8 +1,16 @@ | |||
| 1 | inherit image_types | 1 | inherit 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. | ||
| 8 | SPARSE_BLOCK_SIZE ??= "4096" | ||
| 9 | |||
| 3 | CONVERSIONTYPES += "sparse" | 10 | CONVERSIONTYPES += "sparse" |
| 4 | CONVERSION_CMD:sparse = " \ | 11 | CONVERSION_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" && \ |
| 14 | img2simg "$INPUT" "$INPUT.sparse" ${SPARSE_BLOCK_SIZE} \ | ||
| 7 | " | 15 | " |
| 8 | CONVERSION_DEPENDS_sparse = "android-tools-native" | 16 | CONVERSION_DEPENDS_sparse = "android-tools-native" |
