Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # Extensible SDK |
| 2 | |
| 3 | inherit populate_sdk_base |
| 4 | |
| 5 | # NOTE: normally you cannot use task overrides for this kind of thing - this |
| 6 | # only works because of get_sdk_ext_rdepends() |
| 7 | |
| 8 | TOOLCHAIN_HOST_TASK_task-populate-sdk-ext = " \ |
| 9 | meta-environment-extsdk-${MACHINE} \ |
| 10 | " |
| 11 | |
| 12 | TOOLCHAIN_TARGET_TASK_task-populate-sdk-ext = "" |
| 13 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | SDK_RELOCATE_AFTER_INSTALL_task-populate-sdk-ext = "0" |
| 15 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 16 | SDK_EXT = "" |
| 17 | SDK_EXT_task-populate-sdk-ext = "-ext" |
| 18 | |
| 19 | # Options are full or minimal |
| 20 | SDK_EXT_TYPE ?= "full" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 21 | SDK_INCLUDE_PKGDATA ?= "0" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | SDK_INCLUDE_TOOLCHAIN ?= "${@'1' if d.getVar('SDK_EXT_TYPE') == 'full' else '0'}" |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 23 | SDK_INCLUDE_NATIVESDK ?= "0" |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 24 | SDK_INCLUDE_BUILDTOOLS ?= '1' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 25 | |
| 26 | SDK_RECRDEP_TASKS ?= "" |
| 27 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | SDK_LOCAL_CONF_WHITELIST ?= "" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 29 | SDK_LOCAL_CONF_BLACKLIST ?= "CONF_VERSION \ |
| 30 | BB_NUMBER_THREADS \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 31 | BB_NUMBER_PARSE_THREADS \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 32 | PARALLEL_MAKE \ |
| 33 | PRSERV_HOST \ |
| 34 | SSTATE_MIRRORS \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 35 | DL_DIR \ |
| 36 | SSTATE_DIR \ |
| 37 | TMPDIR \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 38 | BB_SERVER_TIMEOUT \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 39 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | SDK_INHERIT_BLACKLIST ?= "buildhistory icecc" |
| 41 | SDK_UPDATE_URL ?= "" |
| 42 | |
| 43 | SDK_TARGETS ?= "${PN}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 44 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 45 | def get_sdk_install_targets(d, images_only=False): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 46 | sdk_install_targets = '' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 47 | if images_only or d.getVar('SDK_EXT_TYPE') != 'minimal': |
| 48 | sdk_install_targets = d.getVar('SDK_TARGETS') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 49 | |
| 50 | depd = d.getVar('BB_TASKDEPDATA', False) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 51 | tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d) |
| 52 | tasklist.remove('do_build') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 53 | for v in depd.values(): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 54 | if v[1] in tasklist: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 55 | if v[0] not in sdk_install_targets: |
| 56 | sdk_install_targets += ' {}'.format(v[0]) |
| 57 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 58 | if not images_only: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 59 | if d.getVar('SDK_INCLUDE_PKGDATA') == '1': |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 60 | sdk_install_targets += ' meta-world-pkgdata:do_allpackagedata' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 61 | if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1': |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 62 | sdk_install_targets += ' meta-extsdk-toolchain:do_populate_sysroot' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 63 | |
| 64 | return sdk_install_targets |
| 65 | |
| 66 | get_sdk_install_targets[vardepsexclude] = "BB_TASKDEPDATA" |
| 67 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 | OE_INIT_ENV_SCRIPT ?= "oe-init-build-env" |
| 69 | |
| 70 | # The files from COREBASE that you want preserved in the COREBASE copied |
| 71 | # into the sdk. This allows someone to have their own setup scripts in |
| 72 | # COREBASE be preserved as well as untracked files. |
| 73 | COREBASE_FILES ?= " \ |
| 74 | oe-init-build-env \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 75 | scripts \ |
| 76 | LICENSE \ |
| 77 | .templateconf \ |
| 78 | " |
| 79 | |
| 80 | SDK_DIR_task-populate-sdk-ext = "${WORKDIR}/sdk-ext" |
| 81 | B_task-populate-sdk-ext = "${SDK_DIR}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 82 | TOOLCHAINEXT_OUTPUTNAME ?= "${SDK_NAME}-toolchain-ext-${SDK_VERSION}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 83 | TOOLCHAIN_OUTPUTNAME_task-populate-sdk-ext = "${TOOLCHAINEXT_OUTPUTNAME}" |
| 84 | |
| 85 | SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest" |
| 86 | SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 87 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 88 | python write_target_sdk_ext_manifest () { |
| 89 | from oe.sdk import get_extra_sdkinfo |
| 90 | sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache') |
| 91 | extra_info = get_extra_sdkinfo(sstate_dir) |
| 92 | |
| 93 | target = d.getVar('TARGET_SYS') |
| 94 | target_multimach = d.getVar('MULTIMACH_TARGET_SYS') |
| 95 | real_target_multimach = d.getVar('REAL_MULTIMACH_TARGET_SYS') |
| 96 | |
| 97 | pkgs = {} |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 98 | os.makedirs(os.path.dirname(d.getVar('SDK_EXT_TARGET_MANIFEST')), exist_ok=True) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 99 | with open(d.getVar('SDK_EXT_TARGET_MANIFEST'), 'w') as f: |
| 100 | for fn in extra_info['filesizes']: |
| 101 | info = fn.split(':') |
| 102 | if info[2] in (target, target_multimach, real_target_multimach) \ |
| 103 | or info[5] == 'allarch': |
| 104 | if not info[1] in pkgs: |
| 105 | f.write("%s %s %s\n" % (info[1], info[2], info[3])) |
| 106 | pkgs[info[1]] = {} |
| 107 | } |
| 108 | python write_host_sdk_ext_manifest () { |
| 109 | from oe.sdk import get_extra_sdkinfo |
| 110 | sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache') |
| 111 | extra_info = get_extra_sdkinfo(sstate_dir) |
| 112 | host = d.getVar('BUILD_SYS') |
| 113 | with open(d.getVar('SDK_EXT_HOST_MANIFEST'), 'w') as f: |
| 114 | for fn in extra_info['filesizes']: |
| 115 | info = fn.split(':') |
| 116 | if info[2] == host: |
| 117 | f.write("%s %s %s\n" % (info[1], info[2], info[3])) |
| 118 | } |
| 119 | |
| 120 | SDK_POSTPROCESS_COMMAND_append_task-populate-sdk-ext = "write_target_sdk_ext_manifest; write_host_sdk_ext_manifest; " |
| 121 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 122 | SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} Extensible SDK" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 123 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 124 | def clean_esdk_builddir(d, sdkbasepath): |
| 125 | """Clean up traces of the fake build for create_filtered_tasklist()""" |
| 126 | import shutil |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 127 | cleanpaths = 'cache conf/sanity_info tmp'.split() |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 128 | for pth in cleanpaths: |
| 129 | fullpth = os.path.join(sdkbasepath, pth) |
| 130 | if os.path.isdir(fullpth): |
| 131 | shutil.rmtree(fullpth) |
| 132 | elif os.path.isfile(fullpth): |
| 133 | os.remove(fullpth) |
| 134 | |
| 135 | def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath): |
| 136 | """ |
| 137 | Create a filtered list of tasks. Also double-checks that the build system |
| 138 | within the SDK basically works and required sstate artifacts are available. |
| 139 | """ |
| 140 | import tempfile |
| 141 | import shutil |
| 142 | import oe.copy_buildsystem |
| 143 | |
| 144 | # Create a temporary build directory that we can pass to the env setup script |
| 145 | shutil.copyfile(sdkbasepath + '/conf/local.conf', sdkbasepath + '/conf/local.conf.bak') |
| 146 | try: |
| 147 | with open(sdkbasepath + '/conf/local.conf', 'a') as f: |
| 148 | # Force the use of sstate from the build system |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 149 | f.write('\nSSTATE_DIR_forcevariable = "%s"\n' % d.getVar('SSTATE_DIR')) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 150 | f.write('SSTATE_MIRRORS_forcevariable = "file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 151 | # Ensure TMPDIR is the default so that clean_esdk_builddir() can delete it |
| 152 | f.write('TMPDIR_forcevariable = "${TOPDIR}/tmp"\n') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 153 | f.write('TCLIBCAPPEND_forcevariable = ""\n') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 154 | # Drop uninative if the build isn't using it (or else NATIVELSBSTRING will |
| 155 | # be different and we won't be able to find our native sstate) |
| 156 | if not bb.data.inherits_class('uninative', d): |
| 157 | f.write('INHERIT_remove = "uninative"\n') |
| 158 | |
| 159 | # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake |
| 160 | # will not allow in its COREBASE path, so we need to rename the directory temporarily |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 161 | temp_sdkbasepath = d.getVar('SDK_OUTPUT') + '/tmp-renamed-sdk' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 162 | # Delete any existing temp dir |
| 163 | try: |
| 164 | shutil.rmtree(temp_sdkbasepath) |
| 165 | except FileNotFoundError: |
| 166 | pass |
| 167 | os.rename(sdkbasepath, temp_sdkbasepath) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 168 | cmdprefix = '. %s .; ' % conf_initpath |
| 169 | logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 170 | try: |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 171 | oe.copy_buildsystem.check_sstate_task_list(d, get_sdk_install_targets(d), tasklistfile, cmdprefix=cmdprefix, cwd=temp_sdkbasepath, logfile=logfile) |
| 172 | except bb.process.ExecutionError as e: |
| 173 | msg = 'Failed to generate filtered task list for extensible SDK:\n%s' % e.stdout.rstrip() |
| 174 | if 'attempted to execute unexpectedly and should have been setscened' in e.stdout: |
| 175 | msg += '\n----------\n\nNOTE: "attempted to execute unexpectedly and should have been setscened" errors indicate this may be caused by missing sstate artifacts that were likely produced in earlier builds, but have been subsequently deleted for some reason.\n' |
| 176 | bb.fatal(msg) |
| 177 | os.rename(temp_sdkbasepath, sdkbasepath) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 178 | # Clean out residue of running bitbake, which check_sstate_task_list() |
| 179 | # will effectively do |
| 180 | clean_esdk_builddir(d, sdkbasepath) |
| 181 | finally: |
| 182 | os.replace(sdkbasepath + '/conf/local.conf.bak', sdkbasepath + '/conf/local.conf') |
| 183 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 184 | python copy_buildsystem () { |
| 185 | import re |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 186 | import shutil |
| 187 | import glob |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 188 | import oe.copy_buildsystem |
| 189 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 190 | oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | |
| 192 | conf_bbpath = '' |
| 193 | conf_initpath = '' |
| 194 | core_meta_subdir = '' |
| 195 | |
| 196 | # Copy in all metadata layers + bitbake (as repositories) |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 197 | buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 198 | baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 199 | |
| 200 | # Determine if we're building a derivative extensible SDK (from devtool build-sdk) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 201 | derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 202 | if derivative: |
| 203 | workspace_name = 'orig-workspace' |
| 204 | else: |
| 205 | workspace_name = None |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 206 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 207 | corebase, sdkbblayers = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers', workspace_name) |
| 208 | conf_bbpath = os.path.join('layers', corebase, 'bitbake') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 209 | |
| 210 | for path in os.listdir(baseoutpath + '/layers'): |
| 211 | relpath = os.path.join('layers', path, oe_init_env_script) |
| 212 | if os.path.exists(os.path.join(baseoutpath, relpath)): |
| 213 | conf_initpath = relpath |
| 214 | |
| 215 | relpath = os.path.join('layers', path, 'scripts', 'devtool') |
| 216 | if os.path.exists(os.path.join(baseoutpath, relpath)): |
| 217 | scriptrelpath = os.path.dirname(relpath) |
| 218 | |
| 219 | relpath = os.path.join('layers', path, 'meta') |
| 220 | if os.path.exists(os.path.join(baseoutpath, relpath, 'lib', 'oe')): |
| 221 | core_meta_subdir = relpath |
| 222 | |
| 223 | d.setVar('oe_init_build_env_path', conf_initpath) |
| 224 | d.setVar('scriptrelpath', scriptrelpath) |
| 225 | |
| 226 | # Write out config file for devtool |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 227 | import configparser |
| 228 | config = configparser.SafeConfigParser() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 229 | config.add_section('General') |
| 230 | config.set('General', 'bitbake_subdir', conf_bbpath) |
| 231 | config.set('General', 'init_path', conf_initpath) |
| 232 | config.set('General', 'core_meta_subdir', core_meta_subdir) |
| 233 | config.add_section('SDK') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 234 | config.set('SDK', 'sdk_targets', d.getVar('SDK_TARGETS')) |
| 235 | updateurl = d.getVar('SDK_UPDATE_URL') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 236 | if updateurl: |
| 237 | config.set('SDK', 'updateserver', updateurl) |
| 238 | bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf')) |
| 239 | with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f: |
| 240 | config.write(f) |
| 241 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 242 | unlockedsigs = os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc') |
| 243 | with open(unlockedsigs, 'w') as f: |
| 244 | pass |
| 245 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 246 | # Create a layer for new recipes / appends |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 247 | bbpath = d.getVar('BBPATH') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 248 | bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--create-only', os.path.join(baseoutpath, 'workspace')]) |
| 249 | |
| 250 | # Create bblayers.conf |
| 251 | bb.utils.mkdirhier(baseoutpath + '/conf') |
| 252 | with open(baseoutpath + '/conf/bblayers.conf', 'w') as f: |
| 253 | f.write('# WARNING: this configuration has been automatically generated and in\n') |
| 254 | f.write('# most cases should not be edited. If you need more flexibility than\n') |
| 255 | f.write('# this configuration provides, it is strongly suggested that you set\n') |
| 256 | f.write('# up a proper instance of the full build system and use that instead.\n\n') |
| 257 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 258 | # LCONF_VERSION may not be set, for example when using meta-poky |
| 259 | # so don't error if it isn't found |
| 260 | lconf_version = d.getVar('LCONF_VERSION', False) |
| 261 | if lconf_version is not None: |
| 262 | f.write('LCONF_VERSION = "%s"\n\n' % lconf_version) |
| 263 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 264 | f.write('BBPATH = "$' + '{TOPDIR}"\n') |
| 265 | f.write('SDKBASEMETAPATH = "$' + '{TOPDIR}"\n') |
| 266 | f.write('BBLAYERS := " \\\n') |
| 267 | for layerrelpath in sdkbblayers: |
| 268 | f.write(' $' + '{SDKBASEMETAPATH}/layers/%s \\\n' % layerrelpath) |
| 269 | f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n') |
| 270 | f.write(' "\n') |
| 271 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 272 | # Copy uninative tarball |
| 273 | # For now this is where uninative.bbclass expects the tarball |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 274 | if bb.data.inherits_class('uninative', d): |
| 275 | uninative_file = d.expand('${UNINATIVE_DLDIR}/' + d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH")) + '/${UNINATIVE_TARBALL}') |
| 276 | uninative_checksum = bb.utils.sha256_file(uninative_file) |
| 277 | uninative_outdir = '%s/downloads/uninative/%s' % (baseoutpath, uninative_checksum) |
| 278 | bb.utils.mkdirhier(uninative_outdir) |
| 279 | shutil.copy(uninative_file, uninative_outdir) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 280 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 281 | env_whitelist = (d.getVar('BB_ENV_EXTRAWHITE') or '').split() |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 282 | env_whitelist_values = {} |
| 283 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 284 | # Create local.conf |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 285 | builddir = d.getVar('TOPDIR') |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame] | 286 | if derivative and os.path.exists(builddir + '/conf/site.conf'): |
| 287 | shutil.copyfile(builddir + '/conf/site.conf', baseoutpath + '/conf/site.conf') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 288 | if derivative and os.path.exists(builddir + '/conf/auto.conf'): |
| 289 | shutil.copyfile(builddir + '/conf/auto.conf', baseoutpath + '/conf/auto.conf') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 290 | if derivative: |
| 291 | shutil.copyfile(builddir + '/conf/local.conf', baseoutpath + '/conf/local.conf') |
| 292 | else: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 293 | local_conf_whitelist = (d.getVar('SDK_LOCAL_CONF_WHITELIST') or '').split() |
| 294 | local_conf_blacklist = (d.getVar('SDK_LOCAL_CONF_BLACKLIST') or '').split() |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 295 | def handle_var(varname, origvalue, op, newlines): |
| 296 | if varname in local_conf_blacklist or (origvalue.strip().startswith('/') and not varname in local_conf_whitelist): |
| 297 | newlines.append('# Removed original setting of %s\n' % varname) |
| 298 | return None, op, 0, True |
| 299 | else: |
| 300 | if varname in env_whitelist: |
| 301 | env_whitelist_values[varname] = origvalue |
| 302 | return origvalue, op, 0, True |
| 303 | varlist = ['[^#=+ ]*'] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 304 | oldlines = [] |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame] | 305 | if os.path.exists(builddir + '/conf/site.conf'): |
| 306 | with open(builddir + '/conf/site.conf', 'r') as f: |
| 307 | oldlines += f.readlines() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 308 | if os.path.exists(builddir + '/conf/auto.conf'): |
| 309 | with open(builddir + '/conf/auto.conf', 'r') as f: |
| 310 | oldlines += f.readlines() |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 311 | with open(builddir + '/conf/local.conf', 'r') as f: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 312 | oldlines += f.readlines() |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 313 | (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 314 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 315 | with open(baseoutpath + '/conf/local.conf', 'w') as f: |
| 316 | f.write('# WARNING: this configuration has been automatically generated and in\n') |
| 317 | f.write('# most cases should not be edited. If you need more flexibility than\n') |
| 318 | f.write('# this configuration provides, it is strongly suggested that you set\n') |
| 319 | f.write('# up a proper instance of the full build system and use that instead.\n\n') |
| 320 | for line in newlines: |
| 321 | if line.strip() and not line.startswith('#'): |
| 322 | f.write(line) |
| 323 | # Write a newline just in case there's none at the end of the original |
| 324 | f.write('\n') |
| 325 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 326 | f.write('TMPDIR = "${TOPDIR}/tmp"\n') |
| 327 | f.write('TCLIBCAPPEND = ""\n') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 328 | f.write('DL_DIR = "${TOPDIR}/downloads"\n') |
| 329 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 330 | if bb.data.inherits_class('uninative', d): |
| 331 | f.write('INHERIT += "%s"\n' % 'uninative') |
| 332 | f.write('UNINATIVE_CHECKSUM[%s] = "%s"\n\n' % (d.getVar('BUILD_ARCH'), uninative_checksum)) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 333 | f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False)) |
| 334 | |
| 335 | # Some classes are not suitable for SDK, remove them from INHERIT |
| 336 | f.write('INHERIT_remove = "%s"\n' % d.getVar('SDK_INHERIT_BLACKLIST', False)) |
| 337 | |
| 338 | # Bypass the default connectivity check if any |
| 339 | f.write('CONNECTIVITY_CHECK_URIS = ""\n\n') |
| 340 | |
| 341 | # This warning will come out if reverse dependencies for a task |
| 342 | # don't have sstate as well as the task itself. We already know |
| 343 | # this will be the case for the extensible sdk, so turn off the |
| 344 | # warning. |
| 345 | f.write('SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK = "none"\n\n') |
| 346 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 347 | # Warn if the sigs in the locked-signature file don't match |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 348 | # the sig computed from the metadata. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 349 | f.write('SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n\n') |
| 350 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 351 | # We want to be able to set this without a full reparse |
| 352 | f.write('BB_HASHCONFIG_WHITELIST_append = " SIGGEN_UNLOCKED_RECIPES"\n\n') |
| 353 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 354 | # Set up whitelist for run on install |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 355 | f.write('BB_SETSCENE_ENFORCE_WHITELIST = "%:* *:do_shared_workdir *:do_rm_work wic-tools:* *:do_addto_recipe_sysroot"\n\n') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 356 | |
| 357 | # Hide the config information from bitbake output (since it's fixed within the SDK) |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 358 | f.write('BUILDCFG_HEADER = ""\n\n') |
| 359 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 360 | f.write('# Provide a flag to indicate we are in the EXT_SDK Context\n') |
| 361 | f.write('WITHIN_EXT_SDK = "1"\n\n') |
| 362 | |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 363 | # Map gcc-dependent uninative sstate cache for installer usage |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 364 | f.write('SSTATE_MIRRORS += " file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n\n') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 365 | |
| 366 | # Allow additional config through sdk-extra.conf |
| 367 | fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d) |
| 368 | if fn: |
| 369 | with open(fn, 'r') as xf: |
| 370 | for line in xf: |
| 371 | f.write(line) |
| 372 | |
| 373 | # If you define a sdk_extraconf() function then it can contain additional config |
| 374 | # (Though this is awkward; sdk-extra.conf should probably be used instead) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 375 | extraconf = (d.getVar('sdk_extraconf') or '').strip() |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 376 | if extraconf: |
| 377 | # Strip off any leading / trailing spaces |
| 378 | for line in extraconf.splitlines(): |
| 379 | f.write(line.strip() + '\n') |
| 380 | |
| 381 | f.write('require conf/locked-sigs.inc\n') |
| 382 | f.write('require conf/unlocked-sigs.inc\n') |
| 383 | |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 384 | if os.path.exists(builddir + '/cache/bb_unihashes.dat'): |
| 385 | bb.parse.siggen.save_unitaskhashes() |
| 386 | bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache')) |
| 387 | shutil.copyfile(builddir + '/cache/bb_unihashes.dat', baseoutpath + '/cache/bb_unihashes.dat') |
| 388 | |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 389 | # Write a templateconf.cfg |
| 390 | with open(baseoutpath + '/conf/templateconf.cfg', 'w') as f: |
| 391 | f.write('meta/conf\n') |
| 392 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 393 | # Ensure any variables set from the external environment (by way of |
| 394 | # BB_ENV_EXTRAWHITE) are set in the SDK's configuration |
| 395 | extralines = [] |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 396 | for name, value in env_whitelist_values.items(): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 397 | actualvalue = d.getVar(name) or '' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 398 | if value != actualvalue: |
| 399 | extralines.append('%s = "%s"\n' % (name, actualvalue)) |
| 400 | if extralines: |
| 401 | with open(baseoutpath + '/conf/local.conf', 'a') as f: |
| 402 | f.write('\n') |
| 403 | f.write('# Extra settings from environment:\n') |
| 404 | for line in extralines: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 405 | f.write(line) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 406 | f.write('\n') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 407 | |
| 408 | # Filter the locked signatures file to just the sstate tasks we are interested in |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 409 | excluded_targets = get_sdk_install_targets(d, images_only=True) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 410 | sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 411 | lockedsigs_pruned = baseoutpath + '/conf/locked-sigs.inc' |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 412 | #nativesdk-only sigfile to merge into locked-sigs.inc |
| 413 | sdk_include_nativesdk = (d.getVar("SDK_INCLUDE_NATIVESDK") == '1') |
| 414 | nativesigfile = d.getVar('WORKDIR') + '/locked-sigs_nativesdk.inc' |
| 415 | nativesigfile_pruned = d.getVar('WORKDIR') + '/locked-sigs_nativesdk_pruned.inc' |
| 416 | |
| 417 | if sdk_include_nativesdk: |
| 418 | oe.copy_buildsystem.prune_lockedsigs([], |
| 419 | excluded_targets.split(), |
| 420 | nativesigfile, |
| 421 | True, |
| 422 | nativesigfile_pruned) |
| 423 | |
| 424 | oe.copy_buildsystem.merge_lockedsigs([], |
| 425 | sigfile, |
| 426 | nativesigfile_pruned, |
| 427 | sigfile) |
| 428 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 429 | oe.copy_buildsystem.prune_lockedsigs([], |
| 430 | excluded_targets.split(), |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 431 | sigfile, |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 432 | False, |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 433 | lockedsigs_pruned) |
| 434 | |
| 435 | sstate_out = baseoutpath + '/sstate-cache' |
| 436 | bb.utils.remove(sstate_out, True) |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 437 | |
| 438 | # uninative.bbclass sets NATIVELSBSTRING to 'universal%s' % oe.utils.host_gcc_version(d) |
| 439 | fixedlsbstring = "universal%s" % oe.utils.host_gcc_version(d) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 440 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 441 | sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1') |
| 442 | sdk_ext_type = d.getVar('SDK_EXT_TYPE') |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 443 | if (sdk_ext_type != 'minimal' or sdk_include_toolchain or derivative) and not sdk_include_nativesdk: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 444 | # Create the filtered task list used to generate the sstate cache shipped with the SDK |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 445 | tasklistfn = d.getVar('WORKDIR') + '/tasklist.txt' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 446 | create_filtered_tasklist(d, baseoutpath, tasklistfn, conf_initpath) |
| 447 | else: |
| 448 | tasklistfn = None |
| 449 | |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 450 | if os.path.exists(builddir + '/cache/bb_unihashes.dat'): |
| 451 | bb.parse.siggen.save_unitaskhashes() |
| 452 | bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache')) |
| 453 | shutil.copyfile(builddir + '/cache/bb_unihashes.dat', baseoutpath + '/cache/bb_unihashes.dat') |
| 454 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 455 | # Add packagedata if enabled |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 456 | if d.getVar('SDK_INCLUDE_PKGDATA') == '1': |
| 457 | lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base.inc' |
| 458 | lockedsigs_copy = d.getVar('WORKDIR') + '/locked-sigs-copy.inc' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 459 | shutil.move(lockedsigs_pruned, lockedsigs_base) |
| 460 | oe.copy_buildsystem.merge_lockedsigs(['do_packagedata'], |
| 461 | lockedsigs_base, |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 462 | d.getVar('STAGING_DIR_HOST') + '/world-pkgdata/locked-sigs-pkgdata.inc', |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 463 | lockedsigs_pruned, |
| 464 | lockedsigs_copy) |
| 465 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 466 | if sdk_include_toolchain: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 467 | lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base2.inc' |
| 468 | lockedsigs_toolchain = d.expand("${STAGING_DIR}/${TUNE_PKGARCH}/meta-extsdk-toolchain/locked-sigs/locked-sigs-extsdk-toolchain.inc") |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 469 | shutil.move(lockedsigs_pruned, lockedsigs_base) |
| 470 | oe.copy_buildsystem.merge_lockedsigs([], |
| 471 | lockedsigs_base, |
| 472 | lockedsigs_toolchain, |
| 473 | lockedsigs_pruned) |
| 474 | oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_toolchain, |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 475 | d.getVar('SSTATE_DIR'), |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 476 | sstate_out, d, |
| 477 | fixedlsbstring, |
| 478 | filterfile=tasklistfn) |
| 479 | |
| 480 | if sdk_ext_type == 'minimal': |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 481 | if derivative: |
| 482 | # Assume the user is not going to set up an additional sstate |
| 483 | # mirror, thus we need to copy the additional artifacts (from |
| 484 | # workspace recipes) into the derivative SDK |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 485 | lockedsigs_orig = d.getVar('TOPDIR') + '/conf/locked-sigs.inc' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 486 | if os.path.exists(lockedsigs_orig): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 487 | lockedsigs_extra = d.getVar('WORKDIR') + '/locked-sigs-extra.inc' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 488 | oe.copy_buildsystem.merge_lockedsigs(None, |
| 489 | lockedsigs_orig, |
| 490 | lockedsigs_pruned, |
| 491 | None, |
| 492 | lockedsigs_extra) |
| 493 | oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra, |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 494 | d.getVar('SSTATE_DIR'), |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 495 | sstate_out, d, |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 496 | fixedlsbstring, |
| 497 | filterfile=tasklistfn) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 498 | else: |
| 499 | oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned, |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 500 | d.getVar('SSTATE_DIR'), |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 501 | sstate_out, d, |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 502 | fixedlsbstring, |
| 503 | filterfile=tasklistfn) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 504 | |
| 505 | # We don't need sstate do_package files |
| 506 | for root, dirs, files in os.walk(sstate_out): |
| 507 | for name in files: |
| 508 | if name.endswith("_package.tgz"): |
| 509 | f = os.path.join(root, name) |
| 510 | os.remove(f) |
| 511 | |
| 512 | # Write manifest file |
| 513 | # Note: at the moment we cannot include the env setup script here to keep |
| 514 | # it updated, since it gets modified during SDK installation (see |
| 515 | # sdk_ext_postinst() below) thus the checksum we take here would always |
| 516 | # be different. |
| 517 | manifest_file_list = ['conf/*'] |
| 518 | manifest_file = os.path.join(baseoutpath, 'conf', 'sdk-conf-manifest') |
| 519 | with open(manifest_file, 'w') as f: |
| 520 | for item in manifest_file_list: |
| 521 | for fn in glob.glob(os.path.join(baseoutpath, item)): |
| 522 | if fn == manifest_file: |
| 523 | continue |
| 524 | chksum = bb.utils.sha256_file(fn) |
| 525 | f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath))) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 526 | } |
| 527 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 528 | def get_current_buildtools(d): |
| 529 | """Get the file name of the current buildtools installer""" |
| 530 | import glob |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 531 | btfiles = glob.glob(os.path.join(d.getVar('SDK_DEPLOY'), '*-buildtools-nativesdk-standalone-*.sh')) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 532 | btfiles.sort(key=os.path.getctime) |
| 533 | return os.path.basename(btfiles[-1]) |
| 534 | |
| 535 | def get_sdk_required_utilities(buildtools_fn, d): |
| 536 | """Find required utilities that aren't provided by the buildtools""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 537 | sanity_required_utilities = (d.getVar('SANITY_REQUIRED_UTILITIES') or '').split() |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 538 | sanity_required_utilities.append(d.expand('${BUILD_PREFIX}gcc')) |
| 539 | sanity_required_utilities.append(d.expand('${BUILD_PREFIX}g++')) |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 540 | if buildtools_fn: |
| 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 = "" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 546 | localdata = bb.data.createCopy(d) |
| 547 | localdata.setVar('SDKPATH', '.') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 548 | sdkpathnative = localdata.getVar('SDKPATHNATIVE') |
| 549 | sdkbindirs = [localdata.getVar('bindir_nativesdk'), |
| 550 | localdata.getVar('sbindir_nativesdk'), |
| 551 | localdata.getVar('base_bindir_nativesdk'), |
| 552 | localdata.getVar('base_sbindir_nativesdk')] |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 553 | for line in filelist.splitlines(): |
| 554 | splitline = line.split() |
| 555 | if len(splitline) > 5: |
| 556 | fn = splitline[5] |
| 557 | if not fn.startswith('./'): |
| 558 | fn = './%s' % fn |
| 559 | if fn.startswith(sdkpathnative): |
| 560 | relpth = '/' + os.path.relpath(fn, sdkpathnative) |
| 561 | for bindir in sdkbindirs: |
| 562 | if relpth.startswith(bindir): |
| 563 | relpth = os.path.relpath(relpth, bindir) |
| 564 | if relpth in sanity_required_utilities: |
| 565 | sanity_required_utilities.remove(relpth) |
| 566 | break |
| 567 | return ' '.join(sanity_required_utilities) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 568 | |
| 569 | install_tools() { |
| 570 | install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk} |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 571 | scripts="devtool recipetool oe-find-native-sysroot runqemu* wic" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 572 | for script in $scripts; do |
| 573 | for scriptfn in `find ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath} -maxdepth 1 -executable -name "$script"`; do |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 574 | targetscriptfn="${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/$(basename $scriptfn)" |
| 575 | test -e ${targetscriptfn} || lnr ${scriptfn} ${targetscriptfn} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 576 | done |
| 577 | done |
| 578 | # We can't use the same method as above because files in the sysroot won't exist at this point |
| 579 | # (they get populated from sstate on installation) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 580 | unfsd_path="${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/unfsd" |
| 581 | if [ "${SDK_INCLUDE_TOOLCHAIN}" = "1" -a ! -e $unfsd_path ] ; then |
| 582 | binrelpath=${@os.path.relpath(d.getVar('STAGING_BINDIR_NATIVE'), d.getVar('TMPDIR'))} |
| 583 | lnr ${SDK_OUTPUT}/${SDKPATH}/tmp/$binrelpath/unfsd $unfsd_path |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 584 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 585 | touch ${SDK_OUTPUT}/${SDKPATH}/.devtoolbase |
| 586 | |
| 587 | # find latest buildtools-tarball and install it |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 588 | if [ -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then |
| 589 | install ${SDK_DEPLOY}/${SDK_BUILDTOOLS_INSTALLER} ${SDK_OUTPUT}/${SDKPATH} |
| 590 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 591 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 592 | install -m 0644 ${COREBASE}/meta/files/ext-sdk-prepare.py ${SDK_OUTPUT}/${SDKPATH} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 593 | } |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 594 | do_populate_sdk_ext[file-checksums] += "${COREBASE}/meta/files/ext-sdk-prepare.py:True" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 595 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 596 | sdk_ext_preinst() { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 597 | # Since bitbake won't run as root it doesn't make sense to try and install |
| 598 | # the extensible sdk as root. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 599 | if [ "`id -u`" = "0" ]; then |
| 600 | echo "ERROR: The extensible sdk cannot be installed as root." |
| 601 | exit 1 |
| 602 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 603 | if ! command -v locale > /dev/null; then |
| 604 | echo "ERROR: The installer requires the locale command, please install it first" |
| 605 | exit 1 |
| 606 | fi |
| 607 | # Check setting of LC_ALL set above |
| 608 | canonicalised_locale=`echo $LC_ALL | sed 's/UTF-8/utf8/'` |
| 609 | if ! locale -a | grep -q $canonicalised_locale ; then |
| 610 | echo "ERROR: the installer requires the $LC_ALL locale to be installed (but not selected), please install it first" |
| 611 | exit 1 |
| 612 | fi |
| 613 | # The relocation script used by buildtools installer requires python |
| 614 | if ! command -v python > /dev/null; then |
| 615 | echo "ERROR: The installer requires python, please install it first" |
| 616 | exit 1 |
| 617 | fi |
| 618 | missing_utils="" |
| 619 | for util in ${SDK_REQUIRED_UTILITIES}; do |
| 620 | if ! command -v $util > /dev/null; then |
| 621 | missing_utils="$missing_utils $util" |
| 622 | fi |
| 623 | done |
| 624 | if [ -n "$missing_utils" ] ; then |
| 625 | echo "ERROR: the SDK requires the following missing utilities, please install them: $missing_utils" |
| 626 | exit 1 |
| 627 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 628 | SDK_EXTENSIBLE="1" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 629 | if [ "$publish" = "1" ] && [ "${SDK_EXT_TYPE}" = "minimal" ] ; then |
| 630 | EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=sstate-cache" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 631 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 632 | } |
| 633 | SDK_PRE_INSTALL_COMMAND_task-populate-sdk-ext = "${sdk_ext_preinst}" |
| 634 | |
| 635 | # FIXME this preparation should be done as part of the SDK construction |
| 636 | sdk_ext_postinst() { |
| 637 | printf "\nExtracting buildtools...\n" |
| 638 | cd $target_sdk_dir |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 639 | env_setup_script="$target_sdk_dir/environment-setup-${REAL_MULTIMACH_TARGET_SYS}" |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 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 ; } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 642 | |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 643 | # Delete the buildtools tar file since it won't be used again |
| 644 | rm -f ./${SDK_BUILDTOOLS_INSTALLER} |
| 645 | # We don't need the log either since it succeeded |
| 646 | rm -f buildtools.log |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 647 | |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 648 | # Make sure when the user sets up the environment, they also get |
| 649 | # the buildtools-tarball tools in their path. |
| 650 | echo ". $target_sdk_dir/buildtools/environment-setup*" >> $env_setup_script |
| 651 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 652 | |
| 653 | # Allow bitbake environment setup to be ran as part of this sdk. |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 654 | echo "export OE_SKIP_SDK_CHECK=1" >> $env_setup_script |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 655 | # Work around runqemu not knowing how to get this information within the eSDK |
| 656 | echo "export DEPLOY_DIR_IMAGE=$target_sdk_dir/tmp/${@os.path.relpath(d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('TMPDIR'))}" >> $env_setup_script |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 657 | |
| 658 | # A bit of another hack, but we need this in the path only for devtool |
| 659 | # so put it at the end of $PATH. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 660 | echo "export PATH=$target_sdk_dir/sysroots/${SDK_SYS}${bindir_nativesdk}:\$PATH" >> $env_setup_script |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 661 | |
| 662 | echo "printf 'SDK environment now set up; additionally you may now run devtool to perform development tasks.\nRun devtool --help for further details.\n'" >> $env_setup_script |
| 663 | |
| 664 | # Warn if trying to use external bitbake and the ext SDK together |
| 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 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 666 | |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 667 | if [ "$prepare_buildsystem" != "no" -a -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 668 | printf "Preparing build system...\n" |
| 669 | # dash which is /bin/sh on Ubuntu will not preserve the |
| 670 | # current working directory when first ran, nor will it set $1 when |
| 671 | # sourcing a script. That is why this has to look so ugly. |
| 672 | LOGFILE="$target_sdk_dir/preparing_build_system.log" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 673 | sh -c ". buildtools/environment-setup* > $LOGFILE && cd $target_sdk_dir/`dirname ${oe_init_build_env_path}` && set $target_sdk_dir && . $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE && python $target_sdk_dir/ext-sdk-prepare.py $LOGFILE '${SDK_INSTALL_TARGETS}'" || { echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; } |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 674 | fi |
| 675 | if [ -e $target_sdk_dir/ext-sdk-prepare.py ]; then |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 676 | rm $target_sdk_dir/ext-sdk-prepare.py |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 677 | fi |
| 678 | echo done |
| 679 | } |
| 680 | |
| 681 | SDK_POST_INSTALL_COMMAND_task-populate-sdk-ext = "${sdk_ext_postinst}" |
| 682 | |
| 683 | SDK_POSTPROCESS_COMMAND_prepend_task-populate-sdk-ext = "copy_buildsystem; install_tools; " |
| 684 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 685 | SDK_INSTALL_TARGETS = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 686 | fakeroot python do_populate_sdk_ext() { |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 687 | # FIXME hopefully we can remove this restriction at some point, but uninative |
| 688 | # currently forces this upon us |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 689 | if 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'))) |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 691 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 692 | d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d)) |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 693 | if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1': |
| 694 | buildtools_fn = get_current_buildtools(d) |
| 695 | else: |
| 696 | buildtools_fn = None |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 697 | d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d)) |
| 698 | d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn) |
| 699 | d.setVar('SDKDEPLOYDIR', '${SDKEXTDEPLOYDIR}') |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 700 | # ESDKs have a libc from the buildtools so ensure we don't ship linguas twice |
| 701 | d.delVar('SDKIMAGE_LINGUAS') |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 702 | if d.getVar("SDK_INCLUDE_NATIVESDK") == '1': |
| 703 | generate_nativesdk_lockedsigs(d) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 704 | populate_sdk_common(d) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 705 | } |
| 706 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 707 | def generate_nativesdk_lockedsigs(d): |
| 708 | import oe.copy_buildsystem |
| 709 | sigfile = d.getVar('WORKDIR') + '/locked-sigs_nativesdk.inc' |
| 710 | oe.copy_buildsystem.generate_locked_sigs(sigfile, d) |
| 711 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 712 | def get_ext_sdk_depends(d): |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 713 | # Note: the deps varflag is a list not a string, so we need to specify expand=False |
| 714 | deps = d.getVarFlag('do_image_complete', 'deps', False) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 715 | pn = d.getVar('PN') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 716 | deplist = ['%s:%s' % (pn, dep) for dep in deps] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 717 | tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d) |
| 718 | tasklist.append('do_rootfs') |
| 719 | for task in tasklist: |
| 720 | deplist.extend((d.getVarFlag(task, 'depends') or '').split()) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 721 | return ' '.join(deplist) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 722 | |
| 723 | python do_sdk_depends() { |
| 724 | # We have to do this separately in its own task so we avoid recursing into |
| 725 | # dependencies we don't need to (e.g. buildtools-tarball) and bringing those |
| 726 | # into the SDK's sstate-cache |
| 727 | import oe.copy_buildsystem |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 728 | sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 729 | oe.copy_buildsystem.generate_locked_sigs(sigfile, d) |
| 730 | } |
| 731 | addtask sdk_depends |
| 732 | |
| 733 | do_sdk_depends[dirs] = "${WORKDIR}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 734 | do_sdk_depends[depends] = "${@get_ext_sdk_depends(d)} meta-extsdk-toolchain:do_populate_sysroot" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 735 | do_sdk_depends[recrdeptask] = "${@d.getVarFlag('do_populate_sdk', 'recrdeptask', False)}" |
| 736 | do_sdk_depends[recrdeptask] += "do_populate_lic do_package_qa do_populate_sysroot do_deploy ${SDK_RECRDEP_TASKS}" |
| 737 | do_sdk_depends[rdepends] = "${@get_sdk_ext_rdepends(d)}" |
| 738 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 739 | def get_sdk_ext_rdepends(d): |
| 740 | localdata = d.createCopy() |
| 741 | localdata.appendVar('OVERRIDES', ':task-populate-sdk-ext') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 742 | return localdata.getVarFlag('do_populate_sdk', 'rdepends') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 743 | |
| 744 | do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 745 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 746 | do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \ |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 747 | ${@'buildtools-tarball:do_populate_sdk' if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1' else ''} \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 748 | ${@'meta-world-pkgdata:do_collect_packagedata' if d.getVar('SDK_INCLUDE_PKGDATA') == '1' else ''} \ |
| 749 | ${@'meta-extsdk-toolchain:do_locked_sigs' if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1' else ''}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 750 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 751 | # We must avoid depending on do_build here if rm_work.bbclass is active, |
| 752 | # because otherwise do_rm_work may run before do_populate_sdk_ext itself. |
| 753 | # We can't mark do_populate_sdk_ext and do_sdk_depends as having to |
| 754 | # run before do_rm_work, because then they would also run as part |
| 755 | # of normal builds. |
| 756 | do_populate_sdk_ext[rdepends] += "${@' '.join([x + ':' + (d.getVar('RM_WORK_BUILD_WITHOUT') or 'do_build') for x in d.getVar('SDK_TARGETS').split()])}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 757 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 758 | # Make sure code changes can result in rebuild |
| 759 | do_populate_sdk_ext[vardeps] += "copy_buildsystem \ |
| 760 | sdk_ext_postinst" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 761 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 762 | # Since any change in the metadata of any layer should cause a rebuild of the |
| 763 | # sdk(since the layers are put in the sdk) set the task to nostamp so it |
| 764 | # always runs. |
| 765 | do_populate_sdk_ext[nostamp] = "1" |
| 766 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 767 | SDKEXTDEPLOYDIR = "${WORKDIR}/deploy-${PN}-populate-sdk-ext" |
| 768 | |
| 769 | SSTATETASKS += "do_populate_sdk_ext" |
| 770 | SSTATE_SKIP_CREATION_task-populate-sdk-ext = '1' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 771 | do_populate_sdk_ext[cleandirs] = "${SDKEXTDEPLOYDIR}" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 772 | do_populate_sdk_ext[sstate-inputdirs] = "${SDKEXTDEPLOYDIR}" |
| 773 | do_populate_sdk_ext[sstate-outputdirs] = "${SDK_DEPLOY}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 774 | do_populate_sdk_ext[stamp-extra-info] = "${MACHINE_ARCH}" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 775 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 776 | addtask populate_sdk_ext after do_sdk_depends |