diff options
author | Mike Looijmans <mike.looijmans@topic.nl> | 2020-03-20 15:45:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-22 10:48:43 +0000 |
commit | 27ff81bfd880280607c79dce2f724c8bfafce02d (patch) | |
tree | 899ea46d7fcacc6ed1488b7f76257c546b0e1192 /meta/classes/populate_sdk_base.bbclass | |
parent | 2298791719a0c94755737e44776191fa64e41523 (diff) | |
download | poky-27ff81bfd880280607c79dce2f724c8bfafce02d.tar.gz |
classes/populate_sdk_base: Implement xz compression options
Building an SDK on a machine with 8GB RAM resulted in excessive swapping
due to the xz compressor using ~20GB of memory. This is because xz is
being called with "-T 0 -9".
To allow tuning the compression versus memory usage, introduce a variable
named SDK_XZ_OPTIONS that defaults to a more sane default:
SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}"
The use of XZ_DEFAULTS fixes the excessive memory usage.
The SDK_XZ_COMPRESSION_LEVEL variable allows overriding the speed vs
compression. In an office or development environment the extra time
spent on compressing a few percent more is just not worth it.
(From OE-Core rev: 25533a48a19e3e6eb9f96be51b1373830b5bb9f0)
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/populate_sdk_base.bbclass')
-rw-r--r-- | meta/classes/populate_sdk_base.bbclass | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass index 3248bb01c3..ef0d8bef58 100644 --- a/meta/classes/populate_sdk_base.bbclass +++ b/meta/classes/populate_sdk_base.bbclass | |||
@@ -49,6 +49,8 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}" | |||
49 | 49 | ||
50 | # Default archived SDK's suffix | 50 | # Default archived SDK's suffix |
51 | SDK_ARCHIVE_TYPE ?= "tar.xz" | 51 | SDK_ARCHIVE_TYPE ?= "tar.xz" |
52 | SDK_XZ_COMPRESSION_LEVEL ?= "-9" | ||
53 | SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}" | ||
52 | 54 | ||
53 | # To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz | 55 | # To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz |
54 | python () { | 56 | python () { |
@@ -59,7 +61,7 @@ python () { | |||
59 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .') | 61 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .') |
60 | else: | 62 | else: |
61 | d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native') | 63 | d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native') |
62 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz -T 0 -9 > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}') | 64 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz ${SDK_XZ_OPTIONS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}') |
63 | } | 65 | } |
64 | 66 | ||
65 | SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" | 67 | SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" |