diff options
| author | AshishKumar Mishra <emailaddress.ashish@gmail.com> | 2025-09-14 21:10:09 +0530 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-09-15 09:55:16 -0700 |
| commit | f5246b7df447ac76ec04c6e5add398862d1c9ccd (patch) | |
| tree | b42196a5220244f6d5ba742402b88a50e4aee95c | |
| parent | 0601a0bd8f4a6855e5a5036c7a905250f3ba703b (diff) | |
| download | meta-openembedded-f5246b7df447ac76ec04c6e5add398862d1c9ccd.tar.gz | |
meta-oe: image: optionally remove RAW image after sparse image creation
When creating sparse images, the RAW image is no longer needed in
some workflows such as Android and CI pipelines. These RAW images
can be multi-GB artifacts and consume significant disk space.
This change introduces a configuration option
`DELETE_RAWIMAGE_AFTER_SPARSE_CMD` which, when set to "1",
removes the RAW image after sparse image generation.
This reduces disk usage in builds where sparse images are the
final deliverables and RAW images are not required.
Default behavior is unchanged: RAW images are kept unless the
variable is explicitly enabled:
DELETE_RAWIMAGE_AFTER_SPARSE_CMD = "1" # Delete RAW image
DELETE_RAWIMAGE_AFTER_SPARSE_CMD = "0" # Default behavior
Signed-off-by: AshishKumar Mishra <emailaddress.ashish@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/classes/image_types_sparse.bbclass | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/meta-oe/classes/image_types_sparse.bbclass b/meta-oe/classes/image_types_sparse.bbclass index d6ea68968e..5416c2a019 100644 --- a/meta-oe/classes/image_types_sparse.bbclass +++ b/meta-oe/classes/image_types_sparse.bbclass | |||
| @@ -9,9 +9,15 @@ SPARSE_BLOCK_SIZE ??= "4096" | |||
| 9 | 9 | ||
| 10 | CONVERSIONTYPES += "sparse" | 10 | CONVERSIONTYPES += "sparse" |
| 11 | 11 | ||
| 12 | DELETE_RAWIMAGE_AFTER_SPARSE_CMD ??= "0" | ||
| 13 | |||
| 12 | CONVERSION_CMD:sparse = " \ | 14 | CONVERSION_CMD:sparse = " \ |
| 13 | truncate --no-create --size=%${SPARSE_BLOCK_SIZE} "${IMAGE_NAME}.${type}"; \ | 15 | truncate --no-create --size=%${SPARSE_BLOCK_SIZE} "${IMAGE_NAME}.${type}"; \ |
| 14 | img2simg -s "${IMAGE_NAME}.${type}" "${IMAGE_NAME}.${type}.sparse" ${SPARSE_BLOCK_SIZE}; \ | 16 | img2simg -s "${IMAGE_NAME}.${type}" "${IMAGE_NAME}.${type}.sparse" ${SPARSE_BLOCK_SIZE}; \ |
| 17 | if [ "${DELETE_RAWIMAGE_AFTER_SPARSE_CMD}" = "1" ]; then \ | ||
| 18 | rm -f ${IMAGE_NAME}.${type};\ | ||
| 19 | bbwarn "Raw file ${IMAGE_NAME}.${type} removed" ;\ | ||
| 20 | fi;\ | ||
| 15 | " | 21 | " |
| 16 | 22 | ||
| 17 | CONVERSION_DEPENDS_sparse = "android-tools-native" | 23 | CONVERSION_DEPENDS_sparse = "android-tools-native" |
