xref: /openbmc/openbmc/poky/meta/classes-recipe/populate_sdk_base.bbclass (revision 8460358c3d24c71d9d38fd126c745854a6301564)
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7SDK_CLASSES += "${@bb.utils.contains("IMAGE_CLASSES", "testimage", "testsdk", "", d)}"
8inherit_defer ${SDK_CLASSES}
9
10PACKAGES = ""
11
12# This exists as an optimization for SPDX processing to only run in image and
13# SDK processing context.  This class happens to be common to these usages.
14SPDX_MULTILIB_SSTATE_ARCHS = "${@all_multilib_tune_values(d, 'SSTATE_ARCHS')}"
15
16inherit image-postinst-intercepts image-artifact-names nopackages
17
18# Wildcards specifying complementary packages to install for every package that has been explicitly
19# installed into the rootfs
20COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev'
21COMPLEMENTARY_GLOB[staticdev-pkgs] = '*-staticdev'
22COMPLEMENTARY_GLOB[doc-pkgs] = '*-doc'
23COMPLEMENTARY_GLOB[dbg-pkgs] = '*-dbg'
24COMPLEMENTARY_GLOB[src-pkgs] = '*-src'
25COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest ${MLPREFIX}ptest-runner'
26COMPLEMENTARY_GLOB[bash-completion-pkgs] = '*-bash-completion'
27
28def complementary_globs(featurevar, d):
29    all_globs = d.getVarFlags('COMPLEMENTARY_GLOB')
30    globs = []
31    features = set((d.getVar(featurevar) or '').split())
32    for name, glob in all_globs.items():
33        if name in features:
34            globs.append(glob)
35    return ' '.join(globs)
36
37SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs src-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}"
38SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
39SDKIMAGE_INSTALL_COMPLEMENTARY[vardeps] += "SDKIMAGE_FEATURES"
40
41PACKAGE_ARCHS:append:task-populate-sdk = " sdk-provides-dummy-target"
42SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}"
43
44# List of locales to install, or "all" for all of them, or unset for none.
45SDKIMAGE_LINGUAS ?= "all"
46
47inherit_defer rootfs_${IMAGE_PKGTYPE}
48
49SDK_DIR = "${WORKDIR}/sdk"
50SDK_OUTPUT = "${SDK_DIR}/image"
51SDK_DEPLOY = "${DEPLOY_DIR}/sdk"
52
53SDKDEPLOYDIR = "${WORKDIR}/${SDKMACHINE}-deploy-${PN}-populate-sdk"
54
55B:task-populate-sdk = "${SDK_DIR}"
56
57SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
58
59SDK_TOOLCHAIN_LANGS ??= ""
60SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust"
61# libstd-rs doesn't build for mips n32 with compiler constraint errors
62SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust"
63
64TOOLCHAIN_HOST_TASK ?= " \
65    nativesdk-packagegroup-sdk-host \
66    packagegroup-cross-canadian-${MACHINE} \
67    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-cross-canadian-${MACHINE}', '', d)} \
68    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-cross-canadian-${MACHINE}', '', d)} \
69"
70TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= ""
71TOOLCHAIN_TARGET_TASK ?= " \
72    ${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \
73    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', multilib_pkg_extend(d, 'packagegroup-go-sdk-target'), '', d)} \
74    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', multilib_pkg_extend(d, 'libstd-rs'), '', d)} \
75    target-sdk-provides-dummy \
76"
77TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= ""
78TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
79
80# Default archived SDK's suffix
81SDK_ARCHIVE_TYPE ?= "tar.xz"
82SDK_XZ_COMPRESSION_LEVEL ?= "-9"
83SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}"
84SDK_ZIP_OPTIONS ?= "-y"
85SDK_7ZIP_OPTIONS ?= "-mx=9 -mm=BZip2"
86SDK_7ZIP_TYPE ?= "7z"
87SDK_ZSTD_COMPRESSION_LEVEL = "-17"
88
89# To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz
90python () {
91    if d.getVar('SDK_ARCHIVE_TYPE') == 'zip':
92       d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native')
93       # SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR}
94       # recommand to cd into input dir first to avoid archive with buildpath
95       d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r ${SDK_ZIP_OPTIONS} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .')
96    elif d.getVar('SDK_ARCHIVE_TYPE') == '7zip':
97       d.setVar('SDK_ARCHIVE_DEPENDS', 'p7zip-native')
98       d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; 7za a -r ${SDK_7ZIP_OPTIONS} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_7ZIP_TYPE} .')
99    elif d.getVar('SDK_ARCHIVE_TYPE') == 'tar.zst':
100       d.setVar('SDK_ARCHIVE_DEPENDS', 'zstd-native')
101       d.setVar('SDK_ARCHIVE_CMD',
102         'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | zstd -f -k -T0 -c ${SDK_ZSTD_COMPRESSION_LEVEL} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}')
103    elif d.getVar('SDK_ARCHIVE_TYPE') == 'tar.xz':
104       d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native')
105       d.setVar('SDK_ARCHIVE_CMD',
106         'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz ${SDK_XZ_OPTIONS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}')
107    else:
108        bb.fatal("Invalid SDK_ARCHIVE_TYPE: %s, the supported SDK archive types are: zip, 7z, tar.xz, tar.zst" % d.getVar('SDK_ARCHIVE_TYPE'))
109}
110
111SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
112SDK_DEPENDS = "virtual/fakeroot-native ${SDK_ARCHIVE_DEPENDS} cross-localedef-native nativesdk-qemuwrapper-cross ${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross"
113PATH:prepend = "${WORKDIR}/recipe-sysroot/${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:"
114SDK_DEPENDS += "nativesdk-glibc-locale"
115
116# We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it
117# could be set to the MACHINE_ARCH
118REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
119
120PID = "${@os.getpid()}"
121
122EXCLUDE_FROM_WORLD = "1"
123
124SDK_PACKAGING_FUNC ?= "create_shar"
125SDK_PRE_INSTALL_COMMAND ?= ""
126SDK_POST_INSTALL_COMMAND ?= ""
127SDK_RELOCATE_AFTER_INSTALL ?= "1"
128
129SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk"
130SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK"
131
132SDK_TARGET_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.target.manifest"
133SDK_HOST_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.host.manifest"
134SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"
135SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
136
137SDK_PRUNE_SYSROOT_DIRS ?= "/dev"
138
139python write_target_sdk_manifest () {
140    from oe.sdk import sdk_list_installed_packages
141    from oe.utils import format_pkg_list
142    sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST"))
143    pkgs = sdk_list_installed_packages(d, True)
144    if not os.path.exists(sdkmanifestdir):
145        bb.utils.mkdirhier(sdkmanifestdir)
146    with open(d.getVar('SDK_TARGET_MANIFEST'), 'w') as output:
147        output.write(format_pkg_list(pkgs, 'ver'))
148}
149
150sdk_prune_dirs () {
151    for d in ${SDK_PRUNE_SYSROOT_DIRS}; do
152        rm -rf ${SDK_OUTPUT}${SDKTARGETSYSROOT}$d
153    done
154}
155
156python write_sdk_test_data() {
157    from oe.data import export2json
158    testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR'), d.getVar('TOOLCHAIN_OUTPUTNAME'))
159    bb.utils.mkdirhier(os.path.dirname(testdata))
160    export2json(d, testdata)
161}
162
163python write_host_sdk_manifest () {
164    from oe.sdk import sdk_list_installed_packages
165    from oe.utils import format_pkg_list
166    sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST"))
167    pkgs = sdk_list_installed_packages(d, False)
168    if not os.path.exists(sdkmanifestdir):
169        bb.utils.mkdirhier(sdkmanifestdir)
170    with open(d.getVar('SDK_HOST_MANIFEST'), 'w') as output:
171        output.write(format_pkg_list(pkgs, 'ver'))
172}
173
174POPULATE_SDK_POST_TARGET_COMMAND:append = " write_sdk_test_data"
175POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk  = " write_target_sdk_manifest sdk_prune_dirs"
176POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manifest"
177
178SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC}' if '${SDK_PACKAGING_FUNC}' else ''}"
179SDK_POSTPROCESS_COMMAND = "create_sdk_files check_sdk_sysroots archive_sdk ${SDK_PACKAGING_COMMAND}"
180
181def populate_sdk_common(d):
182    from oe.sdk import populate_sdk
183    from oe.manifest import create_manifest, Manifest
184    import oe.packagedata
185
186    # Handle package exclusions
187    excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split()
188    inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split()
189    inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split()
190
191    d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
192    d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
193
194    for pkg in excl_pkgs:
195        if pkg in inst_pkgs:
196            bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s).  It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
197            inst_pkgs.remove(pkg)
198
199        if pkg in inst_attempt_pkgs:
200            bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s).  It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
201            inst_attempt_pkgs.remove(pkg)
202
203    d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
204    d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
205
206    pn = d.getVar('PN')
207    oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d)
208    oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d)
209
210    ld = bb.data.createCopy(d)
211    ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata")
212    oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld)
213    oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld)
214    d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK"))
215    d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY"))
216
217    # create target/host SDK manifests
218    create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
219                    manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST)
220    create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
221                    manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET)
222
223    populate_sdk(d)
224
225fakeroot python do_populate_sdk() {
226    populate_sdk_common(d)
227}
228SSTATETASKS += "do_populate_sdk"
229SSTATE_SKIP_CREATION:task-populate-sdk = '1'
230do_populate_sdk[cleandirs] += "${SDKDEPLOYDIR}"
231do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}"
232do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}"
233do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}"
234python do_populate_sdk_setscene () {
235    sstate_setscene(d)
236}
237addtask do_populate_sdk_setscene
238
239PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR},${WORKDIR}/oe-sdk-repo,${WORKDIR}/sstate-build-populate_sdk"
240
241fakeroot create_sdk_files() {
242	cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
243
244	# Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern.
245	# Escape special characters like '+' and '.' in the SDKPATH
246	escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g")
247	sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py
248
249       mkdir -p ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/
250       echo '${SDKPATHNATIVE}${libdir_nativesdk}
251${SDKPATHNATIVE}${base_libdir_nativesdk}
252include /etc/ld.so.conf' > ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ld.so.conf
253}
254
255python check_sdk_sysroots() {
256    # Fails build if there are broken or dangling symlinks in SDK sysroots
257
258    if d.getVar('CHECK_SDK_SYSROOTS') != '1':
259        # disabled, bail out
260        return
261
262    def norm_path(path):
263        return os.path.abspath(path)
264
265    # Get scan root
266    SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'),
267                                               d.getVar('SDKPATH')))
268
269    bb.note('Checking SDK sysroots at ' + SCAN_ROOT)
270
271    def check_symlink(linkPath):
272        if not os.path.islink(linkPath):
273            return
274
275        linkDirPath = os.path.dirname(linkPath)
276
277        targetPath = os.readlink(linkPath)
278        if not os.path.isabs(targetPath):
279            targetPath = os.path.join(linkDirPath, targetPath)
280        targetPath = norm_path(targetPath)
281
282        if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ):
283            bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath))
284            return
285
286        if not os.path.exists(targetPath):
287            bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath))
288            return
289
290        if os.path.isdir(targetPath):
291            dir_walk(targetPath)
292
293    def walk_error_handler(e):
294        bb.error(str(e))
295
296    def dir_walk(rootDir):
297        for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler):
298            entries = subDirEntries + fileEntries
299            for e in entries:
300                ePath = os.path.join(dirPath, e)
301                check_symlink(ePath)
302
303    # start
304    dir_walk(SCAN_ROOT)
305}
306
307SDKTAROPTS = "--owner=root --group=root --clamp-mtime --mtime=@${SOURCE_DATE_EPOCH}"
308
309fakeroot archive_sdk() {
310	# Package it up
311	mkdir -p ${SDKDEPLOYDIR}
312	${SDK_ARCHIVE_CMD}
313}
314
315TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh"
316TOOLCHAIN_SHAR_REL_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-relocate.sh"
317
318fakeroot create_shar() {
319	# copy in the template shar extractor script
320	cp ${TOOLCHAIN_SHAR_EXT_TMPL} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
321
322	rm -f ${T}/pre_install_command ${T}/post_install_command
323
324	if [ "${SDK_RELOCATE_AFTER_INSTALL}" = "1" ] ; then
325		cp ${TOOLCHAIN_SHAR_REL_TMPL} ${T}/post_install_command
326	fi
327	cat << "EOF" >> ${T}/pre_install_command
328${SDK_PRE_INSTALL_COMMAND}
329EOF
330
331	cat << "EOF" >> ${T}/post_install_command
332${SDK_POST_INSTALL_COMMAND}
333EOF
334	sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \
335		-e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \
336		${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
337
338	# substitute variables
339	sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \
340		-e 's#@SDKPATH@#${SDKPATH}#g' \
341		-e 's#@SDKPATHINSTALL@#${SDKPATHINSTALL}#g' \
342		-e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \
343		-e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \
344		-e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \
345		-e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\\&')}#g' \
346		-e 's#@SDK_VERSION@#${SDK_VERSION}#g' \
347		-e '/@SDK_PRE_INSTALL_COMMAND@/d' \
348		-e '/@SDK_POST_INSTALL_COMMAND@/d' \
349		-e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \
350		-e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \
351		${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
352
353	# add execution permission
354	chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
355
356	# append the SDK tarball
357	cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
358
359	# delete the old tarball, we don't need it anymore
360	rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}
361}
362
363populate_sdk_log_check() {
364	for target in $*
365	do
366		lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}"
367
368		echo "log_check: Using $lf_path as logfile"
369
370		if [ -e "$lf_path" ]; then
371			${IMAGE_PKGTYPE}_log_check $target $lf_path
372		else
373			echo "Cannot find logfile [$lf_path]"
374		fi
375		echo "Logfile is clean"
376	done
377}
378
379def sdk_command_variables(d):
380    return ['OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','POPULATE_SDK_POST_HOST_COMMAND','POPULATE_SDK_PRE_TARGET_COMMAND','POPULATE_SDK_POST_TARGET_COMMAND','SDK_POSTPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS']
381
382def sdk_variables(d):
383    variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT',
384                 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS',
385                 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'IMAGE_INSTALL_DEBUGFS']
386    variables.extend(sdk_command_variables(d))
387    return " ".join(variables)
388
389do_populate_sdk[vardeps] += "${@sdk_variables(d)}"
390
391python () {
392    variables = sdk_command_variables(d)
393    for var in variables:
394        d.setVarFlag(var, 'vardeps', d.getVar(var))
395}
396
397do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \
398                                    ${TOOLCHAIN_SHAR_EXT_TMPL}:True"
399
400do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}"
401do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])}  ${@d.getVarFlag('do_rootfs', 'depends', False)}"
402do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}"
403do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb do_package_qa"
404do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
405addtask populate_sdk
406