zst is much faster than the default xz, test result on my Precision 5680 machine:
Installing a tar.xz SDK takes 37 seconds while tar.zst only takes 17 seconds. Let's introduce support for tar.zst. Also add a sanity check for supported archive types. Signed-off-by: Ming Liu <[email protected]> --- meta/classes-recipe/populate_sdk_base.bbclass | 8 +++++++- meta/files/toolchain-shar-extract.sh | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass index 16013d5872..562f80d211 100644 --- a/meta/classes-recipe/populate_sdk_base.bbclass +++ b/meta/classes-recipe/populate_sdk_base.bbclass @@ -84,6 +84,7 @@ SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}" SDK_ZIP_OPTIONS ?= "-y" SDK_7ZIP_OPTIONS ?= "-mx=9 -mm=BZip2" SDK_7ZIP_TYPE ?= "7z" +SDK_ZSTD_COMPRESSION_LEVEL = "-17" # To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz python () { @@ -95,9 +96,14 @@ python () { elif d.getVar('SDK_ARCHIVE_TYPE') == '7zip': d.setVar('SDK_ARCHIVE_DEPENDS', 'p7zip-native') d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; 7za a -r ${SDK_7ZIP_OPTIONS} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_7ZIP_TYPE} .') - else: + elif d.getVar('SDK_ARCHIVE_TYPE') == 'tar.zst': + d.setVar('SDK_ARCHIVE_DEPENDS', 'zstd-native') + d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | zstd -f -k -T0 -c ${SDK_ZSTD_COMPRESSION_LEVEL} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}') + elif d.getVar('SDK_ARCHIVE_TYPE') == 'tar.xz': d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native') d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz ${SDK_XZ_OPTIONS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}') + else: + bb.fatal("Invalid SDK_ARCHIVE_TYPE: %s, the supported SDK archive types are: zip, 7z, tar.xz, tar.zst" % d.getVar('SDK_ARCHIVE_TYPE')) } SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh index 9b72499ccf..208afaa4ae 100644 --- a/meta/files/toolchain-shar-extract.sh +++ b/meta/files/toolchain-shar-extract.sh @@ -255,6 +255,12 @@ if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then else rm sdk.zip && exit 1 fi +elif [ @SDK_ARCHIVE_TYPE@ = "tar.zst" ]; then + if [ -z "$(which zstd)" ]; then + echo "Aborted, zstd is required to extract the SDK archive, please make sure it's installed on your system!" + exit 1 + fi + tail -n +$payload_offset "$0"| zstd -T0 -dc | $SUDO_EXEC tar mx -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 else if [ -z "$(which xz)" ]; then echo "Aborted, xz is required to extract the SDK archive, please make sure it's installed on your system!" -- 2.43.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#206197): https://lists.openembedded.org/g/openembedded-core/message/206197 Mute This Topic: https://lists.openembedded.org/mt/109168389/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
