diff options
author | Mark Hatle <mark.hatle@kernel.crashing.org> | 2019-11-07 17:26:26 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-14 13:20:59 +0000 |
commit | 10cdc3b27dc77e148cb3adde37ee4d02992a409d (patch) | |
tree | 062ed652666193dda638d50257641918dac6eecd | |
parent | bd6052d9d1a3a526ff64cb41379b7d01761a586f (diff) | |
download | poky-10cdc3b27dc77e148cb3adde37ee4d02992a409d.tar.gz |
populate_sdk_ext.bbclass: Make integrated buildtools optional
If the host system is expected to have enough capabilities that the
buildtools-tarball is not required, we don't need to bundle it.
This can save some significant space, especially when using with a minimal
eSDK.
minimal eSDK - core-image-minimal-qemux86-64
with buildtools-tarball - 34 MB installer - 281 MB installed
without buildtoools-tarball - 11 MB installer - 48 MB installed
(From OE-Core rev: e2b215054d11527a05210066b9bfd7d9a2054e01)
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/populate_sdk_ext.bbclass | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass index 9fda1c9e78..05cfc1cc15 100644 --- a/meta/classes/populate_sdk_ext.bbclass +++ b/meta/classes/populate_sdk_ext.bbclass | |||
@@ -21,6 +21,7 @@ SDK_EXT_TYPE ?= "full" | |||
21 | SDK_INCLUDE_PKGDATA ?= "0" | 21 | SDK_INCLUDE_PKGDATA ?= "0" |
22 | SDK_INCLUDE_TOOLCHAIN ?= "${@'1' if d.getVar('SDK_EXT_TYPE') == 'full' else '0'}" | 22 | SDK_INCLUDE_TOOLCHAIN ?= "${@'1' if d.getVar('SDK_EXT_TYPE') == 'full' else '0'}" |
23 | SDK_INCLUDE_NATIVESDK ?= "0" | 23 | SDK_INCLUDE_NATIVESDK ?= "0" |
24 | SDK_INCLUDE_BUILDTOOLS ?= '1' | ||
24 | 25 | ||
25 | SDK_RECRDEP_TASKS ?= "" | 26 | SDK_RECRDEP_TASKS ?= "" |
26 | 27 | ||
@@ -94,6 +95,7 @@ python write_target_sdk_ext_manifest () { | |||
94 | real_target_multimach = d.getVar('REAL_MULTIMACH_TARGET_SYS') | 95 | real_target_multimach = d.getVar('REAL_MULTIMACH_TARGET_SYS') |
95 | 96 | ||
96 | pkgs = {} | 97 | pkgs = {} |
98 | os.makedirs(os.path.dirname(d.getVar('SDK_EXT_TARGET_MANIFEST')), exist_ok=True) | ||
97 | with open(d.getVar('SDK_EXT_TARGET_MANIFEST'), 'w') as f: | 99 | with open(d.getVar('SDK_EXT_TARGET_MANIFEST'), 'w') as f: |
98 | for fn in extra_info['filesizes']: | 100 | for fn in extra_info['filesizes']: |
99 | info = fn.split(':') | 101 | info = fn.split(':') |
@@ -535,8 +537,12 @@ def get_sdk_required_utilities(buildtools_fn, d): | |||
535 | sanity_required_utilities = (d.getVar('SANITY_REQUIRED_UTILITIES') or '').split() | 537 | sanity_required_utilities = (d.getVar('SANITY_REQUIRED_UTILITIES') or '').split() |
536 | sanity_required_utilities.append(d.expand('${BUILD_PREFIX}gcc')) | 538 | sanity_required_utilities.append(d.expand('${BUILD_PREFIX}gcc')) |
537 | sanity_required_utilities.append(d.expand('${BUILD_PREFIX}g++')) | 539 | sanity_required_utilities.append(d.expand('${BUILD_PREFIX}g++')) |
538 | buildtools_installer = os.path.join(d.getVar('SDK_DEPLOY'), buildtools_fn) | 540 | if buildtools_fn: |
539 | filelist, _ = bb.process.run('%s -l' % buildtools_installer) | 541 | buildtools_installer = os.path.join(d.getVar('SDK_DEPLOY'), buildtools_fn) |
542 | filelist, _ = bb.process.run('%s -l' % buildtools_installer) | ||
543 | else: | ||
544 | buildtools_installer = None | ||
545 | filelist = "" | ||
540 | localdata = bb.data.createCopy(d) | 546 | localdata = bb.data.createCopy(d) |
541 | localdata.setVar('SDKPATH', '.') | 547 | localdata.setVar('SDKPATH', '.') |
542 | sdkpathnative = localdata.getVar('SDKPATHNATIVE') | 548 | sdkpathnative = localdata.getVar('SDKPATHNATIVE') |
@@ -579,7 +585,9 @@ install_tools() { | |||
579 | touch ${SDK_OUTPUT}/${SDKPATH}/.devtoolbase | 585 | touch ${SDK_OUTPUT}/${SDKPATH}/.devtoolbase |
580 | 586 | ||
581 | # find latest buildtools-tarball and install it | 587 | # find latest buildtools-tarball and install it |
582 | install ${SDK_DEPLOY}/${SDK_BUILDTOOLS_INSTALLER} ${SDK_OUTPUT}/${SDKPATH} | 588 | if [ -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then |
589 | install ${SDK_DEPLOY}/${SDK_BUILDTOOLS_INSTALLER} ${SDK_OUTPUT}/${SDKPATH} | ||
590 | fi | ||
583 | 591 | ||
584 | install -m 0644 ${COREBASE}/meta/files/ext-sdk-prepare.py ${SDK_OUTPUT}/${SDKPATH} | 592 | install -m 0644 ${COREBASE}/meta/files/ext-sdk-prepare.py ${SDK_OUTPUT}/${SDKPATH} |
585 | } | 593 | } |
@@ -629,16 +637,18 @@ sdk_ext_postinst() { | |||
629 | printf "\nExtracting buildtools...\n" | 637 | printf "\nExtracting buildtools...\n" |
630 | cd $target_sdk_dir | 638 | cd $target_sdk_dir |
631 | env_setup_script="$target_sdk_dir/environment-setup-${REAL_MULTIMACH_TARGET_SYS}" | 639 | env_setup_script="$target_sdk_dir/environment-setup-${REAL_MULTIMACH_TARGET_SYS}" |
632 | printf "buildtools\ny" | ./${SDK_BUILDTOOLS_INSTALLER} > buildtools.log || { printf 'ERROR: buildtools installation failed:\n' ; cat buildtools.log ; echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; } | 640 | if [ -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then |
641 | printf "buildtools\ny" | ./${SDK_BUILDTOOLS_INSTALLER} > buildtools.log || { printf 'ERROR: buildtools installation failed:\n' ; cat buildtools.log ; echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; } | ||
633 | 642 | ||
634 | # Delete the buildtools tar file since it won't be used again | 643 | # Delete the buildtools tar file since it won't be used again |
635 | rm -f ./${SDK_BUILDTOOLS_INSTALLER} | 644 | rm -f ./${SDK_BUILDTOOLS_INSTALLER} |
636 | # We don't need the log either since it succeeded | 645 | # We don't need the log either since it succeeded |
637 | rm -f buildtools.log | 646 | rm -f buildtools.log |
638 | 647 | ||
639 | # Make sure when the user sets up the environment, they also get | 648 | # Make sure when the user sets up the environment, they also get |
640 | # the buildtools-tarball tools in their path. | 649 | # the buildtools-tarball tools in their path. |
641 | echo ". $target_sdk_dir/buildtools/environment-setup*" >> $env_setup_script | 650 | echo ". $target_sdk_dir/buildtools/environment-setup*" >> $env_setup_script |
651 | fi | ||
642 | 652 | ||
643 | # Allow bitbake environment setup to be ran as part of this sdk. | 653 | # Allow bitbake environment setup to be ran as part of this sdk. |
644 | echo "export OE_SKIP_SDK_CHECK=1" >> $env_setup_script | 654 | echo "export OE_SKIP_SDK_CHECK=1" >> $env_setup_script |
@@ -654,7 +664,7 @@ sdk_ext_postinst() { | |||
654 | # Warn if trying to use external bitbake and the ext SDK together | 664 | # Warn if trying to use external bitbake and the ext SDK together |
655 | echo "(which bitbake > /dev/null 2>&1 && echo 'WARNING: attempting to use the extensible SDK in an environment set up to run bitbake - this may lead to unexpected results. Please source this script in a new shell session instead.') || true" >> $env_setup_script | 665 | echo "(which bitbake > /dev/null 2>&1 && echo 'WARNING: attempting to use the extensible SDK in an environment set up to run bitbake - this may lead to unexpected results. Please source this script in a new shell session instead.') || true" >> $env_setup_script |
656 | 666 | ||
657 | if [ "$prepare_buildsystem" != "no" ]; then | 667 | if [ "$prepare_buildsystem" != "no" -a -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then |
658 | printf "Preparing build system...\n" | 668 | printf "Preparing build system...\n" |
659 | # dash which is /bin/sh on Ubuntu will not preserve the | 669 | # dash which is /bin/sh on Ubuntu will not preserve the |
660 | # current working directory when first ran, nor will it set $1 when | 670 | # current working directory when first ran, nor will it set $1 when |
@@ -680,7 +690,10 @@ fakeroot python do_populate_sdk_ext() { | |||
680 | bb.fatal('The extensible SDK can currently only be built for the same architecture as the machine being built on - SDK_ARCH is set to %s (likely via setting SDKMACHINE) which is different from the architecture of the build machine (%s). Unable to continue.' % (d.getVar('SDK_ARCH'), d.getVar('BUILD_ARCH'))) | 690 | bb.fatal('The extensible SDK can currently only be built for the same architecture as the machine being built on - SDK_ARCH is set to %s (likely via setting SDKMACHINE) which is different from the architecture of the build machine (%s). Unable to continue.' % (d.getVar('SDK_ARCH'), d.getVar('BUILD_ARCH'))) |
681 | 691 | ||
682 | d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d)) | 692 | d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d)) |
683 | buildtools_fn = get_current_buildtools(d) | 693 | if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1': |
694 | buildtools_fn = get_current_buildtools(d) | ||
695 | else: | ||
696 | buildtools_fn = None | ||
684 | d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d)) | 697 | d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d)) |
685 | d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn) | 698 | d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn) |
686 | d.setVar('SDKDEPLOYDIR', '${SDKEXTDEPLOYDIR}') | 699 | d.setVar('SDKDEPLOYDIR', '${SDKEXTDEPLOYDIR}') |
@@ -731,7 +744,7 @@ def get_sdk_ext_rdepends(d): | |||
731 | do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}" | 744 | do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}" |
732 | 745 | ||
733 | do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \ | 746 | do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \ |
734 | buildtools-tarball:do_populate_sdk \ | 747 | ${@'buildtools-tarball:do_populate_sdk' if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1' else ''} \ |
735 | ${@'meta-world-pkgdata:do_collect_packagedata' if d.getVar('SDK_INCLUDE_PKGDATA') == '1' else ''} \ | 748 | ${@'meta-world-pkgdata:do_collect_packagedata' if d.getVar('SDK_INCLUDE_PKGDATA') == '1' else ''} \ |
736 | ${@'meta-extsdk-toolchain:do_locked_sigs' if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1' else ''}" | 749 | ${@'meta-extsdk-toolchain:do_locked_sigs' if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1' else ''}" |
737 | 750 | ||