mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-13 17:39:57 +00:00
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 fb331cb62e
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>
This commit is contained in:
committed by
Gyorgy Sarvari
parent
033f224986
commit
b414502a08
@@ -1,8 +1,16 @@
|
||||
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 = " \
|
||||
img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
|
||||
"${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
|
||||
INPUT="${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" && \
|
||||
truncate --no-create --size=%${SPARSE_BLOCK_SIZE} "$INPUT" && \
|
||||
img2simg "$INPUT" "$INPUT.sparse" ${SPARSE_BLOCK_SIZE} \
|
||||
"
|
||||
CONVERSION_DEPENDS_sparse = "android-tools-native"
|
||||
|
||||
Reference in New Issue
Block a user