diff --git a/poky/meta/classes/allarch.bbclass b/poky/meta/classes/allarch.bbclass
deleted file mode 100644
index a766a65..0000000
--- a/poky/meta/classes/allarch.bbclass
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# This class is used for architecture independent recipes/data files (usually scripts)
-#
-
-python allarch_package_arch_handler () {
-    if bb.data.inherits_class("native", d) or bb.data.inherits_class("nativesdk", d) \
-        or bb.data.inherits_class("crosssdk", d):
-        return
-
-    variants = d.getVar("MULTILIB_VARIANTS")
-    if not variants:
-        d.setVar("PACKAGE_ARCH", "all" )
-}
-
-addhandler allarch_package_arch_handler
-allarch_package_arch_handler[eventmask] = "bb.event.RecipePreFinalise"
-
-python () {
-    # Allow this class to be included but overridden - only set
-    # the values if we're still "all" package arch.
-    if d.getVar("PACKAGE_ARCH") == "all":
-        # No need for virtual/libc or a cross compiler
-        d.setVar("INHIBIT_DEFAULT_DEPS","1")
-
-        # Set these to a common set of values, we shouldn't be using them other that for WORKDIR directory
-        # naming anyway
-        d.setVar("baselib", "lib")
-        d.setVar("TARGET_ARCH", "allarch")
-        d.setVar("TARGET_OS", "linux")
-        d.setVar("TARGET_CC_ARCH", "none")
-        d.setVar("TARGET_LD_ARCH", "none")
-        d.setVar("TARGET_AS_ARCH", "none")
-        d.setVar("TARGET_FPU", "")
-        d.setVar("TARGET_PREFIX", "")
-        # Expand PACKAGE_EXTRA_ARCHS since the staging code needs this
-        # (this removes any dependencies from the hash perspective)
-        d.setVar("PACKAGE_EXTRA_ARCHS", d.getVar("PACKAGE_EXTRA_ARCHS"))
-        d.setVar("SDK_ARCH", "none")
-        d.setVar("SDK_CC_ARCH", "none")
-        d.setVar("TARGET_CPPFLAGS", "none")
-        d.setVar("TARGET_CFLAGS", "none")
-        d.setVar("TARGET_CXXFLAGS", "none")
-        d.setVar("TARGET_LDFLAGS", "none")
-        d.setVar("POPULATESYSROOTDEPS", "")
-
-        # Avoid this being unnecessarily different due to nuances of
-        # the target machine that aren't important for "all" arch
-        # packages.
-        d.setVar("LDFLAGS", "")
-
-        # No need to do shared library processing or debug symbol handling
-        d.setVar("EXCLUDE_FROM_SHLIBS", "1")
-        d.setVar("INHIBIT_PACKAGE_DEBUG_SPLIT", "1")
-        d.setVar("INHIBIT_PACKAGE_STRIP", "1")
-
-        # These multilib values shouldn't change allarch packages so exclude them
-        d.appendVarFlag("emit_pkgdata", "vardepsexclude", " MULTILIB_VARIANTS")
-        d.appendVarFlag("write_specfile", "vardepsexclude", " MULTILIBS")
-        d.appendVarFlag("do_package", "vardepsexclude", " package_do_shlibs")
-    elif bb.data.inherits_class('packagegroup', d) and not bb.data.inherits_class('nativesdk', d):
-        bb.error("Please ensure recipe %s sets PACKAGE_ARCH before inherit packagegroup" % d.getVar("FILE"))
-}
-
-def qemu_wrapper_cmdline(data, rootfs_path, library_paths):
-    return 'false'
diff --git a/poky/meta/classes/archiver.bbclass b/poky/meta/classes/archiver.bbclass
index 5da369d..0710c1e 100644
--- a/poky/meta/classes/archiver.bbclass
+++ b/poky/meta/classes/archiver.bbclass
@@ -1,5 +1,9 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 #
 # This bbclass is used for creating archive for:
 #  1) original (or unpacked) source: ARCHIVER_MODE[src] = "original"
@@ -459,7 +463,9 @@
 
 def is_work_shared(d):
     pn = d.getVar('PN')
-    return bb.data.inherits_class('kernel', d) or pn.startswith('gcc-source')
+    return pn.startswith('gcc-source') or \
+        bb.data.inherits_class('kernel', d) or \
+        (bb.data.inherits_class('kernelsrc', d) and d.getVar('S') == d.getVar('STAGING_KERNEL_DIR'))
 
 # Run do_unpack and do_patch
 python do_unpack_and_patch() {
diff --git a/poky/meta/classes/autotools-brokensep.bbclass b/poky/meta/classes/autotools-brokensep.bbclass
deleted file mode 100644
index 71cf97a..0000000
--- a/poky/meta/classes/autotools-brokensep.bbclass
+++ /dev/null
@@ -1,5 +0,0 @@
-# Autotools class for recipes where separate build dir doesn't work
-# Ideally we should fix software so it does work. Standard autotools supports
-# this.
-inherit autotools
-B = "${S}"
diff --git a/poky/meta/classes/autotools.bbclass b/poky/meta/classes/autotools.bbclass
deleted file mode 100644
index 4ab2460..0000000
--- a/poky/meta/classes/autotools.bbclass
+++ /dev/null
@@ -1,254 +0,0 @@
-def get_autotools_dep(d):
-    if d.getVar('INHIBIT_AUTOTOOLS_DEPS'):
-        return ''
-
-    pn = d.getVar('PN')
-    deps = ''
-
-    if pn in ['autoconf-native', 'automake-native']:
-        return deps
-    deps += 'autoconf-native automake-native '
-
-    if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
-        deps += 'libtool-native '
-        if not bb.data.inherits_class('native', d) \
-                        and not bb.data.inherits_class('nativesdk', d) \
-                        and not bb.data.inherits_class('cross', d) \
-                        and not d.getVar('INHIBIT_DEFAULT_DEPS'):
-            deps += 'libtool-cross '
-
-    return deps
-
-
-DEPENDS:prepend = "${@get_autotools_dep(d)} "
-
-inherit siteinfo
-
-# Space separated list of shell scripts with variables defined to supply test
-# results for autoconf tests we cannot run at build time.
-# The value of this variable is filled in in a prefunc because it depends on
-# the contents of the sysroot.
-export CONFIG_SITE
-
-acpaths ?= "default"
-EXTRA_AUTORECONF = "--exclude=autopoint --exclude=gtkdocize"
-
-export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
-
-# When building tools for use at build-time it's recommended for the build
-# system to use these variables when cross-compiling.
-# (http://sources.redhat.com/autobook/autobook/autobook_270.html)
-export CPP_FOR_BUILD = "${BUILD_CPP}"
-export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}"
-
-export CC_FOR_BUILD = "${BUILD_CC}"
-export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
-
-export CXX_FOR_BUILD = "${BUILD_CXX}"
-export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
-
-export LD_FOR_BUILD = "${BUILD_LD}"
-export LDFLAGS_FOR_BUILD = "${BUILD_LDFLAGS}"
-
-def append_libtool_sysroot(d):
-    # Only supply libtool sysroot option for non-native packages
-    if not bb.data.inherits_class('native', d):
-        return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
-    return ""
-
-CONFIGUREOPTS = " --build=${BUILD_SYS} \
-		  --host=${HOST_SYS} \
-		  --target=${TARGET_SYS} \
-		  --prefix=${prefix} \
-		  --exec_prefix=${exec_prefix} \
-		  --bindir=${bindir} \
-		  --sbindir=${sbindir} \
-		  --libexecdir=${libexecdir} \
-		  --datadir=${datadir} \
-		  --sysconfdir=${sysconfdir} \
-		  --sharedstatedir=${sharedstatedir} \
-		  --localstatedir=${localstatedir} \
-		  --libdir=${libdir} \
-		  --includedir=${includedir} \
-		  --oldincludedir=${oldincludedir} \
-		  --infodir=${infodir} \
-		  --mandir=${mandir} \
-		  --disable-silent-rules \
-		  ${CONFIGUREOPT_DEPTRACK} \
-		  ${@append_libtool_sysroot(d)}"
-CONFIGUREOPT_DEPTRACK ?= "--disable-dependency-tracking"
-
-CACHED_CONFIGUREVARS ?= ""
-
-AUTOTOOLS_SCRIPT_PATH ?= "${S}"
-CONFIGURE_SCRIPT ?= "${AUTOTOOLS_SCRIPT_PATH}/configure"
-
-AUTOTOOLS_AUXDIR ?= "${AUTOTOOLS_SCRIPT_PATH}"
-
-oe_runconf () {
-	# Use relative path to avoid buildpaths in files
-	cfgscript_name="`basename ${CONFIGURE_SCRIPT}`"
-	cfgscript=`python3 -c "import os; print(os.path.relpath(os.path.dirname('${CONFIGURE_SCRIPT}'), '.'))"`/$cfgscript_name
-	if [ -x "$cfgscript" ] ; then
-		bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
-		if ! CONFIG_SHELL=${CONFIG_SHELL-/bin/bash} ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then
-			bbnote "The following config.log files may provide further information."
-			bbnote `find ${B} -ignore_readdir_race -type f -name config.log`
-			bbfatal_log "configure failed"
-		fi
-	else
-		bbfatal "no configure script found at $cfgscript"
-	fi
-}
-
-CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
-
-autotools_preconfigure() {
-	if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
-		if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
-			if [ "${S}" != "${B}" ]; then
-				echo "Previously configured separate build directory detected, cleaning ${B}"
-				rm -rf ${B}
-				mkdir -p ${B}
-			else
-				# At least remove the .la files since automake won't automatically
-				# regenerate them even if CFLAGS/LDFLAGS are different
-				cd ${S}
-				if [ "${CLEANBROKEN}" != "1" -a \( -e Makefile -o -e makefile -o -e GNUmakefile \) ]; then
-					oe_runmake clean
-				fi
-				find ${S} -ignore_readdir_race -name \*.la -delete
-			fi
-		fi
-	fi
-}
-
-autotools_postconfigure(){
-	if [ -n "${CONFIGURESTAMPFILE}" ]; then
-		mkdir -p `dirname ${CONFIGURESTAMPFILE}`
-		echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
-	fi
-}
-
-EXTRACONFFUNCS ??= ""
-
-EXTRA_OECONF:append = " ${PACKAGECONFIG_CONFARGS}"
-
-do_configure[prefuncs] += "autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}"
-do_compile[prefuncs] += "autotools_aclocals"
-do_install[prefuncs] += "autotools_aclocals"
-do_configure[postfuncs] += "autotools_postconfigure"
-
-ACLOCALDIR = "${STAGING_DATADIR}/aclocal"
-ACLOCALEXTRAPATH = ""
-ACLOCALEXTRAPATH:class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
-ACLOCALEXTRAPATH:class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
-
-python autotools_aclocals () {
-    sitefiles, searched = siteinfo_get_files(d, sysrootcache=True)
-    d.setVar("CONFIG_SITE", " ".join(sitefiles))
-}
-
-do_configure[file-checksums] += "${@' '.join(siteinfo_get_files(d, sysrootcache=False)[1])}"
-
-CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am"
-
-autotools_do_configure() {
-	# WARNING: gross hack follows:
-	# An autotools built package generally needs these scripts, however only
-	# automake or libtoolize actually install the current versions of them.
-	# This is a problem in builds that do not use libtool or automake, in the case
-	# where we -need- the latest version of these scripts.  e.g. running a build
-	# for a package whose autotools are old, on an x86_64 machine, which the old
-	# config.sub does not support.  Work around this by installing them manually
-	# regardless.
-
-	PRUNE_M4=""
-
-	for ac in `find ${S} -ignore_readdir_race -name configure.in -o -name configure.ac`; do
-		rm -f `dirname $ac`/configure
-	done
-	if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then
-		olddir=`pwd`
-		cd ${AUTOTOOLS_SCRIPT_PATH}
-		mkdir -p ${ACLOCALDIR}
-		ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/"
-		if [ x"${acpaths}" = xdefault ]; then
-			acpaths=
-			for i in `find ${AUTOTOOLS_SCRIPT_PATH} -ignore_readdir_race -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
-				grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
-				acpaths="$acpaths -I $i"
-			done
-		else
-			acpaths="${acpaths}"
-		fi
-		acpaths="$acpaths ${ACLOCALEXTRAPATH}"
-		AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'`
-		automake --version
-		echo "AUTOV is $AUTOV"
-		if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
-			ACLOCAL="$ACLOCAL --automake-acdir=${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
-		fi
-		# autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
-		# like it was auto-generated.  Work around this by blowing it away
-		# by hand, unless the package specifically asked not to run aclocal.
-		if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
-			rm -f aclocal.m4
-		fi
-		if [ -e configure.in ]; then
-			CONFIGURE_AC=configure.in
-		else
-			CONFIGURE_AC=configure.ac
-		fi
-		if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then
-			if grep -q "sed.*POTFILES" $CONFIGURE_AC; then
-				: do nothing -- we still have an old unmodified configure.ac
-	    		else
-				bbnote Executing glib-gettextize --force --copy
-				echo "no" | glib-gettextize --force --copy
-			fi
-		elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
-			# We'd call gettextize here if it wasn't so broken...
-			cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
-			if [ -d ${S}/po/ ]; then
-				cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/
-				if [ ! -e ${S}/po/remove-potcdate.sin ]; then
-					cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/
-				fi
-			fi
-			PRUNE_M4="$PRUNE_M4 gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4"
-		fi
-		mkdir -p m4
-
-		for i in $PRUNE_M4; do
-			find ${S} -ignore_readdir_race -name $i -delete
-		done
-
-		bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
-		ACLOCAL="$ACLOCAL" autoreconf -Wcross -Wno-obsolete --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || die "autoreconf execution failed."
-		cd $olddir
-	fi
-	if [ -e ${CONFIGURE_SCRIPT} ]; then
-		oe_runconf
-	else
-		bbnote "nothing to configure"
-	fi
-}
-
-autotools_do_compile() {
-	oe_runmake
-}
-
-autotools_do_install() {
-	oe_runmake 'DESTDIR=${D}' install
-	# Info dir listing isn't interesting at this point so remove it if it exists.
-	if [ -e "${D}${infodir}/dir" ]; then
-		rm -f ${D}${infodir}/dir
-	fi
-}
-
-inherit siteconfig
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
-
-B = "${WORKDIR}/build"
diff --git a/poky/meta/classes/baremetal-image.bbclass b/poky/meta/classes/baremetal-image.bbclass
deleted file mode 100644
index cb9e250..0000000
--- a/poky/meta/classes/baremetal-image.bbclass
+++ /dev/null
@@ -1,122 +0,0 @@
-# Baremetal image class
-#
-# This class is meant to be inherited by recipes for baremetal/RTOS applications
-# It contains code that would be used by all of them, every recipe just needs to
-# override certain variables.
-#
-# For scalability purposes, code within this class focuses on the "image" wiring
-# to satisfy the OpenEmbedded image creation and testing infrastructure.
-#
-# See meta-skeleton for a working example.
-
-
-# Toolchain should be baremetal or newlib based.
-# TCLIBC="baremetal" or TCLIBC="newlib"
-COMPATIBLE_HOST:libc-musl:class-target = "null"
-COMPATIBLE_HOST:libc-glibc:class-target = "null"
-
-
-inherit rootfs-postcommands
-
-# Set some defaults, but these should be overriden by each recipe if required
-IMGDEPLOYDIR ?= "${WORKDIR}/deploy-${PN}-image-complete"
-BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}"
-IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}"
-IMAGE_NAME_SUFFIX ?= ""
-
-do_rootfs[dirs] = "${IMGDEPLOYDIR} ${DEPLOY_DIR_IMAGE}"
-
-do_image(){
-    install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.bin
-    install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.elf
-}
-
-do_image_complete(){
-    :
-}
-
-python do_rootfs(){
-    from oe.utils import execute_pre_post_process
-    from pathlib import Path
-
-    # Write empty manifest file to satisfy test infrastructure
-    deploy_dir = d.getVar('IMGDEPLOYDIR')
-    link_name = d.getVar('IMAGE_LINK_NAME')
-    manifest_name = d.getVar('IMAGE_MANIFEST')
-
-    Path(manifest_name).touch()
-    if os.path.exists(manifest_name) and link_name:
-        manifest_link = deploy_dir + "/" + link_name + ".manifest"
-        if manifest_link != manifest_name:
-            if os.path.lexists(manifest_link):
-                os.remove(manifest_link)
-            os.symlink(os.path.basename(manifest_name), manifest_link)
-    # A lot of postprocess commands assume the existence of rootfs/etc
-    sysconfdir = d.getVar("IMAGE_ROOTFS") + d.getVar('sysconfdir')
-    bb.utils.mkdirhier(sysconfdir)
-
-    execute_pre_post_process(d, d.getVar('ROOTFS_POSTPROCESS_COMMAND'))
-}
-
-
-# Assure binaries, manifest and qemubootconf are populated on DEPLOY_DIR_IMAGE
-do_image_complete[dirs] = "${TOPDIR}"
-SSTATETASKS += "do_image_complete"
-SSTATE_SKIP_CREATION:task-image-complete = '1'
-do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
-do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
-do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}"
-addtask do_image_complete after do_image before do_build
-
-python do_image_complete_setscene () {
-    sstate_setscene(d)
-}
-addtask do_image_complete_setscene
-
-# QEMU generic Baremetal/RTOS parameters
-QB_DEFAULT_KERNEL ?= "${IMAGE_LINK_NAME}.bin"
-QB_MEM ?= "-m 256"
-QB_DEFAULT_FSTYPE ?= "bin"
-QB_DTB ?= ""
-QB_OPT_APPEND:append = " -nographic"
-
-# RISC-V tunes set the BIOS, unset, and instruct QEMU to
-# ignore the BIOS and boot from -kernel
-QB_DEFAULT_BIOS:qemuriscv64 = ""
-QB_DEFAULT_BIOS:qemuriscv32 = ""
-QB_OPT_APPEND:append:qemuriscv64 = " -bios none"
-QB_OPT_APPEND:append:qemuriscv32 = " -bios none"
-
-
-# Use the medium-any code model for the RISC-V 64 bit implementation,
-# since medlow can only access addresses below 0x80000000 and RAM
-# starts at 0x80000000 on RISC-V 64
-# Keep RISC-V 32 using -mcmodel=medlow (symbols lie between -2GB:2GB)
-CFLAGS:append:qemuriscv64 = " -mcmodel=medany"
-
-
-# This next part is necessary to trick the build system into thinking
-# its building an image recipe so it generates the qemuboot.conf
-addtask do_rootfs before do_image after do_install
-addtask do_image after do_rootfs before do_image_complete
-addtask do_image_complete after do_image before do_build
-inherit qemuboot
-
-# Based on image.bbclass to make sure we build qemu
-python(){
-    # do_addto_recipe_sysroot doesnt exist for all recipes, but we need it to have
-    # /usr/bin on recipe-sysroot (qemu) populated
-    # The do_addto_recipe_sysroot dependency is coming from EXTRA_IMAGDEPENDS now,
-    # we just need to add the logic to add its dependency to do_image.
-    def extraimage_getdepends(task):
-        deps = ""
-        for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
-        # Make sure we only add it for qemu
-            if 'qemu' in dep:
-                if ":" in dep:
-                    deps += " %s " % (dep)
-                else:
-                    deps += " %s:%s" % (dep, task)
-        return deps
-    d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_sysroot')) 
-}
diff --git a/poky/meta/classes/base.bbclass b/poky/meta/classes/base.bbclass
deleted file mode 100644
index 571b675..0000000
--- a/poky/meta/classes/base.bbclass
+++ /dev/null
@@ -1,783 +0,0 @@
-BB_DEFAULT_TASK ?= "build"
-CLASSOVERRIDE ?= "class-target"
-
-inherit patch
-inherit staging
-
-inherit mirrors
-inherit utils
-inherit utility-tasks
-inherit logging
-
-OE_EXTRA_IMPORTS ?= ""
-
-OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust oe.buildcfg ${OE_EXTRA_IMPORTS}"
-OE_IMPORTS[type] = "list"
-
-PACKAGECONFIG_CONFARGS ??= ""
-
-def oe_import(d):
-    import sys
-
-    bbpath = [os.path.join(dir, "lib") for dir in d.getVar("BBPATH").split(":")]
-    sys.path[0:0] = [dir for dir in bbpath if dir not in sys.path]
-
-    import oe.data
-    for toimport in oe.data.typed_value("OE_IMPORTS", d):
-        try:
-            # Make a python object accessible from the metadata
-            bb.utils._context[toimport.split(".", 1)[0]] = __import__(toimport)
-        except AttributeError as e:
-            bb.error("Error importing OE modules: %s" % str(e))
-    return ""
-
-# We need the oe module name space early (before INHERITs get added)
-OE_IMPORTED := "${@oe_import(d)}"
-
-inherit metadata_scm
-
-def lsb_distro_identifier(d):
-    adjust = d.getVar('LSB_DISTRO_ADJUST')
-    adjust_func = None
-    if adjust:
-        try:
-            adjust_func = globals()[adjust]
-        except KeyError:
-            pass
-    return oe.lsb.distro_identifier(adjust_func)
-
-die() {
-	bbfatal_log "$*"
-}
-
-oe_runmake_call() {
-	bbnote ${MAKE} ${EXTRA_OEMAKE} "$@"
-	${MAKE} ${EXTRA_OEMAKE} "$@"
-}
-
-oe_runmake() {
-	oe_runmake_call "$@" || die "oe_runmake failed"
-}
-
-
-def get_base_dep(d):
-    if d.getVar('INHIBIT_DEFAULT_DEPS', False):
-        return ""
-    return "${BASE_DEFAULT_DEPS}"
-
-BASE_DEFAULT_DEPS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs virtual/libc"
-
-BASEDEPENDS = ""
-BASEDEPENDS:class-target = "${@get_base_dep(d)}"
-BASEDEPENDS:class-nativesdk = "${@get_base_dep(d)}"
-
-DEPENDS:prepend="${BASEDEPENDS} "
-
-FILESPATH = "${@base_set_filespath(["${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files"], d)}"
-# THISDIR only works properly with imediate expansion as it has to run
-# in the context of the location its used (:=)
-THISDIR = "${@os.path.dirname(d.getVar('FILE'))}"
-
-def extra_path_elements(d):
-    path = ""
-    elements = (d.getVar('EXTRANATIVEPATH') or "").split()
-    for e in elements:
-        path = path + "${STAGING_BINDIR_NATIVE}/" + e + ":"
-    return path
-
-PATH:prepend = "${@extra_path_elements(d)}"
-
-def get_lic_checksum_file_list(d):
-    filelist = []
-    lic_files = d.getVar("LIC_FILES_CHKSUM") or ''
-    tmpdir = d.getVar("TMPDIR")
-    s = d.getVar("S")
-    b = d.getVar("B")
-    workdir = d.getVar("WORKDIR")
-
-    urls = lic_files.split()
-    for url in urls:
-        # We only care about items that are absolute paths since
-        # any others should be covered by SRC_URI.
-        try:
-            (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
-            if method != "file" or not path:
-                raise bb.fetch.MalformedUrl(url)
-
-            if path[0] == '/':
-                if path.startswith((tmpdir, s, b, workdir)):
-                    continue
-                filelist.append(path + ":" + str(os.path.exists(path)))
-        except bb.fetch.MalformedUrl:
-            bb.fatal(d.getVar('PN') + ": LIC_FILES_CHKSUM contains an invalid URL: " + url)
-    return " ".join(filelist)
-
-def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
-    tools = d.getVar(toolsvar).split()
-    origbbenv = d.getVar("BB_ORIGENV", False)
-    path = origbbenv.getVar("PATH")
-    # Need to ignore our own scripts directories to avoid circular links
-    for p in path.split(":"):
-        if p.endswith("/scripts"):
-            path = path.replace(p, "/ignoreme")
-    bb.utils.mkdirhier(dest)
-    notfound = []
-    for tool in tools:
-        desttool = os.path.join(dest, tool)
-        if not os.path.exists(desttool):
-            # clean up dead symlink
-            if os.path.islink(desttool):
-                os.unlink(desttool)
-            srctool = bb.utils.which(path, tool, executable=True)
-            # gcc/g++ may link to ccache on some hosts, e.g.,
-            # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)
-            # would return /usr/local/bin/ccache/gcc, but what we need is
-            # /usr/bin/gcc, this code can check and fix that.
-            if "ccache" in srctool:
-                srctool = bb.utils.which(path, tool, executable=True, direction=1)
-            if srctool:
-                os.symlink(srctool, desttool)
-            else:
-                notfound.append(tool)
-
-    if notfound and fatal:
-        bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n  %s" % " ".join(notfound))
-
-addtask fetch
-do_fetch[dirs] = "${DL_DIR}"
-do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
-do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}"
-do_fetch[vardeps] += "SRCREV"
-do_fetch[network] = "1"
-python base_do_fetch() {
-
-    src_uri = (d.getVar('SRC_URI') or "").split()
-    if not src_uri:
-        return
-
-    try:
-        fetcher = bb.fetch2.Fetch(src_uri, d)
-        fetcher.download()
-    except bb.fetch2.BBFetchException as e:
-        bb.fatal("Bitbake Fetcher Error: " + repr(e))
-}
-
-addtask unpack after do_fetch
-do_unpack[dirs] = "${WORKDIR}"
-
-do_unpack[cleandirs] = "${@d.getVar('S') if os.path.normpath(d.getVar('S')) != os.path.normpath(d.getVar('WORKDIR')) else os.path.join('${S}', 'patches')}"
-
-python base_do_unpack() {
-    src_uri = (d.getVar('SRC_URI') or "").split()
-    if not src_uri:
-        return
-
-    try:
-        fetcher = bb.fetch2.Fetch(src_uri, d)
-        fetcher.unpack(d.getVar('WORKDIR'))
-    except bb.fetch2.BBFetchException as e:
-        bb.fatal("Bitbake Fetcher Error: " + repr(e))
-}
-
-SSTATETASKS += "do_deploy_source_date_epoch"
-
-do_deploy_source_date_epoch () {
-    mkdir -p ${SDE_DEPLOYDIR}
-    if [ -e ${SDE_FILE} ]; then
-        echo "Deploying SDE from ${SDE_FILE} -> ${SDE_DEPLOYDIR}."
-        cp -p ${SDE_FILE} ${SDE_DEPLOYDIR}/__source_date_epoch.txt
-    else
-        echo "${SDE_FILE} not found!"
-    fi
-}
-
-python do_deploy_source_date_epoch_setscene () {
-    sstate_setscene(d)
-    bb.utils.mkdirhier(d.getVar('SDE_DIR'))
-    sde_file = os.path.join(d.getVar('SDE_DEPLOYDIR'), '__source_date_epoch.txt')
-    if os.path.exists(sde_file):
-        target = d.getVar('SDE_FILE')
-        bb.debug(1, "Moving setscene SDE file %s -> %s" % (sde_file, target))
-        bb.utils.rename(sde_file, target)
-    else:
-        bb.debug(1, "%s not found!" % sde_file)
-}
-
-do_deploy_source_date_epoch[dirs] = "${SDE_DEPLOYDIR}"
-do_deploy_source_date_epoch[sstate-plaindirs] = "${SDE_DEPLOYDIR}"
-addtask do_deploy_source_date_epoch_setscene
-addtask do_deploy_source_date_epoch before do_configure after do_patch
-
-python create_source_date_epoch_stamp() {
-    # Version: 1
-    source_date_epoch = oe.reproducible.get_source_date_epoch(d, d.getVar('S'))
-    oe.reproducible.epochfile_write(source_date_epoch, d.getVar('SDE_FILE'), d)
-}
-do_unpack[postfuncs] += "create_source_date_epoch_stamp"
-
-def get_source_date_epoch_value(d):
-    return oe.reproducible.epochfile_read(d.getVar('SDE_FILE'), d)
-
-def get_layers_branch_rev(d):
-    revisions = oe.buildcfg.get_layer_revisions(d)
-    layers_branch_rev = ["%-20s = \"%s:%s\"" % (r[1], r[2], r[3]) for r in revisions]
-    i = len(layers_branch_rev)-1
-    p1 = layers_branch_rev[i].find("=")
-    s1 = layers_branch_rev[i][p1:]
-    while i > 0:
-        p2 = layers_branch_rev[i-1].find("=")
-        s2= layers_branch_rev[i-1][p2:]
-        if s1 == s2:
-            layers_branch_rev[i-1] = layers_branch_rev[i-1][0:p2]
-            i -= 1
-        else:
-            i -= 1
-            p1 = layers_branch_rev[i].find("=")
-            s1= layers_branch_rev[i][p1:]
-    return layers_branch_rev
-
-
-BUILDCFG_FUNCS ??= "buildcfg_vars get_layers_branch_rev buildcfg_neededvars"
-BUILDCFG_FUNCS[type] = "list"
-
-def buildcfg_vars(d):
-    statusvars = oe.data.typed_value('BUILDCFG_VARS', d)
-    for var in statusvars:
-        value = d.getVar(var)
-        if value is not None:
-            yield '%-20s = "%s"' % (var, value)
-
-def buildcfg_neededvars(d):
-    needed_vars = oe.data.typed_value("BUILDCFG_NEEDEDVARS", d)
-    pesteruser = []
-    for v in needed_vars:
-        val = d.getVar(v)
-        if not val or val == 'INVALID':
-            pesteruser.append(v)
-
-    if pesteruser:
-        bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
-
-addhandler base_eventhandler
-base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed"
-python base_eventhandler() {
-    import bb.runqueue
-
-    if isinstance(e, bb.event.ConfigParsed):
-        if not d.getVar("NATIVELSBSTRING", False):
-            d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d))
-        d.setVar("ORIGNATIVELSBSTRING", d.getVar("NATIVELSBSTRING", False))
-        d.setVar('BB_VERSION', bb.__version__)
-
-    # There might be no bb.event.ConfigParsed event if bitbake server is
-    # running, so check bb.event.BuildStarted too to make sure ${HOSTTOOLS_DIR}
-    # exists.
-    if isinstance(e, bb.event.ConfigParsed) or \
-            (isinstance(e, bb.event.BuildStarted) and not os.path.exists(d.getVar('HOSTTOOLS_DIR'))):
-        # Works with the line in layer.conf which changes PATH to point here
-        setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS', d)
-        setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS_NONFATAL', d, fatal=False)
-
-    if isinstance(e, bb.event.MultiConfigParsed):
-        # We need to expand SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS in each of the multiconfig data stores
-        # own contexts so the variables get expanded correctly for that arch, then inject back into
-        # the main data store.
-        deps = []
-        for config in e.mcdata:
-            deps.append(e.mcdata[config].getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS"))
-        deps = " ".join(deps)
-        e.mcdata[''].setVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS", deps)
-
-    if isinstance(e, bb.event.BuildStarted):
-        localdata = bb.data.createCopy(d)
-        statuslines = []
-        for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata):
-            g = globals()
-            if func not in g:
-                bb.warn("Build configuration function '%s' does not exist" % func)
-            else:
-                flines = g[func](localdata)
-                if flines:
-                    statuslines.extend(flines)
-
-        statusheader = d.getVar('BUILDCFG_HEADER')
-        if statusheader:
-            bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
-
-    # This code is to silence warnings where the SDK variables overwrite the 
-    # target ones and we'd see dulpicate key names overwriting each other
-    # for various PREFERRED_PROVIDERS
-    if isinstance(e, bb.event.RecipePreFinalise):
-        if d.getVar("TARGET_PREFIX") == d.getVar("SDK_PREFIX"):
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils")
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc")
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++")
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs")
-
-    if isinstance(e, bb.event.RecipeParsed):
-        #
-        # If we have multiple providers of virtual/X and a PREFERRED_PROVIDER_virtual/X is set
-        # skip parsing for all the other providers which will mean they get uninstalled from the
-        # sysroot since they're now "unreachable". This makes switching virtual/kernel work in 
-        # particular.
-        #
-        pn = d.getVar('PN')
-        source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False)
-        if not source_mirror_fetch:
-            provs = (d.getVar("PROVIDES") or "").split()
-            multiprovidersallowed = (d.getVar("BB_MULTI_PROVIDER_ALLOWED") or "").split()
-            for p in provs:
-                if p.startswith("virtual/") and p not in multiprovidersallowed:
-                    profprov = d.getVar("PREFERRED_PROVIDER_" + p)
-                    if profprov and pn != profprov:
-                        raise bb.parse.SkipRecipe("PREFERRED_PROVIDER_%s set to %s, not %s" % (p, profprov, pn))
-}
-
-CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
-CLEANBROKEN = "0"
-
-addtask configure after do_patch
-do_configure[dirs] = "${B}"
-base_do_configure() {
-	if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
-		if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
-			cd ${B}
-			if [ "${CLEANBROKEN}" != "1" -a \( -e Makefile -o -e makefile -o -e GNUmakefile \) ]; then
-				oe_runmake clean
-			fi
-			# -ignore_readdir_race does not work correctly with -delete;
-			# use xargs to avoid spurious build failures
-			find ${B} -ignore_readdir_race -name \*.la -type f -print0 | xargs -0 rm -f
-		fi
-	fi
-	if [ -n "${CONFIGURESTAMPFILE}" ]; then
-		mkdir -p `dirname ${CONFIGURESTAMPFILE}`
-		echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
-	fi
-}
-
-addtask compile after do_configure
-do_compile[dirs] = "${B}"
-base_do_compile() {
-	if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
-		oe_runmake || die "make failed"
-	else
-		bbnote "nothing to compile"
-	fi
-}
-
-addtask install after do_compile
-do_install[dirs] = "${B}"
-# Remove and re-create ${D} so that is it guaranteed to be empty
-do_install[cleandirs] = "${D}"
-
-base_do_install() {
-	:
-}
-
-base_do_package() {
-	:
-}
-
-addtask build after do_populate_sysroot
-do_build[noexec] = "1"
-do_build[recrdeptask] += "do_deploy"
-do_build () {
-	:
-}
-
-def set_packagetriplet(d):
-    archs = []
-    tos = []
-    tvs = []
-
-    archs.append(d.getVar("PACKAGE_ARCHS").split())
-    tos.append(d.getVar("TARGET_OS"))
-    tvs.append(d.getVar("TARGET_VENDOR"))
-
-    def settriplet(d, varname, archs, tos, tvs):
-        triplets = []
-        for i in range(len(archs)):
-            for arch in archs[i]:
-                triplets.append(arch + tvs[i] + "-" + tos[i])
-        triplets.reverse()
-        d.setVar(varname, " ".join(triplets))
-
-    settriplet(d, "PKGTRIPLETS", archs, tos, tvs)
-
-    variants = d.getVar("MULTILIB_VARIANTS") or ""
-    for item in variants.split():
-        localdata = bb.data.createCopy(d)
-        overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
-        localdata.setVar("OVERRIDES", overrides)
-
-        archs.append(localdata.getVar("PACKAGE_ARCHS").split())
-        tos.append(localdata.getVar("TARGET_OS"))
-        tvs.append(localdata.getVar("TARGET_VENDOR"))
-
-    settriplet(d, "PKGMLTRIPLETS", archs, tos, tvs)
-
-python () {
-    import string, re
-
-    # Handle backfilling
-    oe.utils.features_backfill("DISTRO_FEATURES", d)
-    oe.utils.features_backfill("MACHINE_FEATURES", d)
-
-    if d.getVar("S")[-1] == '/':
-        bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S")))
-    if d.getVar("B")[-1] == '/':
-        bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B")))
-
-    if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")):
-        d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}")
-    if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")):
-        d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}")
-
-    # To add a recipe to the skip list , set:
-    #   SKIP_RECIPE[pn] = "message"
-    pn = d.getVar('PN')
-    skip_msg = d.getVarFlag('SKIP_RECIPE', pn)
-    if skip_msg:
-        bb.debug(1, "Skipping %s %s" % (pn, skip_msg))
-        raise bb.parse.SkipRecipe("Recipe will be skipped because: %s" % (skip_msg))
-
-    # Handle PACKAGECONFIG
-    #
-    # These take the form:
-    #
-    # PACKAGECONFIG ??= "<default options>"
-    # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends,foo_runtime_recommends,foo_conflict_packageconfig"
-    pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
-    if pkgconfigflags:
-        pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
-        pn = d.getVar("PN")
-
-        mlprefix = d.getVar("MLPREFIX")
-
-        def expandFilter(appends, extension, prefix):
-            appends = bb.utils.explode_deps(d.expand(" ".join(appends)))
-            newappends = []
-            for a in appends:
-                if a.endswith("-native") or ("-cross-" in a):
-                    newappends.append(a)
-                elif a.startswith("virtual/"):
-                    subs = a.split("/", 1)[1]
-                    if subs.startswith(prefix):
-                        newappends.append(a + extension)
-                    else:
-                        newappends.append("virtual/" + prefix + subs + extension)
-                else:
-                    if a.startswith(prefix):
-                        newappends.append(a + extension)
-                    else:
-                        newappends.append(prefix + a + extension)
-            return newappends
-
-        def appendVar(varname, appends):
-            if not appends:
-                return
-            if varname.find("DEPENDS") != -1:
-                if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d) :
-                    appends = expandFilter(appends, "", "nativesdk-")
-                elif bb.data.inherits_class('native', d):
-                    appends = expandFilter(appends, "-native", "")
-                elif mlprefix:
-                    appends = expandFilter(appends, "", mlprefix)
-            varname = d.expand(varname)
-            d.appendVar(varname, " " + " ".join(appends))
-
-        extradeps = []
-        extrardeps = []
-        extrarrecs = []
-        extraconf = []
-        for flag, flagval in sorted(pkgconfigflags.items()):
-            items = flagval.split(",")
-            num = len(items)
-            if num > 6:
-                bb.error("%s: PACKAGECONFIG[%s] Only enable,disable,depend,rdepend,rrecommend,conflict_packageconfig can be specified!"
-                    % (d.getVar('PN'), flag))
-
-            if flag in pkgconfig:
-                if num >= 3 and items[2]:
-                    extradeps.append(items[2])
-                if num >= 4 and items[3]:
-                    extrardeps.append(items[3])
-                if num >= 5 and items[4]:
-                    extrarrecs.append(items[4])
-                if num >= 1 and items[0]:
-                    extraconf.append(items[0])
-            elif num >= 2 and items[1]:
-                    extraconf.append(items[1])
-
-            if num >= 6 and items[5]:
-                conflicts = set(items[5].split())
-                invalid = conflicts.difference(set(pkgconfigflags.keys()))
-                if invalid:
-                    bb.error("%s: PACKAGECONFIG[%s] Invalid conflict package config%s '%s' specified."
-                        % (d.getVar('PN'), flag, 's' if len(invalid) > 1 else '', ' '.join(invalid)))
-
-                if flag in pkgconfig:
-                    intersec = conflicts.intersection(set(pkgconfig))
-                    if intersec:
-                        bb.fatal("%s: PACKAGECONFIG[%s] Conflict package config%s '%s' set in PACKAGECONFIG."
-                            % (d.getVar('PN'), flag, 's' if len(intersec) > 1 else '', ' '.join(intersec)))
-
-        appendVar('DEPENDS', extradeps)
-        appendVar('RDEPENDS:${PN}', extrardeps)
-        appendVar('RRECOMMENDS:${PN}', extrarrecs)
-        appendVar('PACKAGECONFIG_CONFARGS', extraconf)
-
-    pn = d.getVar('PN')
-    license = d.getVar('LICENSE')
-    if license == "INVALID" and pn != "defaultpkgname":
-        bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn)
-
-    if bb.data.inherits_class('license', d):
-        check_license_format(d)
-        unmatched_license_flags = check_license_flags(d)
-        if unmatched_license_flags:
-            if len(unmatched_license_flags) == 1:
-                message = "because it has a restricted license '{0}'. Which is not listed in LICENSE_FLAGS_ACCEPTED".format(unmatched_license_flags[0])
-            else:
-                message = "because it has restricted licenses {0}. Which are not listed in LICENSE_FLAGS_ACCEPTED".format(
-                    ", ".join("'{0}'".format(f) for f in unmatched_license_flags))
-            bb.debug(1, "Skipping %s %s" % (pn, message))
-            raise bb.parse.SkipRecipe(message)
-
-    # If we're building a target package we need to use fakeroot (pseudo)
-    # in order to capture permissions, owners, groups and special files
-    if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
-        d.appendVarFlag('do_prepare_recipe_sysroot', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
-        d.appendVarFlag('do_install', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
-        d.setVarFlag('do_install', 'fakeroot', '1')
-        d.appendVarFlag('do_package', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
-        d.setVarFlag('do_package', 'fakeroot', '1')
-        d.setVarFlag('do_package_setscene', 'fakeroot', '1')
-        d.appendVarFlag('do_package_setscene', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
-        d.setVarFlag('do_devshell', 'fakeroot', '1')
-        d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
-
-    need_machine = d.getVar('COMPATIBLE_MACHINE')
-    if need_machine and not d.getVar('PARSE_ALL_RECIPES', False):
-        import re
-        compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":")
-        for m in compat_machines:
-            if re.match(need_machine, m):
-                break
-        else:
-            raise bb.parse.SkipRecipe("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % d.getVar('MACHINE'))
-
-    source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) or d.getVar('PARSE_ALL_RECIPES', False)
-    if not source_mirror_fetch:
-        need_host = d.getVar('COMPATIBLE_HOST')
-        if need_host:
-            import re
-            this_host = d.getVar('HOST_SYS')
-            if not re.match(need_host, this_host):
-                raise bb.parse.SkipRecipe("incompatible with host %s (not in COMPATIBLE_HOST)" % this_host)
-
-        bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
-
-        check_license = False if pn.startswith("nativesdk-") else True
-        for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}",
-              "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}",
-              "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]:
-            if pn.endswith(d.expand(t)):
-                check_license = False
-        if pn.startswith("gcc-source-"):
-            check_license = False
-
-        if check_license and bad_licenses:
-            bad_licenses = expand_wildcard_licenses(d, bad_licenses)
-
-            exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split()
-
-            for lic_exception in exceptions:
-                if ":" in lic_exception:
-                    lic_exception = lic_exception.split(":")[1]
-                if lic_exception in oe.license.obsolete_license_list():
-                    bb.fatal("Obsolete license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception)
-
-            pkgs = d.getVar('PACKAGES').split()
-            skipped_pkgs = {}
-            unskipped_pkgs = []
-            for pkg in pkgs:
-                remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions)
-
-                incompatible_lic = incompatible_license(d, remaining_bad_licenses, pkg)
-                if incompatible_lic:
-                    skipped_pkgs[pkg] = incompatible_lic
-                else:
-                    unskipped_pkgs.append(pkg)
-
-            if unskipped_pkgs:
-                for pkg in skipped_pkgs:
-                    bb.debug(1, "Skipping the package %s at do_rootfs because of incompatible license(s): %s" % (pkg, ' '.join(skipped_pkgs[pkg])))
-                    d.setVar('_exclude_incompatible-' + pkg, ' '.join(skipped_pkgs[pkg]))
-                for pkg in unskipped_pkgs:
-                    bb.debug(1, "Including the package %s" % pkg)
-            else:
-                incompatible_lic = incompatible_license(d, bad_licenses)
-                for pkg in skipped_pkgs:
-                    incompatible_lic += skipped_pkgs[pkg]
-                incompatible_lic = sorted(list(set(incompatible_lic)))
-
-                if incompatible_lic:
-                    bb.debug(1, "Skipping recipe %s because of incompatible license(s): %s" % (pn, ' '.join(incompatible_lic)))
-                    raise bb.parse.SkipRecipe("it has incompatible license(s): %s" % ' '.join(incompatible_lic))
-
-    needsrcrev = False
-    srcuri = d.getVar('SRC_URI')
-    for uri_string in srcuri.split():
-        uri = bb.fetch.URI(uri_string)
-        # Also check downloadfilename as the URL path might not be useful for sniffing
-        path = uri.params.get("downloadfilename", uri.path)
-
-        # HTTP/FTP use the wget fetcher
-        if uri.scheme in ("http", "https", "ftp"):
-            d.appendVarFlag('do_fetch', 'depends', ' wget-native:do_populate_sysroot')
-
-        # Svn packages should DEPEND on subversion-native
-        if uri.scheme == "svn":
-            needsrcrev = True
-            d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot')
-
-        # Git packages should DEPEND on git-native
-        elif uri.scheme in ("git", "gitsm"):
-            needsrcrev = True
-            d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot')
-
-        # Mercurial packages should DEPEND on mercurial-native
-        elif uri.scheme == "hg":
-            needsrcrev = True
-            d.appendVar("EXTRANATIVEPATH", ' python3-native ')
-            d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot')
-
-        # Perforce packages support SRCREV = "${AUTOREV}"
-        elif uri.scheme == "p4":
-            needsrcrev = True
-
-        # OSC packages should DEPEND on osc-native
-        elif uri.scheme == "osc":
-            d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot')
-
-        elif uri.scheme == "npm":
-            d.appendVarFlag('do_fetch', 'depends', ' nodejs-native:do_populate_sysroot')
-
-        elif uri.scheme == "repo":
-            needsrcrev = True
-            d.appendVarFlag('do_fetch', 'depends', ' repo-native:do_populate_sysroot')
-
-        # *.lz4 should DEPEND on lz4-native for unpacking
-        if path.endswith('.lz4'):
-            d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot')
-
-        # *.zst should DEPEND on zstd-native for unpacking
-        elif path.endswith('.zst'):
-            d.appendVarFlag('do_unpack', 'depends', ' zstd-native:do_populate_sysroot')
-
-        # *.lz should DEPEND on lzip-native for unpacking
-        elif path.endswith('.lz'):
-            d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot')
-
-        # *.xz should DEPEND on xz-native for unpacking
-        elif path.endswith('.xz') or path.endswith('.txz'):
-            d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
-
-        # .zip should DEPEND on unzip-native for unpacking
-        elif path.endswith('.zip') or path.endswith('.jar'):
-            d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot')
-
-        # Some rpm files may be compressed internally using xz (for example, rpms from Fedora)
-        elif path.endswith('.rpm'):
-            d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
-
-        # *.deb should DEPEND on xz-native for unpacking
-        elif path.endswith('.deb'):
-            d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
-
-    if needsrcrev:
-        d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
-
-        # Gather all named SRCREVs to add to the sstate hash calculation
-        # This anonymous python snippet is called multiple times so we
-        # need to be careful to not double up the appends here and cause
-        # the base hash to mismatch the task hash
-        for uri in srcuri.split():
-            parm = bb.fetch.decodeurl(uri)[5]
-            uri_names = parm.get("name", "").split(",")
-            for uri_name in filter(None, uri_names):
-                srcrev_name = "SRCREV_{}".format(uri_name)
-                if srcrev_name not in (d.getVarFlag("do_fetch", "vardeps") or "").split():
-                    d.appendVarFlag("do_fetch", "vardeps", " {}".format(srcrev_name))
-
-    set_packagetriplet(d)
-
-    # 'multimachine' handling
-    mach_arch = d.getVar('MACHINE_ARCH')
-    pkg_arch = d.getVar('PACKAGE_ARCH')
-
-    if (pkg_arch == mach_arch):
-        # Already machine specific - nothing further to do
-        return
-
-    #
-    # We always try to scan SRC_URI for urls with machine overrides
-    # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0
-    #
-    override = d.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH')
-    if override != '0':
-        paths = []
-        fpaths = (d.getVar('FILESPATH') or '').split(':')
-        machine = d.getVar('MACHINE')
-        for p in fpaths:
-            if os.path.basename(p) == machine and os.path.isdir(p):
-                paths.append(p)
-
-        if paths:
-            for s in srcuri.split():
-                if not s.startswith("file://"):
-                    continue
-                fetcher = bb.fetch2.Fetch([s], d)
-                local = fetcher.localpath(s)
-                for mp in paths:
-                    if local.startswith(mp):
-                        #bb.note("overriding PACKAGE_ARCH from %s to %s for %s" % (pkg_arch, mach_arch, pn))
-                        d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
-                        return
-
-    packages = d.getVar('PACKAGES').split()
-    for pkg in packages:
-        pkgarch = d.getVar("PACKAGE_ARCH_%s" % pkg)
-
-        # We could look for != PACKAGE_ARCH here but how to choose
-        # if multiple differences are present?
-        # Look through PACKAGE_ARCHS for the priority order?
-        if pkgarch and pkgarch == mach_arch:
-            d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
-            bb.warn("Recipe %s is marked as only being architecture specific but seems to have machine specific packages?! The recipe may as well mark itself as machine specific directly." % d.getVar("PN"))
-}
-
-addtask cleansstate after do_clean
-python do_cleansstate() {
-        sstate_clean_cachefiles(d)
-}
-addtask cleanall after do_cleansstate
-do_cleansstate[nostamp] = "1"
-
-python do_cleanall() {
-    src_uri = (d.getVar('SRC_URI') or "").split()
-    if not src_uri:
-        return
-
-    try:
-        fetcher = bb.fetch2.Fetch(src_uri, d)
-        fetcher.clean()
-    except bb.fetch2.BBFetchException as e:
-        bb.fatal(str(e))
-}
-do_cleanall[nostamp] = "1"
-
-
-EXPORT_FUNCTIONS do_fetch do_unpack do_configure do_compile do_install do_package
diff --git a/poky/meta/classes/bash-completion.bbclass b/poky/meta/classes/bash-completion.bbclass
deleted file mode 100644
index 803b2ca..0000000
--- a/poky/meta/classes/bash-completion.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-DEPENDS:append:class-target = " bash-completion"
-
-PACKAGES += "${PN}-bash-completion"
-
-FILES:${PN}-bash-completion = "${datadir}/bash-completion ${sysconfdir}/bash_completion.d"
-
-RDEPENDS:${PN}-bash-completion = "bash-completion"
diff --git a/poky/meta/classes/bin_package.bbclass b/poky/meta/classes/bin_package.bbclass
deleted file mode 100644
index f0407e1..0000000
--- a/poky/meta/classes/bin_package.bbclass
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# Common variable and task for the binary package recipe.
-# Basic principle:
-# * The files have been unpacked to ${S} by base.bbclass
-# * Skip do_configure and do_compile
-# * Use do_install to install the files to ${D}
-#
-# Note:
-# The "subdir" parameter in the SRC_URI is useful when the input package
-# is rpm, ipk, deb and so on, for example:
-#
-# SRC_URI = "http://foo.com/foo-1.0-r1.i586.rpm;subdir=foo-1.0"
-#
-# Then the files would be unpacked to ${WORKDIR}/foo-1.0, otherwise
-# they would be in ${WORKDIR}.
-#
-
-# Skip the unwanted steps
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-
-# Install the files to ${D}
-bin_package_do_install () {
-    # Do it carefully
-    [ -d "${S}" ] || exit 1
-    if [ -z "$(ls -A ${S})" ]; then
-        bbfatal bin_package has nothing to install. Be sure the SRC_URI unpacks into S.
-    fi
-    cd ${S}
-    install -d ${D}${base_prefix}
-    tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - . \
-        | tar --no-same-owner -xpf - -C ${D}${base_prefix}
-}
-
-FILES:${PN} = "/"
-
-EXPORT_FUNCTIONS do_install
diff --git a/poky/meta/classes/binconfig-disabled.bbclass b/poky/meta/classes/binconfig-disabled.bbclass
deleted file mode 100644
index e8ac41b..0000000
--- a/poky/meta/classes/binconfig-disabled.bbclass
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Class to disable binconfig files instead of installing them
-#
-
-# The list of scripts which should be disabled.
-BINCONFIG ?= ""
-
-FILES:${PN}-dev += "${bindir}/*-config"
-
-do_install:append () {
-	for x in ${BINCONFIG}; do
-		# Make the disabled script emit invalid parameters for those configure
-		# scripts which call it without checking the return code.
-		echo "#!/bin/sh" > ${D}$x
-		echo "echo 'ERROR: $x should not be used, use an alternative such as pkg-config' >&2" >> ${D}$x
-		echo "echo '--should-not-have-used-$x'" >> ${D}$x
-		echo "exit 1" >> ${D}$x
-		chmod +x ${D}$x
-	done
-}
-
-SYSROOT_PREPROCESS_FUNCS += "binconfig_disabled_sysroot_preprocess"
-
-binconfig_disabled_sysroot_preprocess () {
-	for x in ${BINCONFIG}; do
-		configname=`basename $x`
-		install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
-		install ${D}$x ${SYSROOT_DESTDIR}${bindir_crossscripts}
-	done
-}
diff --git a/poky/meta/classes/binconfig.bbclass b/poky/meta/classes/binconfig.bbclass
deleted file mode 100644
index 6e0c882..0000000
--- a/poky/meta/classes/binconfig.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-FILES:${PN}-dev += "${bindir}/*-config"
- 
-# The namespaces can clash here hence the two step replace
-def get_binconfig_mangle(d):
-    s = "-e ''"
-    if not bb.data.inherits_class('native', d):
-        optional_quote = r"\(\"\?\)"
-        s += " -e 's:=%s${base_libdir}:=\\1OEBASELIBDIR:;'" % optional_quote
-        s += " -e 's:=%s${libdir}:=\\1OELIBDIR:;'" % optional_quote
-        s += " -e 's:=%s${includedir}:=\\1OEINCDIR:;'" % optional_quote
-        s += " -e 's:=%s${datadir}:=\\1OEDATADIR:'" % optional_quote
-        s += " -e 's:=%s${prefix}/:=\\1OEPREFIX/:'" % optional_quote
-        s += " -e 's:=%s${exec_prefix}/:=\\1OEEXECPREFIX/:'" % optional_quote
-        s += " -e 's:-L${libdir}:-LOELIBDIR:;'"
-        s += " -e 's:-I${includedir}:-IOEINCDIR:;'"
-        s += " -e 's:-L${WORKDIR}:-LOELIBDIR:'"
-        s += " -e 's:-I${WORKDIR}:-IOEINCDIR:'"
-        s += " -e 's:OEBASELIBDIR:${STAGING_BASELIBDIR}:;'"
-        s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'"
-        s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'"
-        s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'"
-        s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${prefix}:'"
-        s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${exec_prefix}:'"
-        if d.getVar("OE_BINCONFIG_EXTRA_MANGLE", False):
-            s += d.getVar("OE_BINCONFIG_EXTRA_MANGLE")
-
-    return s
-
-BINCONFIG_GLOB ?= "*-config"
-
-PACKAGE_PREPROCESS_FUNCS += "binconfig_package_preprocess"
-
-binconfig_package_preprocess () {
-	for config in `find ${PKGD} -type f -name '${BINCONFIG_GLOB}'`; do
-		sed -i \
-		    -e 's:${STAGING_BASELIBDIR}:${base_libdir}:g;' \
-		    -e 's:${STAGING_LIBDIR}:${libdir}:g;' \
-		    -e 's:${STAGING_INCDIR}:${includedir}:g;' \
-		    -e 's:${STAGING_DATADIR}:${datadir}:' \
-		    -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \
-                    $config
-	done
-}
-
-SYSROOT_PREPROCESS_FUNCS += "binconfig_sysroot_preprocess"
-
-binconfig_sysroot_preprocess () {
-	for config in `find ${S} -type f -name '${BINCONFIG_GLOB}'` `find ${B} -type f -name '${BINCONFIG_GLOB}'`; do
-		configname=`basename $config`
-		install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
-		sed ${@get_binconfig_mangle(d)} $config > ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname
-		chmod u+x ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname
-	done
-}
diff --git a/poky/meta/classes/buildhistory.bbclass b/poky/meta/classes/buildhistory.bbclass
index 4ba9ec8..395f594 100644
--- a/poky/meta/classes/buildhistory.bbclass
+++ b/poky/meta/classes/buildhistory.bbclass
@@ -6,8 +6,10 @@
 # Copyright (C) 2011-2016 Intel Corporation
 # Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org>
 #
+# SPDX-License-Identifier: MIT
+#
 
-inherit image-artifact-names
+IMAGE_CLASSES += "image-artifact-names"
 
 BUILDHISTORY_FEATURES ?= "image package sdk"
 BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory"
diff --git a/poky/meta/classes/buildstats-summary.bbclass b/poky/meta/classes/buildstats-summary.bbclass
index f9b241b..12e8f17 100644
--- a/poky/meta/classes/buildstats-summary.bbclass
+++ b/poky/meta/classes/buildstats-summary.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Summarize sstate usage at the end of the build
 python buildstats_summary () {
     import collections
diff --git a/poky/meta/classes/buildstats.bbclass b/poky/meta/classes/buildstats.bbclass
deleted file mode 100644
index 132ecaa..0000000
--- a/poky/meta/classes/buildstats.bbclass
+++ /dev/null
@@ -1,296 +0,0 @@
-BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
-
-################################################################################
-# Build statistics gathering.
-#
-# The CPU and Time gathering/tracking functions and bbevent inspiration
-# were written by Christopher Larson.
-#
-################################################################################
-
-def get_buildprocess_cputime(pid):
-    with open("/proc/%d/stat" % pid, "r") as f:
-        fields = f.readline().rstrip().split()
-    # 13: utime, 14: stime, 15: cutime, 16: cstime
-    return sum(int(field) for field in fields[13:16])
-
-def get_process_cputime(pid):
-    import resource
-    with open("/proc/%d/stat" % pid, "r") as f:
-        fields = f.readline().rstrip().split()
-    stats = { 
-        'utime'  : fields[13],
-        'stime'  : fields[14], 
-        'cutime' : fields[15], 
-        'cstime' : fields[16],  
-    }
-    iostats = {}
-    if os.path.isfile("/proc/%d/io" % pid):
-        with open("/proc/%d/io" % pid, "r") as f:
-            while True:
-                i = f.readline().strip()
-                if not i:
-                    break
-                if not ":" in i:
-                    # one more extra line is appended (empty or containing "0")
-                    # most probably due to race condition in kernel while
-                    # updating IO stats
-                    break
-                i = i.split(": ")
-                iostats[i[0]] = i[1]
-    resources = resource.getrusage(resource.RUSAGE_SELF)
-    childres = resource.getrusage(resource.RUSAGE_CHILDREN)
-    return stats, iostats, resources, childres
-
-def get_cputime():
-    with open("/proc/stat", "r") as f:
-        fields = f.readline().rstrip().split()[1:]
-    return sum(int(field) for field in fields)
-
-def set_timedata(var, d, server_time):
-    d.setVar(var, server_time)
-
-def get_timedata(var, d, end_time):
-    oldtime = d.getVar(var, False)
-    if oldtime is None:
-        return
-    return end_time - oldtime
-
-def set_buildtimedata(var, d):
-    import time
-    time = time.time()
-    cputime = get_cputime()
-    proctime = get_buildprocess_cputime(os.getpid())
-    d.setVar(var, (time, cputime, proctime))
-
-def get_buildtimedata(var, d):
-    import time
-    timedata = d.getVar(var, False)
-    if timedata is None:
-        return
-    oldtime, oldcpu, oldproc = timedata
-    procdiff = get_buildprocess_cputime(os.getpid()) - oldproc
-    cpudiff = get_cputime() - oldcpu
-    end_time = time.time()
-    timediff = end_time - oldtime
-    if cpudiff > 0:
-        cpuperc = float(procdiff) * 100 / cpudiff
-    else:
-        cpuperc = None
-    return timediff, cpuperc
-
-def write_task_data(status, logfile, e, d):
-    with open(os.path.join(logfile), "a") as f:
-        elapsedtime = get_timedata("__timedata_task", d, e.time)
-        if elapsedtime:
-            f.write(d.expand("${PF}: %s\n" % e.task))
-            f.write(d.expand("Elapsed time: %0.2f seconds\n" % elapsedtime))
-            cpu, iostats, resources, childres = get_process_cputime(os.getpid())
-            if cpu:
-                f.write("utime: %s\n" % cpu['utime'])
-                f.write("stime: %s\n" % cpu['stime'])
-                f.write("cutime: %s\n" % cpu['cutime'])
-                f.write("cstime: %s\n" % cpu['cstime'])
-            for i in iostats:
-                f.write("IO %s: %s\n" % (i, iostats[i]))
-            rusages = ["ru_utime", "ru_stime", "ru_maxrss", "ru_minflt", "ru_majflt", "ru_inblock", "ru_oublock", "ru_nvcsw", "ru_nivcsw"]
-            for i in rusages:
-                f.write("rusage %s: %s\n" % (i, getattr(resources, i)))
-            for i in rusages:
-                f.write("Child rusage %s: %s\n" % (i, getattr(childres, i)))
-        if status == "passed":
-            f.write("Status: PASSED \n")
-        else:
-            f.write("Status: FAILED \n")
-        f.write("Ended: %0.2f \n" % e.time)
-
-def write_host_data(logfile, e, d, type):
-    import subprocess, os, datetime
-    # minimum time allowed for each command to run, in seconds
-    time_threshold = 0.5
-    limit = 10
-    # the total number of commands
-    num_cmds = 0
-    msg = ""
-    if type == "interval":
-        # interval at which data will be logged
-        interval = d.getVar("BB_HEARTBEAT_EVENT", False)
-        if interval is None:
-            bb.warn("buildstats: Collecting host data at intervals failed. Set BB_HEARTBEAT_EVENT=\"<interval>\" in conf/local.conf for the interval at which host data will be logged.")
-            d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
-            return
-        interval = int(interval)
-        cmds = d.getVar('BB_LOG_HOST_STAT_CMDS_INTERVAL')
-        msg = "Host Stats: Collecting data at %d second intervals.\n" % interval
-        if cmds is None:
-            d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
-            bb.warn("buildstats: Collecting host data at intervals failed. Set BB_LOG_HOST_STAT_CMDS_INTERVAL=\"command1 ; command2 ; ... \" in conf/local.conf.")
-            return
-    if type == "failure":
-        cmds = d.getVar('BB_LOG_HOST_STAT_CMDS_FAILURE')
-        msg = "Host Stats: Collecting data on failure.\n"
-        msg += "Failed at task: " + e.task + "\n"
-        if cmds is None:
-            d.setVar("BB_LOG_HOST_STAT_ON_FAILURE", "0")
-            bb.warn("buildstats: Collecting host data on failure failed. Set BB_LOG_HOST_STAT_CMDS_FAILURE=\"command1 ; command2 ; ... \" in conf/local.conf.")
-            return
-    c_san = []
-    for cmd in cmds.split(";"):
-        if len(cmd) == 0:
-            continue
-        num_cmds += 1
-        c_san.append(cmd)
-    if num_cmds == 0:
-        if type == "interval":
-            d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
-        if type == "failure":
-            d.setVar("BB_LOG_HOST_STAT_ON_FAILURE", "0")
-        return
-
-    # return if the interval is not enough to run all commands within the specified BB_HEARTBEAT_EVENT interval
-    if type == "interval":
-        limit = interval / num_cmds
-        if limit <= time_threshold:
-            d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
-            bb.warn("buildstats: Collecting host data failed. BB_HEARTBEAT_EVENT interval not enough to run the specified commands. Increase value of BB_HEARTBEAT_EVENT in conf/local.conf.")
-            return
-
-    # set the environment variables 
-    path = d.getVar("PATH")
-    opath = d.getVar("BB_ORIGENV", False).getVar("PATH")
-    ospath = os.environ['PATH']
-    os.environ['PATH'] = path + ":" + opath + ":" + ospath
-    with open(logfile, "a") as f:
-        f.write("Event Time: %f\nDate: %s\n" % (e.time, datetime.datetime.now()))
-        f.write("%s" % msg)
-        for c in c_san:
-            try:
-                output = subprocess.check_output(c.split(), stderr=subprocess.STDOUT, timeout=limit).decode('utf-8')
-            except (subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError) as err:
-                output = "Error running command: %s\n%s\n" % (c, err)
-            f.write("%s\n%s\n" % (c, output))
-    # reset the environment
-    os.environ['PATH'] = ospath
-
-python run_buildstats () {
-    import bb.build
-    import bb.event
-    import time, subprocess, platform
-
-    bn = d.getVar('BUILDNAME')
-    ########################################################################
-    # bitbake fires HeartbeatEvent even before a build has been
-    # triggered, causing BUILDNAME to be None
-    ########################################################################
-    if bn is not None:
-        bsdir = os.path.join(d.getVar('BUILDSTATS_BASE'), bn)
-        taskdir = os.path.join(bsdir, d.getVar('PF'))
-        if isinstance(e, bb.event.HeartbeatEvent) and bb.utils.to_boolean(d.getVar("BB_LOG_HOST_STAT_ON_INTERVAL")):
-            bb.utils.mkdirhier(bsdir)
-            write_host_data(os.path.join(bsdir, "host_stats_interval"), e, d, "interval")
-
-    if isinstance(e, bb.event.BuildStarted):
-        ########################################################################
-        # If the kernel was not configured to provide I/O statistics, issue
-        # a one time warning.
-        ########################################################################
-        if not os.path.isfile("/proc/%d/io" % os.getpid()):
-            bb.warn("The Linux kernel on your build host was not configured to provide process I/O statistics. (CONFIG_TASK_IO_ACCOUNTING is not set)")
-
-        ########################################################################
-        # at first pass make the buildstats hierarchy and then
-        # set the buildname
-        ########################################################################
-        bb.utils.mkdirhier(bsdir)
-        set_buildtimedata("__timedata_build", d)
-        build_time = os.path.join(bsdir, "build_stats")
-        # write start of build into build_time
-        with open(build_time, "a") as f:
-            host_info = platform.uname()
-            f.write("Host Info: ")
-            for x in host_info:
-                if x:
-                    f.write(x + " ")
-            f.write("\n")
-            f.write("Build Started: %0.2f \n" % d.getVar('__timedata_build', False)[0])
-
-    elif isinstance(e, bb.event.BuildCompleted):
-        build_time = os.path.join(bsdir, "build_stats")
-        with open(build_time, "a") as f:
-            ########################################################################
-            # Write build statistics for the build
-            ########################################################################
-            timedata = get_buildtimedata("__timedata_build", d)
-            if timedata:
-                time, cpu = timedata
-                # write end of build and cpu used into build_time
-                f.write("Elapsed time: %0.2f seconds \n" % (time))
-                if cpu:
-                    f.write("CPU usage: %0.1f%% \n" % cpu)
-
-    if isinstance(e, bb.build.TaskStarted):
-        set_timedata("__timedata_task", d, e.time)
-        bb.utils.mkdirhier(taskdir)
-        # write into the task event file the name and start time
-        with open(os.path.join(taskdir, e.task), "a") as f:
-            f.write("Event: %s \n" % bb.event.getName(e))
-            f.write("Started: %0.2f \n" % e.time)
-
-    elif isinstance(e, bb.build.TaskSucceeded):
-        write_task_data("passed", os.path.join(taskdir, e.task), e, d)
-        if e.task == "do_rootfs":
-            bs = os.path.join(bsdir, "build_stats")
-            with open(bs, "a") as f:
-                rootfs = d.getVar('IMAGE_ROOTFS')
-                if os.path.isdir(rootfs):
-                    try:
-                        rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
-                                stderr=subprocess.STDOUT).decode('utf-8')
-                        f.write("Uncompressed Rootfs size: %s" % rootfs_size)
-                    except subprocess.CalledProcessError as err:
-                        bb.warn("Failed to get rootfs size: %s" % err.output.decode('utf-8'))
-
-    elif isinstance(e, bb.build.TaskFailed):
-        # Can have a failure before TaskStarted so need to mkdir here too
-        bb.utils.mkdirhier(taskdir)
-        write_task_data("failed", os.path.join(taskdir, e.task), e, d)
-        ########################################################################
-        # Lets make things easier and tell people where the build failed in
-        # build_status. We do this here because BuildCompleted triggers no
-        # matter what the status of the build actually is
-        ########################################################################
-        build_status = os.path.join(bsdir, "build_stats")
-        with open(build_status, "a") as f:
-            f.write(d.expand("Failed at: ${PF} at task: %s \n" % e.task))
-        if bb.utils.to_boolean(d.getVar("BB_LOG_HOST_STAT_ON_FAILURE")):
-            write_host_data(os.path.join(bsdir, "host_stats_%s_failure" % e.task), e, d, "failure")
-}
-
-addhandler run_buildstats
-run_buildstats[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.event.HeartbeatEvent bb.build.TaskStarted bb.build.TaskSucceeded bb.build.TaskFailed"
-
-python runqueue_stats () {
-    import buildstats
-    from bb import event, runqueue
-    # We should not record any samples before the first task has started,
-    # because that's the first activity shown in the process chart.
-    # Besides, at that point we are sure that the build variables
-    # are available that we need to find the output directory.
-    # The persistent SystemStats is stored in the datastore and
-    # closed when the build is done.
-    system_stats = d.getVar('_buildstats_system_stats', False)
-    if not system_stats and isinstance(e, (bb.runqueue.sceneQueueTaskStarted, bb.runqueue.runQueueTaskStarted)):
-        system_stats = buildstats.SystemStats(d)
-        d.setVar('_buildstats_system_stats', system_stats)
-    if system_stats:
-        # Ensure that we sample at important events.
-        done = isinstance(e, bb.event.BuildCompleted)
-        if system_stats.sample(e, force=done):
-            d.setVar('_buildstats_system_stats', system_stats)
-        if done:
-            system_stats.close()
-            d.delVar('_buildstats_system_stats')
-}
-
-addhandler runqueue_stats
-runqueue_stats[eventmask] = "bb.runqueue.sceneQueueTaskStarted bb.runqueue.runQueueTaskStarted bb.event.HeartbeatEvent bb.event.BuildCompleted bb.event.MonitorDiskEvent"
diff --git a/poky/meta/classes/cargo.bbclass b/poky/meta/classes/cargo.bbclass
deleted file mode 100644
index 4a780a5..0000000
--- a/poky/meta/classes/cargo.bbclass
+++ /dev/null
@@ -1,90 +0,0 @@
-##
-## Purpose:
-## This class is used by any recipes that are built using
-## Cargo.
-
-inherit cargo_common
-
-# the binary we will use
-CARGO = "cargo"
-
-# We need cargo to compile for the target
-BASEDEPENDS:append = " cargo-native"
-
-# Ensure we get the right rust variant
-DEPENDS:append:class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
-DEPENDS:append:class-nativesdk = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
-DEPENDS:append:class-native = " rust-native"
-
-# Enable build separation
-B = "${WORKDIR}/build"
-
-# In case something fails in the build process, give a bit more feedback on
-# where the issue occured
-export RUST_BACKTRACE = "1"
-
-# The directory of the Cargo.toml relative to the root directory, per default
-# assume there's a Cargo.toml directly in the root directory
-CARGO_SRC_DIR ??= ""
-
-# The actual path to the Cargo.toml
-MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
-
-RUSTFLAGS ??= ""
-BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
-
-# This is based on the content of CARGO_BUILD_FLAGS and generally will need to
-# change if CARGO_BUILD_FLAGS changes.
-BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_TARGET_SUBDIR="${HOST_SYS}/${BUILD_DIR}"
-oe_cargo_build () {
-	export RUSTFLAGS="${RUSTFLAGS}"
-	export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
-	bbnote "cargo = $(which ${CARGO})"
-	bbnote "rustc = $(which ${RUSTC})"
-	bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
-	"${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
-}
-
-do_compile[progress] = "outof:\s+(\d+)/(\d+)"
-cargo_do_compile () {
-	oe_cargo_fix_env
-	oe_cargo_build
-}
-
-cargo_do_install () {
-	local have_installed=false
-	for tgt in "${B}/target/${CARGO_TARGET_SUBDIR}/"*; do
-		case $tgt in
-		*.so|*.rlib)
-			install -d "${D}${rustlibdir}"
-			install -m755 "$tgt" "${D}${rustlibdir}"
-			have_installed=true
-			;;
-		*examples)
-			if [ -d "$tgt" ]; then
-				for example in "$tgt/"*; do
-					if [ -f "$example" ] && [ -x "$example" ]; then
-						install -d "${D}${bindir}"
-						install -m755 "$example" "${D}${bindir}"
-						have_installed=true
-					fi
-				done
-			fi
-			;;
-		*)
-			if [ -f "$tgt" ] && [ -x "$tgt" ]; then
-				install -d "${D}${bindir}"
-				install -m755 "$tgt" "${D}${bindir}"
-				have_installed=true
-			fi
-			;;
-		esac
-	done
-	if ! $have_installed; then
-		die "Did not find anything to install"
-	fi
-}
-
-EXPORT_FUNCTIONS do_compile do_install
diff --git a/poky/meta/classes/cargo_common.bbclass b/poky/meta/classes/cargo_common.bbclass
deleted file mode 100644
index 39f3282..0000000
--- a/poky/meta/classes/cargo_common.bbclass
+++ /dev/null
@@ -1,124 +0,0 @@
-##
-## Purpose:
-## This class is to support building with cargo. It
-## must be different than cargo.bbclass because Rust
-## now builds with Cargo but cannot use cargo.bbclass
-## due to dependencies and assumptions in cargo.bbclass
-## that Rust & Cargo are already installed. So this
-## is used by cargo.bbclass and Rust
-##
-
-# add crate fetch support
-inherit rust-common
-
-# Where we download our registry and dependencies to
-export CARGO_HOME = "${WORKDIR}/cargo_home"
-
-# The pkg-config-rs library used by cargo build scripts disables itself when
-# cross compiling unless this is defined. We set up pkg-config appropriately
-# for cross compilation, so tell it we know better than it.
-export PKG_CONFIG_ALLOW_CROSS = "1"
-
-# Don't instruct cargo to use crates downloaded by bitbake. Some rust packages,
-# for example the rust compiler itself, come with their own vendored sources.
-# Specifying two [source.crates-io] will not work.
-CARGO_DISABLE_BITBAKE_VENDORING ?= "0"
-
-# Used by libstd-rs to point to the vendor dir included in rustc src
-CARGO_VENDORING_DIRECTORY ?= "${CARGO_HOME}/bitbake"
-
-CARGO_RUST_TARGET_CCLD ?= "${RUST_TARGET_CCLD}"
-cargo_common_do_configure () {
-	mkdir -p ${CARGO_HOME}/bitbake
-
-	cat <<- EOF > ${CARGO_HOME}/config
-	# EXTRA_OECARGO_PATHS
-	paths = [
-	$(for p in ${EXTRA_OECARGO_PATHS}; do echo \"$p\",; done)
-	]
-	EOF
-
-	cat <<- EOF >> ${CARGO_HOME}/config
-
-	# Local mirror vendored by bitbake
-	[source.bitbake]
-	directory = "${CARGO_VENDORING_DIRECTORY}"
-	EOF
-
-	if [ ${CARGO_DISABLE_BITBAKE_VENDORING} = "0" ]; then
-		cat <<- EOF >> ${CARGO_HOME}/config
-
-		[source.crates-io]
-		replace-with = "bitbake"
-		local-registry = "/nonexistant"
-		EOF
-	fi
-
-	cat <<- EOF >> ${CARGO_HOME}/config
-
-	[http]
-	# Multiplexing can't be enabled because http2 can't be enabled
-	# in curl-native without dependency loops
-	multiplexing = false
-
-	# Ignore the hard coded and incorrect path to certificates
-	cainfo = "${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt"
-
-	EOF
-
-	cat <<- EOF >> ${CARGO_HOME}/config
-
-	# HOST_SYS
-	[target.${HOST_SYS}]
-	linker = "${CARGO_RUST_TARGET_CCLD}"
-	EOF
-
-	if [ "${HOST_SYS}" != "${BUILD_SYS}" ]; then
-		cat <<- EOF >> ${CARGO_HOME}/config
-
-		# BUILD_SYS
-		[target.${BUILD_SYS}]
-		linker = "${RUST_BUILD_CCLD}"
-		EOF
-	fi
-
-	# Put build output in build directory preferred by bitbake instead of
-	# inside source directory unless they are the same
-	if [ "${B}" != "${S}" ]; then
-		cat <<- EOF >> ${CARGO_HOME}/config
-
-		[build]
-		# Use out of tree build destination to avoid poluting the source tree
-		target-dir = "${B}/target"
-		EOF
-	fi
-
-	cat <<- EOF >> ${CARGO_HOME}/config
-
-	[term]
-	progress.when = 'always'
-	progress.width = 80
-	EOF
-}
-
-oe_cargo_fix_env () {
-	export CC="${RUST_TARGET_CC}"
-	export CXX="${RUST_TARGET_CXX}"
-	export CFLAGS="${CFLAGS}"
-	export CXXFLAGS="${CXXFLAGS}"
-	export AR="${AR}"
-	export TARGET_CC="${RUST_TARGET_CC}"
-	export TARGET_CXX="${RUST_TARGET_CXX}"
-	export TARGET_CFLAGS="${CFLAGS}"
-	export TARGET_CXXFLAGS="${CXXFLAGS}"
-	export TARGET_AR="${AR}"
-	export HOST_CC="${RUST_BUILD_CC}"
-	export HOST_CXX="${RUST_BUILD_CXX}"
-	export HOST_CFLAGS="${BUILD_CFLAGS}"
-	export HOST_CXXFLAGS="${BUILD_CXXFLAGS}"
-	export HOST_AR="${BUILD_AR}"
-}
-
-EXTRA_OECARGO_PATHS ??= ""
-
-EXPORT_FUNCTIONS do_configure
diff --git a/poky/meta/classes/ccache.bbclass b/poky/meta/classes/ccache.bbclass
index 4532894..34becb6 100644
--- a/poky/meta/classes/ccache.bbclass
+++ b/poky/meta/classes/ccache.bbclass
@@ -1,4 +1,10 @@
 #
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
 # Usage:
 # - Enable ccache
 #   Add the following line to a conffile such as conf/local.conf:
diff --git a/poky/meta/classes/ccmake.bbclass b/poky/meta/classes/ccmake.bbclass
index df5134a..c5b4bf6 100644
--- a/poky/meta/classes/ccmake.bbclass
+++ b/poky/meta/classes/ccmake.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 inherit terminal
 
 python do_ccmake() {
diff --git a/poky/meta/classes/chrpath.bbclass b/poky/meta/classes/chrpath.bbclass
index 26b984c..1aecb4d 100644
--- a/poky/meta/classes/chrpath.bbclass
+++ b/poky/meta/classes/chrpath.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 CHRPATH_BIN ?= "chrpath"
 PREPROCESS_RELOCATE_DIRS ?= ""
 
diff --git a/poky/meta/classes/cmake.bbclass b/poky/meta/classes/cmake.bbclass
deleted file mode 100644
index d9bcddb..0000000
--- a/poky/meta/classes/cmake.bbclass
+++ /dev/null
@@ -1,217 +0,0 @@
-# Path to the CMake file to process.
-OECMAKE_SOURCEPATH ??= "${S}"
-
-DEPENDS:prepend = "cmake-native "
-B = "${WORKDIR}/build"
-
-# What CMake generator to use.
-# The supported options are "Unix Makefiles" or "Ninja".
-OECMAKE_GENERATOR ?= "Ninja"
-
-python() {
-    generator = d.getVar("OECMAKE_GENERATOR")
-    if "Unix Makefiles" in generator:
-        args = "-G '" + generator +  "' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE")
-        d.setVar("OECMAKE_GENERATOR_ARGS", args)
-        d.setVarFlag("do_compile", "progress", "percent")
-    elif "Ninja" in generator:
-        args = "-G '" + generator + "' -DCMAKE_MAKE_PROGRAM=ninja"
-        d.appendVar("DEPENDS", " ninja-native")
-        d.setVar("OECMAKE_GENERATOR_ARGS", args)
-        d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+")
-    else:
-        bb.fatal("Unknown CMake Generator %s" % generator)
-}
-OECMAKE_AR ?= "${AR}"
-
-# Compiler flags
-OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
-OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
-OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
-OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
-OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
-OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
-
-def oecmake_map_compiler(compiler, d):
-    args = d.getVar(compiler).split()
-    if args[0] == "ccache":
-        return args[1], args[0]
-    return args[0], ""
-
-# C/C++ Compiler (without cpu arch/tune arguments)
-OECMAKE_C_COMPILER ?= "${@oecmake_map_compiler('CC', d)[0]}"
-OECMAKE_C_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CC', d)[1]}"
-OECMAKE_CXX_COMPILER ?= "${@oecmake_map_compiler('CXX', d)[0]}"
-OECMAKE_CXX_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CXX', d)[1]}"
-
-# clear compiler vars for allarch to avoid sig hash difference
-OECMAKE_C_COMPILER_allarch = ""
-OECMAKE_C_COMPILER_LAUNCHER_allarch = ""
-OECMAKE_CXX_COMPILER_allarch = ""
-OECMAKE_CXX_COMPILER_LAUNCHER_allarch = ""
-
-OECMAKE_RPATH ?= ""
-OECMAKE_PERLNATIVE_DIR ??= ""
-OECMAKE_EXTRA_ROOT_PATH ?= ""
-
-OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY"
-OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM:class-native = "BOTH"
-
-EXTRA_OECMAKE:append = " ${PACKAGECONFIG_CONFARGS}"
-
-export CMAKE_BUILD_PARALLEL_LEVEL
-CMAKE_BUILD_PARALLEL_LEVEL:task-compile = "${@oe.utils.parallel_make(d, False)}"
-CMAKE_BUILD_PARALLEL_LEVEL:task-install = "${@oe.utils.parallel_make(d, True)}"
-
-OECMAKE_TARGET_COMPILE ?= "all"
-OECMAKE_TARGET_INSTALL ?= "install"
-
-def map_host_os_to_system_name(host_os):
-    if host_os.startswith('mingw'):
-        return 'Windows'
-    if host_os.startswith('linux'):
-        return 'Linux'
-    return host_os
-
-# CMake expects target architectures in the format of uname(2),
-# which do not always match TARGET_ARCH, so all the necessary
-# conversions should happen here.
-def map_host_arch_to_uname_arch(host_arch):
-    if host_arch == "powerpc":
-        return "ppc"
-    if host_arch == "powerpc64le":
-        return "ppc64le"
-    if host_arch == "powerpc64":
-        return "ppc64"
-    return host_arch
-
-cmake_do_generate_toolchain_file() {
-	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
-		cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )"
-	fi
-	cat > ${WORKDIR}/toolchain.cmake <<EOF
-# CMake system name must be something like "Linux".
-# This is important for cross-compiling.
-$cmake_crosscompiling
-set( CMAKE_SYSTEM_NAME ${@map_host_os_to_system_name(d.getVar('HOST_OS'))} )
-set( CMAKE_SYSTEM_PROCESSOR ${@map_host_arch_to_uname_arch(d.getVar('HOST_ARCH'))} )
-set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
-set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
-set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
-set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
-set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
-find_program( CMAKE_AR ${OECMAKE_AR} DOC "Archiver" REQUIRED )
-
-set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
-set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
-set( CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
-set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" )
-set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" )
-set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" )
-set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
-set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
-
-# only search in the paths provided so cmake doesnt pick
-# up libraries and tools from the native build machine
-set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST} ${STAGING_DIR_NATIVE} ${CROSS_DIR} ${OECMAKE_PERLNATIVE_DIR} ${OECMAKE_EXTRA_ROOT_PATH} ${EXTERNAL_TOOLCHAIN} ${HOSTTOOLS_DIR})
-set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ${OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM} )
-set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-set( CMAKE_PROGRAM_PATH "/" )
-
-# Use qt.conf settings
-set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )
-
-# We need to set the rpath to the correct directory as cmake does not provide any
-# directory as rpath by default
-set( CMAKE_INSTALL_RPATH ${OECMAKE_RPATH} )
-
-# Use RPATHs relative to build directory for reproducibility
-set( CMAKE_BUILD_RPATH_USE_ORIGIN ON )
-
-# Use our cmake modules
-list(APPEND CMAKE_MODULE_PATH "${STAGING_DATADIR}/cmake/Modules/")
-
-# add for non /usr/lib libdir, e.g. /usr/lib64
-set( CMAKE_LIBRARY_PATH ${libdir} ${base_libdir})
-
-# add include dir to implicit includes in case it differs from /usr/include
-list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${includedir})
-list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${includedir})
-
-EOF
-}
-
-addtask generate_toolchain_file after do_patch before do_configure
-
-CONFIGURE_FILES = "CMakeLists.txt"
-
-do_configure[cleandirs] = "${@d.getVar('B') if d.getVar('S') != d.getVar('B') else ''}"
-
-cmake_do_configure() {
-	if [ "${OECMAKE_BUILDPATH}" ]; then
-		bbnote "cmake.bbclass no longer uses OECMAKE_BUILDPATH.  The default behaviour is now out-of-tree builds with B=WORKDIR/build."
-	fi
-
-	if [ "${S}" = "${B}" ]; then
-		find ${B} -name CMakeFiles -or -name Makefile -or -name cmake_install.cmake -or -name CMakeCache.txt -delete
-	fi
-
-	# Just like autotools cmake can use a site file to cache result that need generated binaries to run
-	if [ -e ${WORKDIR}/site-file.cmake ] ; then
-		oecmake_sitefile="-C ${WORKDIR}/site-file.cmake"
-	else
-		oecmake_sitefile=
-	fi
-
-	cmake \
-	  ${OECMAKE_GENERATOR_ARGS} \
-	  $oecmake_sitefile \
-	  ${OECMAKE_SOURCEPATH} \
-	  -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
-	  -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix') + '/')} \
-	  -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix') + '/')} \
-	  -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix') + '/')} \
-	  -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
-	  -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d.  getVar('prefix') + '/')} \
-	  -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \
-	  -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \
-	  -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \
-	  -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \
-	  -DPYTHON_EXECUTABLE:PATH=${PYTHON} \
-	  -DPython_EXECUTABLE:PATH=${PYTHON} \
-	  -DPython3_EXECUTABLE:PATH=${PYTHON} \
-	  -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
-	  -DCMAKE_INSTALL_SO_NO_EXE=0 \
-	  -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
-	  -DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
-	  -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON \
-	  -DFETCHCONTENT_FULLY_DISCONNECTED=ON \
-	  ${EXTRA_OECMAKE} \
-	  -Wno-dev
-}
-
-# To disable verbose cmake logs for a given recipe or globally config metadata e.g. local.conf
-# add following
-#
-# CMAKE_VERBOSE = ""
-#
-
-CMAKE_VERBOSE ??= "VERBOSE=1"
-
-# Then run do_compile again
-cmake_runcmake_build() {
-	bbnote ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --build '${B}' "$@" -- ${EXTRA_OECMAKE_BUILD}
-	eval ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --build '${B}' "$@" -- ${EXTRA_OECMAKE_BUILD}
-}
-
-cmake_do_compile()  {
-	cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
-}
-
-cmake_do_install() {
-	DESTDIR='${D}' cmake_runcmake_build --target ${OECMAKE_TARGET_INSTALL}
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file
diff --git a/poky/meta/classes/cml1.bbclass b/poky/meta/classes/cml1.bbclass
deleted file mode 100644
index d319d66..0000000
--- a/poky/meta/classes/cml1.bbclass
+++ /dev/null
@@ -1,101 +0,0 @@
-# returns all the elements from the src uri that are .cfg files
-def find_cfgs(d):
-    sources=src_patches(d, True)
-    sources_list=[]
-    for s in sources:
-        if s.endswith('.cfg'):
-            sources_list.append(s)
-
-    return sources_list
-
-cml1_do_configure() {
-	set -e
-	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
-	yes '' | oe_runmake oldconfig
-}
-
-EXPORT_FUNCTIONS do_configure
-addtask configure after do_unpack do_patch before do_compile
-
-inherit terminal
-
-OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC"
-HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
-HOSTLDFLAGS = "${BUILD_LDFLAGS}"
-CROSS_CURSES_LIB = "-lncurses -ltinfo"
-CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"'
-TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
-
-KCONFIG_CONFIG_COMMAND ??= "menuconfig"
-KCONFIG_CONFIG_ROOTDIR ??= "${B}"
-python do_menuconfig() {
-    import shutil
-
-    config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config")
-    configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config.orig")
-
-    try:
-        mtime = os.path.getmtime(config)
-        shutil.copy(config, configorig)
-    except OSError:
-        mtime = 0
-
-    # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-    d.setVar("PKG_CONFIG_DIR", "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig")
-    d.setVar("PKG_CONFIG_PATH", "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig")
-    d.setVar("PKG_CONFIG_LIBDIR", "${PKG_CONFIG_DIR}")
-    d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1")
-    # ensure that environment variables are overwritten with this tasks 'd' values
-    d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
-
-    oe_terminal("sh -c \"make %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
-                d.getVar('PN') + ' Configuration', d)
-
-    # FIXME this check can be removed when the minimum bitbake version has been bumped
-    if hasattr(bb.build, 'write_taint'):
-        try:
-            newmtime = os.path.getmtime(config)
-        except OSError:
-            newmtime = 0
-
-        if newmtime > mtime:
-            bb.note("Configuration changed, recompile will be forced")
-            bb.build.write_taint('do_compile', d)
-}
-do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
-do_menuconfig[nostamp] = "1"
-do_menuconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
-addtask menuconfig after do_configure
-
-python do_diffconfig() {
-    import shutil
-    import subprocess
-
-    workdir = d.getVar('WORKDIR')
-    fragment = workdir + '/fragment.cfg'
-    configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config.orig")
-    config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config")
-
-    try:
-        md5newconfig = bb.utils.md5_file(configorig)
-        md5config = bb.utils.md5_file(config)
-        isdiff = md5newconfig != md5config
-    except IOError as e:
-        bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e)
-
-    if isdiff:
-        statement = 'diff --unchanged-line-format= --old-line-format= --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment
-        subprocess.call(statement, shell=True)
-        # No need to check the exit code as we know it's going to be
-        # non-zero, but that's what we expect.
-        shutil.copy(configorig, config)
-
-        bb.plain("Config fragment has been dumped into:\n %s" % fragment)
-    else:
-        if os.path.exists(fragment):
-            os.unlink(fragment)
-}
-
-do_diffconfig[nostamp] = "1"
-do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
-addtask diffconfig
diff --git a/poky/meta/classes/compress_doc.bbclass b/poky/meta/classes/compress_doc.bbclass
deleted file mode 100644
index 379b6c1..0000000
--- a/poky/meta/classes/compress_doc.bbclass
+++ /dev/null
@@ -1,263 +0,0 @@
-# Compress man pages in ${mandir} and info pages in ${infodir}
-#
-# 1. The doc will be compressed to gz format by default.
-#
-# 2. It will automatically correct the compressed doc which is not
-# in ${DOC_COMPRESS} but in ${DOC_COMPRESS_LIST} to the format
-# of ${DOC_COMPRESS} policy
-#
-# 3. It is easy to add a new type compression by editing
-# local.conf, such as:
-# DOC_COMPRESS_LIST:append = ' abc'
-# DOC_COMPRESS = 'abc'
-# DOC_COMPRESS_CMD[abc] = 'abc compress cmd ***'
-# DOC_DECOMPRESS_CMD[abc] = 'abc decompress cmd ***'
-
-# All supported compression policy
-DOC_COMPRESS_LIST ?= "gz xz bz2"
-
-# Compression policy, must be one of ${DOC_COMPRESS_LIST}
-DOC_COMPRESS ?= "gz"
-
-# Compression shell command
-DOC_COMPRESS_CMD[gz] ?= 'gzip -v -9 -n'
-DOC_COMPRESS_CMD[bz2] ?= "bzip2 -v -9"
-DOC_COMPRESS_CMD[xz] ?= "xz -v"
-
-# Decompression shell command
-DOC_DECOMPRESS_CMD[gz] ?= 'gunzip -v'
-DOC_DECOMPRESS_CMD[bz2] ?= "bunzip2 -v"
-DOC_DECOMPRESS_CMD[xz] ?= "unxz -v"
-
-PACKAGE_PREPROCESS_FUNCS += "package_do_compress_doc compress_doc_updatealternatives"
-python package_do_compress_doc() {
-    compress_mode = d.getVar('DOC_COMPRESS')
-    compress_list = (d.getVar('DOC_COMPRESS_LIST') or '').split()
-    if compress_mode not in compress_list:
-        bb.fatal('Compression policy %s not supported (not listed in %s)\n' % (compress_mode, compress_list))
-
-    dvar = d.getVar('PKGD')
-    compress_cmds = {}
-    decompress_cmds = {}
-    for mode in compress_list:
-        compress_cmds[mode] = d.getVarFlag('DOC_COMPRESS_CMD', mode)
-        decompress_cmds[mode] = d.getVarFlag('DOC_DECOMPRESS_CMD', mode)
-
-    mandir = os.path.abspath(dvar + os.sep + d.getVar("mandir"))
-    if os.path.exists(mandir):
-        # Decompress doc files which format is not compress_mode
-        decompress_doc(mandir, compress_mode, decompress_cmds)
-        compress_doc(mandir, compress_mode, compress_cmds)
-
-    infodir = os.path.abspath(dvar + os.sep + d.getVar("infodir"))
-    if os.path.exists(infodir):
-        # Decompress doc files which format is not compress_mode
-        decompress_doc(infodir, compress_mode, decompress_cmds)
-        compress_doc(infodir, compress_mode, compress_cmds)
-}
-
-def _get_compress_format(file, compress_format_list):
-    for compress_format in compress_format_list:
-        compress_suffix = '.' + compress_format
-        if file.endswith(compress_suffix):
-            return compress_format
-
-    return ''
-
-# Collect hardlinks to dict, each element in dict lists hardlinks
-# which points to the same doc file.
-# {hardlink10: [hardlink11, hardlink12],,,}
-# The hardlink10, hardlink11 and hardlink12 are the same file.
-def _collect_hardlink(hardlink_dict, file):
-    for hardlink in hardlink_dict:
-        # Add to the existed hardlink
-        if os.path.samefile(hardlink, file):
-            hardlink_dict[hardlink].append(file)
-            return hardlink_dict
-
-    hardlink_dict[file] = []
-    return hardlink_dict
-
-def _process_hardlink(hardlink_dict, compress_mode, shell_cmds, decompress=False):
-    import subprocess
-    for target in hardlink_dict:
-        if decompress:
-            compress_format = _get_compress_format(target, shell_cmds.keys())
-            cmd = "%s -f %s" % (shell_cmds[compress_format], target)
-            bb.note('decompress hardlink %s' % target)
-        else:
-            cmd = "%s -f %s" % (shell_cmds[compress_mode], target)
-            bb.note('compress hardlink %s' % target)
-        (retval, output) = subprocess.getstatusoutput(cmd)
-        if retval:
-            bb.warn("de/compress file failed %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
-            return
-
-        for hardlink_dup in hardlink_dict[target]:
-            if decompress:
-                # Remove compress suffix
-                compress_suffix = '.' + compress_format
-                new_hardlink = hardlink_dup[:-len(compress_suffix)]
-                new_target = target[:-len(compress_suffix)]
-            else:
-                # Append compress suffix
-                compress_suffix = '.' + compress_mode
-                new_hardlink = hardlink_dup + compress_suffix
-                new_target = target + compress_suffix
-
-            bb.note('hardlink %s-->%s' % (new_hardlink, new_target))
-            if not os.path.exists(new_hardlink):
-                os.link(new_target, new_hardlink)
-            if os.path.exists(hardlink_dup):
-                os.unlink(hardlink_dup)
-
-def _process_symlink(file, compress_format, decompress=False):
-    compress_suffix = '.' + compress_format
-    if decompress:
-        # Remove compress suffix
-        new_linkname = file[:-len(compress_suffix)]
-        new_source = os.readlink(file)[:-len(compress_suffix)]
-    else:
-        # Append compress suffix
-        new_linkname = file + compress_suffix
-        new_source = os.readlink(file) + compress_suffix
-
-    bb.note('symlink %s-->%s' % (new_linkname, new_source))
-    if not os.path.exists(new_linkname):
-        os.symlink(new_source, new_linkname)
-
-    os.unlink(file)
-
-def _is_info(file):
-    flags = '.info .info-'.split()
-    for flag in flags:
-        if flag in os.path.basename(file):
-            return True
-
-    return False
-
-def _is_man(file):
-    import re
-
-    # It refers MANSECT-var in man(1.6g)'s man.config
-    # ".1:.1p:.8:.2:.3:.3p:.4:.5:.6:.7:.9:.0p:.tcl:.n:.l:.p:.o"
-    # Not start with '.', and contain the above colon-seperate element
-    p = re.compile(r'[^\.]+\.([1-9lnop]|0p|tcl)')
-    if p.search(file):
-        return True
-
-    return False
-
-def _is_compress_doc(file, compress_format_list):
-    compress_format = _get_compress_format(file, compress_format_list)
-    compress_suffix = '.' + compress_format
-    if file.endswith(compress_suffix):
-        # Remove the compress suffix
-        uncompress_file = file[:-len(compress_suffix)]
-        if _is_info(uncompress_file) or _is_man(uncompress_file):
-            return True, compress_format
-
-    return False, ''
-
-def compress_doc(topdir, compress_mode, compress_cmds):
-    import subprocess
-    hardlink_dict = {}
-    for root, dirs, files in os.walk(topdir):
-        for f in files:
-            file = os.path.join(root, f)
-            if os.path.isdir(file):
-                continue
-
-            if _is_info(file) or _is_man(file):
-                # Symlink
-                if os.path.islink(file):
-                    _process_symlink(file, compress_mode)
-                # Hardlink
-                elif os.lstat(file).st_nlink > 1:
-                    _collect_hardlink(hardlink_dict, file)
-                # Normal file
-                elif os.path.isfile(file):
-                    cmd = "%s %s" % (compress_cmds[compress_mode], file)
-                    (retval, output) = subprocess.getstatusoutput(cmd)
-                    if retval:
-                        bb.warn("compress failed %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
-                        continue
-                    bb.note('compress file %s' % file)
-
-    _process_hardlink(hardlink_dict, compress_mode, compress_cmds)
-
-# Decompress doc files which format is not compress_mode
-def decompress_doc(topdir, compress_mode, decompress_cmds):
-    import subprocess
-    hardlink_dict = {}
-    decompress = True
-    for root, dirs, files in os.walk(topdir):
-        for f in files:
-            file = os.path.join(root, f)
-            if os.path.isdir(file):
-                continue
-
-            res, compress_format = _is_compress_doc(file, decompress_cmds.keys())
-            # Decompress files which format is not compress_mode
-            if res and compress_mode!=compress_format:
-                # Symlink
-                if os.path.islink(file):
-                    _process_symlink(file, compress_format, decompress)
-                # Hardlink
-                elif os.lstat(file).st_nlink > 1:
-                    _collect_hardlink(hardlink_dict, file)
-                # Normal file
-                elif os.path.isfile(file):
-                    cmd = "%s %s" % (decompress_cmds[compress_format], file)
-                    (retval, output) = subprocess.getstatusoutput(cmd)
-                    if retval:
-                        bb.warn("decompress failed %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
-                        continue
-                    bb.note('decompress file %s' % file)
-
-    _process_hardlink(hardlink_dict, compress_mode, decompress_cmds, decompress)
-
-python compress_doc_updatealternatives () {
-    if not bb.data.inherits_class('update-alternatives', d):
-        return
-
-    mandir = d.getVar("mandir")
-    infodir = d.getVar("infodir")
-    compress_mode = d.getVar('DOC_COMPRESS')
-    for pkg in (d.getVar('PACKAGES') or "").split():
-        old_names = (d.getVar('ALTERNATIVE:%s' % pkg) or "").split()
-        new_names = []
-        for old_name in old_names:
-            old_link     = d.getVarFlag('ALTERNATIVE_LINK_NAME', old_name)
-            old_target   = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name) or \
-                d.getVarFlag('ALTERNATIVE_TARGET', old_name) or \
-                d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or \
-                d.getVar('ALTERNATIVE_TARGET') or \
-                old_link
-            # Sometimes old_target is specified as relative to the link name.
-            old_target   = os.path.join(os.path.dirname(old_link), old_target)
-
-            # The updatealternatives used for compress doc
-            if mandir in old_target or infodir in old_target:
-                new_name = old_name + '.' + compress_mode
-                new_link = old_link + '.' + compress_mode
-                new_target = old_target + '.' + compress_mode
-                d.delVarFlag('ALTERNATIVE_LINK_NAME', old_name)
-                d.setVarFlag('ALTERNATIVE_LINK_NAME', new_name, new_link)
-                if d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name):
-                    d.delVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name)
-                    d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, new_name, new_target)
-                elif d.getVarFlag('ALTERNATIVE_TARGET', old_name):
-                    d.delVarFlag('ALTERNATIVE_TARGET', old_name)
-                    d.setVarFlag('ALTERNATIVE_TARGET', new_name, new_target)
-                elif d.getVar('ALTERNATIVE_TARGET_%s' % pkg):
-                    d.setVar('ALTERNATIVE_TARGET_%s' % pkg, new_target)
-                elif d.getVar('ALTERNATIVE_TARGET'):
-                    d.setVar('ALTERNATIVE_TARGET', new_target)
-
-                new_names.append(new_name)
-
-        if new_names:
-            d.setVar('ALTERNATIVE:%s' % pkg, ' '.join(new_names))
-}
-
diff --git a/poky/meta/classes/copyleft_compliance.bbclass b/poky/meta/classes/copyleft_compliance.bbclass
index eabf12c..9ff9956 100644
--- a/poky/meta/classes/copyleft_compliance.bbclass
+++ b/poky/meta/classes/copyleft_compliance.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Deploy sources for recipes for compliance with copyleft-style licenses
 # Defaults to using symlinks, as it's a quick operation, and one can easily
 # follow the links when making use of the files (e.g. tar with the -h arg).
diff --git a/poky/meta/classes/copyleft_filter.bbclass b/poky/meta/classes/copyleft_filter.bbclass
index c36bce4..83cd900 100644
--- a/poky/meta/classes/copyleft_filter.bbclass
+++ b/poky/meta/classes/copyleft_filter.bbclass
@@ -1,10 +1,14 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Filter the license, the copyleft_should_include returns True for the
 # COPYLEFT_LICENSE_INCLUDE recipe, and False for the
 # COPYLEFT_LICENSE_EXCLUDE.
 #
 # By default, includes all GPL and LGPL, and excludes CLOSED and Proprietary.
-#
-# vi:sts=4:sw=4:et
 
 COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL* AGPL*'
 COPYLEFT_LICENSE_INCLUDE[type] = 'list'
diff --git a/poky/meta/classes/core-image.bbclass b/poky/meta/classes/core-image.bbclass
deleted file mode 100644
index 84fd3ee..0000000
--- a/poky/meta/classes/core-image.bbclass
+++ /dev/null
@@ -1,79 +0,0 @@
-# Common code for generating core reference images
-#
-# Copyright (C) 2007-2011 Linux Foundation
-
-# IMAGE_FEATURES control content of the core reference images
-# 
-# By default we install packagegroup-core-boot and packagegroup-base-extended packages;
-# this gives us working (console only) rootfs.
-#
-# Available IMAGE_FEATURES:
-#
-# - weston              - Weston Wayland compositor
-# - x11                 - X server
-# - x11-base            - X server with minimal environment
-# - x11-sato            - OpenedHand Sato environment
-# - tools-debug         - debugging tools
-# - eclipse-debug       - Eclipse remote debugging support
-# - tools-profile       - profiling tools
-# - tools-testapps      - tools usable to make some device tests
-# - tools-sdk           - SDK (C/C++ compiler, autotools, etc.)
-# - nfs-server          - NFS server
-# - nfs-client          - NFS client
-# - ssh-server-dropbear - SSH server (dropbear)
-# - ssh-server-openssh  - SSH server (openssh)
-# - hwcodecs            - Install hardware acceleration codecs
-# - package-management  - installs package management tools and preserves the package manager database
-# - debug-tweaks        - makes an image suitable for development, e.g. allowing passwordless root logins
-#   - empty-root-password
-#   - allow-empty-password
-#   - allow-root-login
-#   - post-install-logging
-# - dev-pkgs            - development packages (headers, etc.) for all installed packages in the rootfs
-# - dbg-pkgs            - debug symbol packages for all installed packages in the rootfs
-# - lic-pkgs            - license packages for all installed pacakges in the rootfs, requires
-#                         LICENSE_CREATE_PACKAGE="1" to be set when building packages too
-# - doc-pkgs            - documentation packages for all installed packages in the rootfs
-# - bash-completion-pkgs - bash-completion packages for recipes using bash-completion bbclass
-# - ptest-pkgs          - ptest packages for all ptest-enabled recipes
-# - read-only-rootfs    - tweaks an image to support read-only rootfs
-# - stateless-rootfs    - systemctl-native not run, image populated by systemd at runtime
-# - splash              - bootup splash screen
-#
-FEATURE_PACKAGES_weston = "packagegroup-core-weston"
-FEATURE_PACKAGES_x11 = "packagegroup-core-x11"
-FEATURE_PACKAGES_x11-base = "packagegroup-core-x11-base"
-FEATURE_PACKAGES_x11-sato = "packagegroup-core-x11-sato"
-FEATURE_PACKAGES_tools-debug = "packagegroup-core-tools-debug"
-FEATURE_PACKAGES_eclipse-debug = "packagegroup-core-eclipse-debug"
-FEATURE_PACKAGES_tools-profile = "packagegroup-core-tools-profile"
-FEATURE_PACKAGES_tools-testapps = "packagegroup-core-tools-testapps"
-FEATURE_PACKAGES_tools-sdk = "packagegroup-core-sdk packagegroup-core-standalone-sdk-target"
-FEATURE_PACKAGES_nfs-server = "packagegroup-core-nfs-server"
-FEATURE_PACKAGES_nfs-client = "packagegroup-core-nfs-client"
-FEATURE_PACKAGES_ssh-server-dropbear = "packagegroup-core-ssh-dropbear"
-FEATURE_PACKAGES_ssh-server-openssh = "packagegroup-core-ssh-openssh"
-FEATURE_PACKAGES_hwcodecs = "${MACHINE_HWCODECS}"
-
-
-# IMAGE_FEATURES_REPLACES_foo = 'bar1 bar2'
-# Including image feature foo would replace the image features bar1 and bar2
-IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear"
-
-# IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2'
-# An error exception would be raised if both image features foo and bar1(or bar2) are included
-
-MACHINE_HWCODECS ??= ""
-
-CORE_IMAGE_BASE_INSTALL = '\
-    packagegroup-core-boot \
-    packagegroup-base-extended \
-    \
-    ${CORE_IMAGE_EXTRA_INSTALL} \
-    '
-
-CORE_IMAGE_EXTRA_INSTALL ?= ""
-
-IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
-
-inherit image
diff --git a/poky/meta/classes/cpan-base.bbclass b/poky/meta/classes/cpan-base.bbclass
deleted file mode 100644
index 93d11e1..0000000
--- a/poky/meta/classes/cpan-base.bbclass
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# cpan-base providers various perl related information needed for building
-# cpan modules
-#
-FILES:${PN} += "${libdir}/perl5 ${datadir}/perl5"
-
-DEPENDS  += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}"
-RDEPENDS:${PN} += "${@["perl", ""][(bb.data.inherits_class('native', d))]}"
-
-inherit perl-version
-
-def is_target(d):
-    if not bb.data.inherits_class('native', d):
-        return "yes"
-    return "no"
-
-PERLLIBDIRS = "${libdir}/perl5"
-PERLLIBDIRS:class-native = "${libdir}/perl5"
-
-def cpan_upstream_check_pattern(d):
-    for x in (d.getVar('SRC_URI') or '').split(' '):
-        if x.startswith("https://cpan.metacpan.org"):
-            _pattern = x.split('/')[-1].replace(d.getVar('PV'), r'(?P<pver>\d+.\d+)')
-            return _pattern
-    return ''
-
-UPSTREAM_CHECK_REGEX ?= "${@cpan_upstream_check_pattern(d)}"
diff --git a/poky/meta/classes/cpan.bbclass b/poky/meta/classes/cpan.bbclass
deleted file mode 100644
index 18f1b9d..0000000
--- a/poky/meta/classes/cpan.bbclass
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# This is for perl modules that use the old Makefile.PL build system
-#
-inherit cpan-base perlnative
-
-EXTRA_CPANFLAGS ?= ""
-EXTRA_PERLFLAGS ?= ""
-
-# Env var which tells perl if it should use host (no) or target (yes) settings
-export PERLCONFIGTARGET = "${@is_target(d)}"
-
-# Env var which tells perl where the perl include files are
-export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE"
-export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}"
-export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
-export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/"
-export PERLHOSTARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/${@get_perl_hostarch(d)}/"
-
-cpan_do_configure () {
-	yes '' | perl ${EXTRA_PERLFLAGS} Makefile.PL INSTALLDIRS=vendor NO_PERLLOCAL=1 NO_PACKLIST=1 PERL=$(which perl) ${EXTRA_CPANFLAGS}
-
-	# Makefile.PLs can exit with success without generating a
-	# Makefile, e.g. in cases of missing configure time
-	# dependencies. This is considered a best practice by
-	# cpantesters.org. See:
-	#  * http://wiki.cpantesters.org/wiki/CPANAuthorNotes
-	#  * http://www.nntp.perl.org/group/perl.qa/2008/08/msg11236.html
-	[ -e Makefile ] || bbfatal "No Makefile was generated by Makefile.PL"
-
-	if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
-		. ${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh
-		# Use find since there can be a Makefile generated for each Makefile.PL
-		for f in `find -name Makefile.PL`; do
-			f2=`echo $f | sed -e 's/.PL//'`
-			test -f $f2 || continue
-			sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
-				-e 's/perl.real/perl/' \
-				-e "s|^\(CCFLAGS =.*\)|\1 ${CFLAGS}|" \
-				$f2
-		done
-	fi
-}
-
-do_configure:append:class-target() {
-       find . -name Makefile | xargs sed -E -i \
-           -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
-}
-
-do_configure:append:class-nativesdk() {
-       find . -name Makefile | xargs sed -E -i \
-           -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
-}
-
-cpan_do_compile () {
-	oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
-}
-
-cpan_do_install () {
-	oe_runmake DESTDIR="${D}" install_vendor
-	for PERLSCRIPT in `grep -rIEl '#! *${bindir}/perl-native.*/perl' ${D}`; do
-		sed -i -e 's|${bindir}/perl-native.*/perl|/usr/bin/env nativeperl|' $PERLSCRIPT
-	done
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/cpan_build.bbclass b/poky/meta/classes/cpan_build.bbclass
deleted file mode 100644
index f3fb466..0000000
--- a/poky/meta/classes/cpan_build.bbclass
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# This is for perl modules that use the new Build.PL build system
-#
-inherit cpan-base perlnative
-
-EXTRA_CPAN_BUILD_FLAGS ?= ""
-
-# Env var which tells perl if it should use host (no) or target (yes) settings
-export PERLCONFIGTARGET = "${@is_target(d)}"
-export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
-export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/"
-export PERLHOSTARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/${@get_perl_hostarch(d)}/"
-export LD = "${CCLD}"
-
-cpan_build_do_configure () {
-	if [ "${@is_target(d)}" = "yes" ]; then
-		# build for target
-		. ${STAGING_LIBDIR}/perl5/config.sh
-	fi
-
-	perl Build.PL --installdirs vendor --destdir ${D} \
-			${EXTRA_CPAN_BUILD_FLAGS}
-
-	# Build.PLs can exit with success without generating a
-	# Build, e.g. in cases of missing configure time
-	# dependencies. This is considered a best practice by
-	# cpantesters.org. See:
-	#  * http://wiki.cpantesters.org/wiki/CPANAuthorNotes
-	#  * http://www.nntp.perl.org/group/perl.qa/2008/08/msg11236.html
-	[ -e Build ] || bbfatal "No Build was generated by Build.PL"
-}
-
-cpan_build_do_compile () {
-        perl Build --perl "${bindir}/perl" verbose=1
-}
-
-cpan_build_do_install () {
-	perl Build install --destdir ${D}
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/create-spdx.bbclass b/poky/meta/classes/create-spdx.bbclass
index 10deba6..47dd12c 100644
--- a/poky/meta/classes/create-spdx.bbclass
+++ b/poky/meta/classes/create-spdx.bbclass
@@ -1,4 +1,6 @@
 #
+# Copyright OpenEmbedded Contributors
+#
 # SPDX-License-Identifier: GPL-2.0-only
 #
 
@@ -216,7 +218,7 @@
             filepath = Path(subdir) / file
             filename = str(filepath.relative_to(topdir))
 
-            if filepath.is_file() and not filepath.is_symlink():
+            if not filepath.is_symlink() and filepath.is_file():
                 spdx_file = oe.spdx.SPDXFile()
                 spdx_file.SPDXID = get_spdxid(file_counter)
                 for t in get_types(filepath):
diff --git a/poky/meta/classes/cross-canadian.bbclass b/poky/meta/classes/cross-canadian.bbclass
deleted file mode 100644
index a0e9d23..0000000
--- a/poky/meta/classes/cross-canadian.bbclass
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# NOTE - When using this class the user is responsible for ensuring that
-# TRANSLATED_TARGET_ARCH is added into PN. This ensures that if the TARGET_ARCH
-# is changed, another nativesdk xxx-canadian-cross can be installed
-#
-
-
-# SDK packages are built either explicitly by the user,
-# or indirectly via dependency.  No need to be in 'world'.
-EXCLUDE_FROM_WORLD = "1"
-NATIVESDKLIBC ?= "libc-glibc"
-LIBCOVERRIDE = ":${NATIVESDKLIBC}"
-CLASSOVERRIDE = "class-cross-canadian"
-STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}:${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-#
-# Update BASE_PACKAGE_ARCH and PACKAGE_ARCHS
-#
-PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}"
-BASECANADIANEXTRAOS ?= "linux-musl"
-CANADIANEXTRAOS = "${BASECANADIANEXTRAOS}"
-CANADIANEXTRAVENDOR = ""
-MODIFYTOS ??= "1"
-python () {
-    archs = d.getVar('PACKAGE_ARCHS').split()
-    sdkarchs = []
-    for arch in archs:
-        sdkarchs.append(arch + '-${SDKPKGSUFFIX}')
-    d.setVar('PACKAGE_ARCHS', " ".join(sdkarchs))
-
-    # Allow the following code segment to be disabled, e.g. meta-environment
-    if d.getVar("MODIFYTOS") != "1":
-        return
-
-    if d.getVar("TCLIBC") in [ 'baremetal', 'newlib' ]:
-        return
-
-    tos = d.getVar("TARGET_OS")
-    tos_known = ["mingw32"]
-    extralibcs = [""]
-    if "musl" in d.getVar("BASECANADIANEXTRAOS"):
-        extralibcs.append("musl")
-    if "android" in tos:
-        extralibcs.append("android")
-    for variant in ["", "spe", "x32", "eabi", "n32", "_ilp32"]:
-        for libc in extralibcs:
-            entry = "linux"
-            if variant and libc:
-                entry = entry + "-" + libc + variant
-            elif variant:
-                entry = entry + "-gnu" + variant
-            elif libc:
-                entry = entry + "-" + libc
-            tos_known.append(entry)
-    if tos not in tos_known:
-        bb.fatal("Building cross-candian for an unknown TARGET_SYS (%s), please update cross-canadian.bbclass" % d.getVar("TARGET_SYS"))
-
-    for n in ["PROVIDES", "DEPENDS"]:
-        d.setVar(n, d.getVar(n))
-    d.setVar("STAGING_BINDIR_TOOLCHAIN", d.getVar("STAGING_BINDIR_TOOLCHAIN"))
-    for prefix in ["AR", "AS", "DLLTOOL", "CC", "CXX", "GCC", "LD", "LIPO", "NM", "OBJDUMP", "RANLIB", "STRIP", "WINDRES"]:
-        n = prefix + "_FOR_TARGET"
-        d.setVar(n, d.getVar(n))
-    # This is a bit ugly. We need to zero LIBC/ABI extension which will change TARGET_OS
-    # however we need the old value in some variables. We expand those here first.
-    tarch = d.getVar("TARGET_ARCH")
-    if tarch == "x86_64":
-        d.setVar("LIBCEXTENSION", "")
-        d.setVar("ABIEXTENSION", "")
-        d.appendVar("CANADIANEXTRAOS", " linux-gnux32")
-        for extraos in d.getVar("BASECANADIANEXTRAOS").split():
-            d.appendVar("CANADIANEXTRAOS", " " + extraos + "x32")
-    elif tarch == "powerpc":
-        # PowerPC can build "linux" and "linux-gnuspe"
-        d.setVar("LIBCEXTENSION", "")
-        d.setVar("ABIEXTENSION", "")
-        d.appendVar("CANADIANEXTRAOS", " linux-gnuspe")
-        for extraos in d.getVar("BASECANADIANEXTRAOS").split():
-            d.appendVar("CANADIANEXTRAOS", " " + extraos + "spe")
-    elif tarch == "mips64":
-        d.appendVar("CANADIANEXTRAOS", " linux-gnun32")
-        for extraos in d.getVar("BASECANADIANEXTRAOS").split():
-            d.appendVar("CANADIANEXTRAOS", " " + extraos + "n32")
-    if tarch == "arm" or tarch == "armeb":
-        d.appendVar("CANADIANEXTRAOS", " linux-gnueabi linux-musleabi")
-        d.setVar("TARGET_OS", "linux-gnueabi")
-    else:
-        d.setVar("TARGET_OS", "linux")
-
-    # Also need to handle multilib target vendors
-    vendors = d.getVar("CANADIANEXTRAVENDOR")
-    if not vendors:
-        vendors = all_multilib_tune_values(d, 'TARGET_VENDOR')
-    origvendor = d.getVar("TARGET_VENDOR_MULTILIB_ORIGINAL")
-    if origvendor:
-        d.setVar("TARGET_VENDOR", origvendor)
-        if origvendor not in vendors.split():
-            vendors = origvendor + " " + vendors
-    d.setVar("CANADIANEXTRAVENDOR", vendors)
-}
-MULTIMACH_TARGET_SYS = "${PACKAGE_ARCH}${HOST_VENDOR}-${HOST_OS}"
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-STAGING_DIR_HOST = "${RECIPE_SYSROOT}"
-
-TOOLCHAIN_OPTIONS = " --sysroot=${RECIPE_SYSROOT}"
-
-PATH:append = ":${TMPDIR}/sysroots/${HOST_ARCH}/${bindir_cross}"
-PKGHIST_DIR = "${TMPDIR}/pkghistory/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/"
-
-HOST_ARCH = "${SDK_ARCH}"
-HOST_VENDOR = "${SDK_VENDOR}"
-HOST_OS = "${SDK_OS}"
-HOST_PREFIX = "${SDK_PREFIX}"
-HOST_CC_ARCH = "${SDK_CC_ARCH}"
-HOST_LD_ARCH = "${SDK_LD_ARCH}"
-HOST_AS_ARCH = "${SDK_AS_ARCH}"
-
-#assign DPKG_ARCH
-DPKG_ARCH = "${@debian_arch_map(d.getVar('SDK_ARCH'), '')}"
-
-CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
-CFLAGS = "${BUILDSDK_CFLAGS}"
-CXXFLAGS = "${BUILDSDK_CFLAGS}"
-LDFLAGS = "${BUILDSDK_LDFLAGS} \
-           -Wl,-rpath-link,${STAGING_LIBDIR}/.. \
-           -Wl,-rpath,${libdir}/.. "
-
-#
-# We need chrpath >= 0.14 to ensure we can deal with 32 and 64 bit
-# binaries
-#
-DEPENDS:append = " chrpath-replacement-native"
-EXTRANATIVEPATH += "chrpath-native"
-
-# Path mangling needed by the cross packaging
-# Note that we use := here to ensure that libdir and includedir are
-# target paths.
-target_base_prefix := "${base_prefix}"
-target_prefix := "${prefix}"
-target_exec_prefix := "${exec_prefix}"
-target_base_libdir = "${target_base_prefix}/${baselib}"
-target_libdir = "${target_exec_prefix}/${baselib}"
-target_includedir := "${includedir}"
-
-# Change to place files in SDKPATH
-base_prefix = "${SDKPATHNATIVE}"
-prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-bindir = "${exec_prefix}/bin/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-sbindir = "${bindir}"
-base_bindir = "${bindir}"
-base_sbindir = "${bindir}"
-libdir = "${exec_prefix}/lib/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-libexecdir = "${exec_prefix}/libexec/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-FILES:${PN} = "${prefix}"
-
-export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${exec_prefix}/lib/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
-
-do_populate_sysroot[stamp-extra-info] = ""
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "${SDKUSE_NLS}"
-
-# We have to us TARGET_ARCH but we care about the absolute value
-# and not any particular tune that is enabled.
-TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
-
-PKGDATA_DIR = "${PKGDATA_DIR_SDK}"
-# If MLPREFIX is set by multilib code, shlibs
-# points to the wrong place so force it
-SHLIBSDIRS = "${PKGDATA_DIR}/nativesdk-shlibs2"
-SHLIBSWORKDIR = "${PKGDATA_DIR}/nativesdk-shlibs2"
-
-cross_canadian_bindirlinks () {
-	for i in linux ${CANADIANEXTRAOS}
-	do
-		for v in ${CANADIANEXTRAVENDOR}
-		do
-			d=${D}${bindir}/../${TARGET_ARCH}$v-$i
-			if [ -d $d ];
-			then
-			    continue
-			fi
-			install -d $d
-			for j in `ls ${D}${bindir}`
-			do
-				p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,`
-				ln -s ../${TARGET_SYS}/$j $d/$p
-			done
-		done
-       done
-}
diff --git a/poky/meta/classes/cross.bbclass b/poky/meta/classes/cross.bbclass
deleted file mode 100644
index 9d95107..0000000
--- a/poky/meta/classes/cross.bbclass
+++ /dev/null
@@ -1,97 +0,0 @@
-inherit relocatable
-
-# Cross packages are built indirectly via dependency,
-# no need for them to be a direct target of 'world'
-EXCLUDE_FROM_WORLD = "1"
-
-CLASSOVERRIDE = "class-cross"
-PACKAGES = ""
-PACKAGES_DYNAMIC = ""
-PACKAGES_DYNAMIC:class-native = ""
-
-HOST_ARCH = "${BUILD_ARCH}"
-HOST_VENDOR = "${BUILD_VENDOR}"
-HOST_OS = "${BUILD_OS}"
-HOST_PREFIX = "${BUILD_PREFIX}"
-HOST_CC_ARCH = "${BUILD_CC_ARCH}"
-HOST_LD_ARCH = "${BUILD_LD_ARCH}"
-HOST_AS_ARCH = "${BUILD_AS_ARCH}"
-
-# No strip sysroot when DEBUG_BUILD is enabled
-INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}"
-
-export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
-
-STAGING_DIR_HOST = "${RECIPE_SYSROOT_NATIVE}"
-
-PACKAGE_ARCH = "${BUILD_ARCH}"
-
-MULTIMACH_TARGET_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
-
-export PKG_CONFIG_DIR = "${exec_prefix}/lib/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = ""
-
-TARGET_CPPFLAGS = ""
-TARGET_CFLAGS = ""
-TARGET_CXXFLAGS = ""
-TARGET_LDFLAGS = ""
-
-CPPFLAGS = "${BUILD_CPPFLAGS}"
-CFLAGS = "${BUILD_CFLAGS}"
-CXXFLAGS = "${BUILD_CFLAGS}"
-LDFLAGS = "${BUILD_LDFLAGS}"
-
-TOOLCHAIN_OPTIONS = ""
-
-# This class encodes staging paths into its scripts data so can only be
-# reused if we manipulate the paths.
-SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
-
-# Path mangling needed by the cross packaging
-# Note that we use := here to ensure that libdir and includedir are
-# target paths.
-target_base_prefix := "${root_prefix}"
-target_prefix := "${prefix}"
-target_exec_prefix := "${exec_prefix}"
-target_base_libdir = "${target_base_prefix}/${baselib}"
-target_libdir = "${target_exec_prefix}/${baselib}"
-target_includedir := "${includedir}"
-
-# Overrides for paths
-CROSS_TARGET_SYS_DIR = "${TARGET_SYS}"
-prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-base_prefix = "${STAGING_DIR_NATIVE}"
-exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-bindir = "${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}"
-sbindir = "${bindir}"
-base_bindir = "${bindir}"
-base_sbindir = "${bindir}"
-libdir = "${exec_prefix}/lib/${CROSS_TARGET_SYS_DIR}"
-libexecdir = "${exec_prefix}/libexec/${CROSS_TARGET_SYS_DIR}"
-
-do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "no"
-
-export CC = "${BUILD_CC}"
-export CXX = "${BUILD_CXX}"
-export FC = "${BUILD_FC}"
-export CPP = "${BUILD_CPP}"
-export LD = "${BUILD_LD}"
-export CCLD = "${BUILD_CCLD}"
-export AR = "${BUILD_AR}"
-export AS = "${BUILD_AS}"
-export RANLIB = "${BUILD_RANLIB}"
-export STRIP = "${BUILD_STRIP}"
-export NM = "${BUILD_NM}"
-
-inherit nopackages
-
-python do_addto_recipe_sysroot () {
-    bb.build.exec_func("extend_recipe_sysroot", d)
-}
-addtask addto_recipe_sysroot after do_populate_sysroot
-do_addto_recipe_sysroot[deptask] = "do_populate_sysroot"
-
-PATH:prepend = "${COREBASE}/scripts/cross-intercept:"
diff --git a/poky/meta/classes/crosssdk.bbclass b/poky/meta/classes/crosssdk.bbclass
deleted file mode 100644
index 04aecb6..0000000
--- a/poky/meta/classes/crosssdk.bbclass
+++ /dev/null
@@ -1,51 +0,0 @@
-inherit cross
-
-CLASSOVERRIDE = "class-crosssdk"
-NATIVESDKLIBC ?= "libc-glibc"
-LIBCOVERRIDE = ":${NATIVESDKLIBC}"
-MACHINEOVERRIDES = ""
-PACKAGE_ARCH = "${SDK_ARCH}"
-
-python () {
-    # set TUNE_PKGARCH to SDK_ARCH
-    d.setVar('TUNE_PKGARCH', d.getVar('SDK_ARCH'))
-    # Set features here to prevent appends and distro features backfill
-    # from modifying nativesdk distro features
-    features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split())
-    filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split())
-    d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
-}
-
-STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-# This class encodes staging paths into its scripts data so can only be
-# reused if we manipulate the paths.
-SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
-
-TARGET_ARCH = "${SDK_ARCH}"
-TARGET_VENDOR = "${SDK_VENDOR}"
-TARGET_OS = "${SDK_OS}"
-TARGET_PREFIX = "${SDK_PREFIX}"
-TARGET_CC_ARCH = "${SDK_CC_ARCH}"
-TARGET_LD_ARCH = "${SDK_LD_ARCH}"
-TARGET_AS_ARCH = "${SDK_AS_ARCH}"
-TARGET_CPPFLAGS = ""
-TARGET_CFLAGS = ""
-TARGET_CXXFLAGS = ""
-TARGET_LDFLAGS = ""
-TARGET_FPU = ""
-
-
-target_libdir = "${SDKPATHNATIVE}${libdir_nativesdk}"
-target_includedir = "${SDKPATHNATIVE}${includedir_nativesdk}"
-target_base_libdir = "${SDKPATHNATIVE}${base_libdir_nativesdk}"
-target_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-target_exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-baselib = "lib"
-
-do_packagedata[stamp-extra-info] = ""
-
-# Need to force this to ensure consitency across architectures
-EXTRA_OECONF_GCC_FLOAT = ""
-
-USE_NLS = "no"
diff --git a/poky/meta/classes/cve-check.bbclass b/poky/meta/classes/cve-check.bbclass
index da7f933..4b4ea78 100644
--- a/poky/meta/classes/cve-check.bbclass
+++ b/poky/meta/classes/cve-check.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # This class is used to check recipes against public CVEs.
 #
 # In order to use this class just inherit the class in the
@@ -139,17 +145,18 @@
     """
     from oe.cve_check import get_patched_cves
 
-    if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
-        try:
-            patched_cves = get_patched_cves(d)
-        except FileNotFoundError:
-            bb.fatal("Failure in searching patches")
-        ignored, patched, unpatched, status = check_cves(d, patched_cves)
-        if patched or unpatched or (d.getVar("CVE_CHECK_COVERAGE") == "1" and status):
-            cve_data = get_cve_info(d, patched + unpatched + ignored)
-            cve_write_data(d, patched, unpatched, ignored, cve_data, status)
-    else:
-        bb.note("No CVE database found, skipping CVE check")
+    with bb.utils.fileslocked([d.getVar("CVE_CHECK_DB_FILE_LOCK")], shared=True):
+        if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
+            try:
+                patched_cves = get_patched_cves(d)
+            except FileNotFoundError:
+                bb.fatal("Failure in searching patches")
+            ignored, patched, unpatched, status = check_cves(d, patched_cves)
+            if patched or unpatched or (d.getVar("CVE_CHECK_COVERAGE") == "1" and status):
+                cve_data = get_cve_info(d, patched + unpatched + ignored)
+                cve_write_data(d, patched, unpatched, ignored, cve_data, status)
+        else:
+            bb.note("No CVE database found, skipping CVE check")
 
 }
 
@@ -290,7 +297,8 @@
             vendor = "%"
 
         # Find all relevant CVE IDs.
-        for cverow in conn.execute("SELECT DISTINCT ID FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR LIKE ?", (product, vendor)):
+        cve_cursor = conn.execute("SELECT DISTINCT ID FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR LIKE ?", (product, vendor))
+        for cverow in cve_cursor:
             cve = cverow[0]
 
             if cve in cve_ignore:
@@ -309,7 +317,8 @@
             vulnerable = False
             ignored = False
 
-            for row in conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor)):
+            product_cursor = conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor))
+            for row in product_cursor:
                 (_, _, _, version_start, operator_start, version_end, operator_end) = row
                 #bb.debug(2, "Evaluating row " + str(row))
                 if cve in cve_ignore:
@@ -353,10 +362,12 @@
                         bb.note("%s-%s is vulnerable to %s" % (pn, real_pv, cve))
                         cves_unpatched.append(cve)
                     break
+            product_cursor.close()
 
             if not vulnerable:
                 bb.note("%s-%s is not vulnerable to %s" % (pn, real_pv, cve))
                 patched_cves.add(cve)
+        cve_cursor.close()
 
         if not cves_in_product:
             bb.note("No CVE records found for product %s, pn %s" % (product, pn))
@@ -381,14 +392,15 @@
     conn = sqlite3.connect(db_file, uri=True)
 
     for cve in cves:
-        for row in conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,)):
+        cursor = conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,))
+        for row in cursor:
             cve_data[row[0]] = {}
             cve_data[row[0]]["summary"] = row[1]
             cve_data[row[0]]["scorev2"] = row[2]
             cve_data[row[0]]["scorev3"] = row[3]
             cve_data[row[0]]["modified"] = row[4]
             cve_data[row[0]]["vector"] = row[5]
-
+        cursor.close()
     conn.close()
     return cve_data
 
diff --git a/poky/meta/classes/debian.bbclass b/poky/meta/classes/debian.bbclass
deleted file mode 100644
index 8367be9..0000000
--- a/poky/meta/classes/debian.bbclass
+++ /dev/null
@@ -1,150 +0,0 @@
-# Debian package renaming only occurs when a package is built
-# We therefore have to make sure we build all runtime packages
-# before building the current package to make the packages runtime
-# depends are correct
-#
-# Custom library package names can be defined setting
-# DEBIANNAME: + pkgname to the desired name.
-#
-# Better expressed as ensure all RDEPENDS package before we package
-# This means we can't have circular RDEPENDS/RRECOMMENDS
-
-AUTO_LIBNAME_PKGS = "${PACKAGES}"
-
-inherit package
-
-DEBIANRDEP = "do_packagedata"
-do_package_write_ipk[deptask] = "${DEBIANRDEP}"
-do_package_write_deb[deptask] = "${DEBIANRDEP}"
-do_package_write_tar[deptask] = "${DEBIANRDEP}"
-do_package_write_rpm[deptask] = "${DEBIANRDEP}"
-do_package_write_ipk[rdeptask] = "${DEBIANRDEP}"
-do_package_write_deb[rdeptask] = "${DEBIANRDEP}"
-do_package_write_tar[rdeptask] = "${DEBIANRDEP}"
-do_package_write_rpm[rdeptask] = "${DEBIANRDEP}"
-
-python () {
-    if not d.getVar("PACKAGES"):
-        d.setVar("DEBIANRDEP", "")
-}
-
-python debian_package_name_hook () {
-    import glob, copy, stat, errno, re, pathlib, subprocess
-
-    pkgdest = d.getVar("PKGDEST")
-    packages = d.getVar('PACKAGES')
-    so_re = re.compile(r"lib.*\.so")
-
-    def socrunch(s):
-        s = s.lower().replace('_', '-')
-        m = re.match(r"^(.*)(.)\.so\.(.*)$", s)
-        if m is None:
-            return None
-        if m.group(2) in '0123456789':
-            bin = '%s%s-%s' % (m.group(1), m.group(2), m.group(3))
-        else:
-            bin = m.group(1) + m.group(2) + m.group(3)
-        dev = m.group(1) + m.group(2)
-        return (bin, dev)
-
-    def isexec(path):
-        try:
-            s = os.stat(path)
-        except (os.error, AttributeError):
-            return 0
-        return (s[stat.ST_MODE] & stat.S_IEXEC)
-
-    def add_rprovides(pkg, d):
-        newpkg = d.getVar('PKG:' + pkg)
-        if newpkg and newpkg != pkg:
-            provs = (d.getVar('RPROVIDES:' + pkg) or "").split()
-            if pkg not in provs:
-                d.appendVar('RPROVIDES:' + pkg, " " + pkg + " (=" + d.getVar("PKGV") + ")")
-
-    def auto_libname(packages, orig_pkg):
-        p = lambda var: pathlib.PurePath(d.getVar(var))
-        libdirs = (p("base_libdir"), p("libdir"))
-        bindirs = (p("base_bindir"), p("base_sbindir"), p("bindir"), p("sbindir"))
-
-        sonames = []
-        has_bins = 0
-        has_libs = 0
-        for f in pkgfiles[orig_pkg]:
-            # This is .../packages-split/orig_pkg/
-            pkgpath = pathlib.PurePath(pkgdest, orig_pkg)
-            # Strip pkgpath off the full path to a file in the package, re-root
-            # so it is absolute, and then get the parent directory of the file.
-            path = pathlib.PurePath("/") / (pathlib.PurePath(f).relative_to(pkgpath).parent)
-            if path in bindirs:
-                has_bins = 1
-            if path in libdirs:
-                has_libs = 1
-                if so_re.match(os.path.basename(f)):
-                    try:
-                        cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f]
-                        output = subprocess.check_output(cmd).decode("utf-8")
-                        for m in re.finditer(r"\s+SONAME\s+([^\s]+)", output):
-                            if m.group(1) not in sonames:
-                                sonames.append(m.group(1))
-                    except subprocess.CalledProcessError:
-                        pass
-        bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames))
-        soname = None
-        if len(sonames) == 1:
-            soname = sonames[0]
-        elif len(sonames) > 1:
-            lead = d.getVar('LEAD_SONAME')
-            if lead:
-                r = re.compile(lead)
-                filtered = []
-                for s in sonames:
-                    if r.match(s):
-                        filtered.append(s)
-                if len(filtered) == 1:
-                    soname = filtered[0]
-                elif len(filtered) > 1:
-                    bb.note("Multiple matches (%s) for LEAD_SONAME '%s'" % (", ".join(filtered), lead))
-                else:
-                    bb.note("Multiple libraries (%s) found, but LEAD_SONAME '%s' doesn't match any of them" % (", ".join(sonames), lead))
-            else:
-                bb.note("Multiple libraries (%s) found and LEAD_SONAME not defined" % ", ".join(sonames))
-
-        if has_libs and not has_bins and soname:
-            soname_result = socrunch(soname)
-            if soname_result:
-                (pkgname, devname) = soname_result
-                for pkg in packages.split():
-                    if (d.getVar('PKG:' + pkg, False) or d.getVar('DEBIAN_NOAUTONAME:' + pkg, False)):
-                        add_rprovides(pkg, d)
-                        continue
-                    debian_pn = d.getVar('DEBIANNAME:' + pkg, False)
-                    if debian_pn:
-                        newpkg = debian_pn
-                    elif pkg == orig_pkg:
-                        newpkg = pkgname
-                    else:
-                        newpkg = pkg.replace(orig_pkg, devname, 1)
-                    mlpre=d.getVar('MLPREFIX')
-                    if mlpre:
-                        if not newpkg.find(mlpre) == 0:
-                            newpkg = mlpre + newpkg
-                    if newpkg != pkg:
-                        bb.note("debian: renaming %s to %s" % (pkg, newpkg))
-                        d.setVar('PKG:' + pkg, newpkg)
-                        add_rprovides(pkg, d)
-        else:
-            add_rprovides(orig_pkg, d)
-
-    # reversed sort is needed when some package is substring of another
-    # ie in ncurses we get without reverse sort: 
-    # DEBUG: LIBNAMES: pkgname libtic5 devname libtic pkg ncurses-libtic orig_pkg ncurses-libtic debian_pn None newpkg libtic5
-    # and later
-    # DEBUG: LIBNAMES: pkgname libtic5 devname libtic pkg ncurses-libticw orig_pkg ncurses-libtic debian_pn None newpkg libticw
-    # so we need to handle ncurses-libticw->libticw5 before ncurses-libtic->libtic5
-    for pkg in sorted((d.getVar('AUTO_LIBNAME_PKGS') or "").split(), reverse=True):
-        auto_libname(packages, pkg)
-}
-
-EXPORT_FUNCTIONS package_name_hook
-
-DEBIAN_NAMES = "1"
diff --git a/poky/meta/classes/deploy.bbclass b/poky/meta/classes/deploy.bbclass
deleted file mode 100644
index 7fbffe9..0000000
--- a/poky/meta/classes/deploy.bbclass
+++ /dev/null
@@ -1,12 +0,0 @@
-DEPLOYDIR = "${WORKDIR}/deploy-${PN}"
-SSTATETASKS += "do_deploy"
-do_deploy[sstate-inputdirs] = "${DEPLOYDIR}"
-do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
-
-python do_deploy_setscene () {
-    sstate_setscene(d)
-}
-addtask do_deploy_setscene
-do_deploy[dirs] = "${B}"
-do_deploy[cleandirs] = "${DEPLOYDIR}"
-do_deploy[stamp-extra-info] = "${MACHINE_ARCH}"
diff --git a/poky/meta/classes/devicetree.bbclass b/poky/meta/classes/devicetree.bbclass
deleted file mode 100644
index 2a62ae7..0000000
--- a/poky/meta/classes/devicetree.bbclass
+++ /dev/null
@@ -1,148 +0,0 @@
-# This bbclass implements device tree compliation for user provided device tree
-# sources. The compilation of the device tree sources is the same as the kernel
-# device tree compilation process, this includes being able to include sources
-# from the kernel such as soc dtsi files or header files such as gpio.h. In
-# addition to device trees this bbclass also handles compilation of device tree
-# overlays.
-#
-# The output of this class behaves similar to how kernel-devicetree.bbclass
-# operates in that the output files are installed into /boot/devicetree.
-# However this class on purpose separates the deployed device trees into the
-# 'devicetree' subdirectory. This prevents clashes with the kernel-devicetree
-# output. Additionally the device trees are populated into the sysroot for
-# access via the sysroot from within other recipes.
-
-SECTION ?= "bsp"
-
-# The default inclusion of kernel device tree includes and headers means that
-# device trees built with them are at least GPL-2.0-only (and in some cases dual
-# licensed). Default to GPL-2.0-only if the recipe does not specify a license.
-LICENSE ?= "GPL-2.0-only"
-LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
-
-INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS += "dtc-native"
-
-inherit deploy kernel-arch
-
-COMPATIBLE_MACHINE ?= "^$"
-
-PROVIDES = "virtual/dtb"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-SYSROOT_DIRS += "/boot/devicetree"
-FILES:${PN} = "/boot/devicetree/*.dtb /boot/devicetree/*.dtbo"
-
-S = "${WORKDIR}"
-B = "${WORKDIR}/build"
-
-# Default kernel includes, these represent what are normally used for in-kernel
-# sources.
-KERNEL_INCLUDE ??= " \
-        ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts \
-        ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/* \
-        ${STAGING_KERNEL_DIR}/scripts/dtc/include-prefixes \
-        "
-
-DT_INCLUDE[doc] = "Search paths to be made available to both the device tree compiler and preprocessor for inclusion."
-DT_INCLUDE ?= "${DT_FILES_PATH} ${KERNEL_INCLUDE}"
-DT_FILES_PATH[doc] = "Defaults to source directory, can be used to select dts files that are not in source (e.g. generated)."
-DT_FILES_PATH ?= "${S}"
-
-DT_PADDING_SIZE[doc] = "Size of padding on the device tree blob, used as extra space typically for additional properties during boot."
-DT_PADDING_SIZE ??= "0x3000"
-DT_RESERVED_MAP[doc] = "Number of reserved map entires."
-DT_RESERVED_MAP ??= "8"
-DT_BOOT_CPU[doc] = "The boot cpu, defaults to 0"
-DT_BOOT_CPU ??= "0"
-
-DTC_FLAGS ?= "-R ${DT_RESERVED_MAP} -b ${DT_BOOT_CPU}"
-DTC_PPFLAGS ?= "-nostdinc -undef -D__DTS__ -x assembler-with-cpp"
-DTC_BFLAGS ?= "-p ${DT_PADDING_SIZE} -@"
-DTC_OFLAGS ?= "-p 0 -@ -H epapr"
-
-python () {
-    if d.getVar("KERNEL_INCLUDE"):
-        # auto add dependency on kernel tree, but only if kernel include paths
-        # are specified.
-        d.appendVarFlag("do_compile", "depends", " virtual/kernel:do_configure")
-}
-
-def expand_includes(varname, d):
-    import glob
-    includes = set()
-    # expand all includes with glob
-    for i in (d.getVar(varname) or "").split():
-        for g in glob.glob(i):
-            if os.path.isdir(g): # only add directories to include path
-                includes.add(g)
-    return includes
-
-def devicetree_source_is_overlay(path):
-    # determine if a dts file is an overlay by checking if it uses "/plugin/;"
-    with open(path, "r") as f:
-        for i in f:
-            if i.startswith("/plugin/;"):
-                return True
-    return False
-
-def devicetree_compile(dtspath, includes, d):
-    import subprocess
-    dts = os.path.basename(dtspath)
-    dtname = os.path.splitext(dts)[0]
-    bb.note("Processing {0} [{1}]".format(dtname, dts))
-
-    # preprocess
-    ppargs = d.getVar("BUILD_CPP").split()
-    ppargs += (d.getVar("DTC_PPFLAGS") or "").split()
-    for i in includes:
-        ppargs.append("-I{0}".format(i))
-    ppargs += ["-o", "{0}.pp".format(dts), dtspath]
-    bb.note("Running {0}".format(" ".join(ppargs)))
-    subprocess.run(ppargs, check = True)
-
-    # determine if the file is an overlay or not (using the preprocessed file)
-    isoverlay = devicetree_source_is_overlay("{0}.pp".format(dts))
-
-    # compile
-    dtcargs = ["dtc"] + (d.getVar("DTC_FLAGS") or "").split()
-    if isoverlay:
-        dtcargs += (d.getVar("DTC_OFLAGS") or "").split()
-    else:
-        dtcargs += (d.getVar("DTC_BFLAGS") or "").split()
-    for i in includes:
-        dtcargs += ["-i", i]
-    dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")]
-    dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)]
-    bb.note("Running {0}".format(" ".join(dtcargs)))
-    subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-
-python devicetree_do_compile() {
-    includes = expand_includes("DT_INCLUDE", d)
-    listpath = d.getVar("DT_FILES_PATH")
-    for dts in os.listdir(listpath):
-        dtspath = os.path.join(listpath, dts)
-        try:
-            if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)):
-                continue # skip non-.dts files and non-overlay files
-        except:
-            continue # skip if can't determine if overlay
-        devicetree_compile(dtspath, includes, d)
-}
-
-devicetree_do_install() {
-    for DTB_FILE in `ls *.dtb *.dtbo`; do
-        install -Dm 0644 ${B}/${DTB_FILE} ${D}/boot/devicetree/${DTB_FILE}
-    done
-}
-
-devicetree_do_deploy() {
-    for DTB_FILE in `ls *.dtb *.dtbo`; do
-        install -Dm 0644 ${B}/${DTB_FILE} ${DEPLOYDIR}/devicetree/${DTB_FILE}
-    done
-}
-addtask deploy before do_build after do_install
-
-EXPORT_FUNCTIONS do_compile do_install do_deploy
-
diff --git a/poky/meta/classes/devshell.bbclass b/poky/meta/classes/devshell.bbclass
deleted file mode 100644
index 247d044..0000000
--- a/poky/meta/classes/devshell.bbclass
+++ /dev/null
@@ -1,160 +0,0 @@
-inherit terminal
-
-DEVSHELL = "${SHELL}"
-
-PATH:prepend:task-devshell = "${COREBASE}/scripts/git-intercept:"
-
-python do_devshell () {
-    if d.getVarFlag("do_devshell", "manualfakeroot"):
-       d.prependVar("DEVSHELL", "pseudo ")
-       fakeenv = d.getVar("FAKEROOTENV").split()
-       for f in fakeenv:
-            k = f.split("=")
-            d.setVar(k[0], k[1])
-            d.appendVar("OE_TERMINAL_EXPORTS", " " + k[0])
-       d.delVarFlag("do_devshell", "fakeroot")
-
-    oe_terminal(d.getVar('DEVSHELL'), 'OpenEmbedded Developer Shell', d)
-}
-
-addtask devshell after do_patch do_prepare_recipe_sysroot
-
-# The directory that the terminal starts in
-DEVSHELL_STARTDIR ?= "${S}"
-do_devshell[dirs] = "${DEVSHELL_STARTDIR}"
-do_devshell[nostamp] = "1"
-do_devshell[network] = "1"
-
-# devshell and fakeroot/pseudo need careful handling since only the final
-# command should run under fakeroot emulation, any X connection should
-# be done as the normal user. We therfore carefully construct the envionment
-# manually
-python () {
-    if d.getVarFlag("do_devshell", "fakeroot"):
-       # We need to signal our code that we want fakeroot however we
-       # can't manipulate the environment and variables here yet (see YOCTO #4795)
-       d.setVarFlag("do_devshell", "manualfakeroot", "1")
-       d.delVarFlag("do_devshell", "fakeroot")
-} 
-
-def pydevshell(d):
-
-    import code
-    import select
-    import signal
-    import termios
-
-    m, s = os.openpty()
-    sname = os.ttyname(s)
-
-    def noechoicanon(fd):
-        old = termios.tcgetattr(fd)
-        old[3] = old[3] &~ termios.ECHO &~ termios.ICANON
-        # &~ termios.ISIG
-        termios.tcsetattr(fd, termios.TCSADRAIN, old)
-
-    # No echo or buffering over the pty
-    noechoicanon(s)
-
-    pid = os.fork()
-    if pid:
-        os.close(m)
-        oe_terminal("oepydevshell-internal.py %s %d" % (sname, pid), 'OpenEmbedded Developer PyShell', d)
-        os._exit(0)
-    else:
-        os.close(s)
-
-        os.dup2(m, sys.stdin.fileno())
-        os.dup2(m, sys.stdout.fileno())
-        os.dup2(m, sys.stderr.fileno())
-
-        bb.utils.nonblockingfd(sys.stdout)
-        bb.utils.nonblockingfd(sys.stderr)
-        bb.utils.nonblockingfd(sys.stdin)
-
-        _context = {
-            "os": os,
-            "bb": bb,
-            "time": time,
-            "d": d,
-        }
-
-        ps1 = "pydevshell> "
-        ps2 = "... "
-        buf = []
-        more = False
-
-        i = code.InteractiveInterpreter(locals=_context)
-        print("OE PyShell (PN = %s)\n" % d.getVar("PN"))
-
-        def prompt(more):
-            if more:
-                prompt = ps2
-            else:
-                prompt = ps1
-            sys.stdout.write(prompt)
-            sys.stdout.flush()
-
-        # Restore Ctrl+C since bitbake masks this
-        def signal_handler(signal, frame):
-            raise KeyboardInterrupt
-        signal.signal(signal.SIGINT, signal_handler)
-
-        child = None
-
-        prompt(more)
-        while True:
-            try:
-                try:
-                    (r, _, _) = select.select([sys.stdin], [], [], 1)
-                    if not r:
-                        continue
-                    line = sys.stdin.readline().strip()
-                    if not line:
-                        prompt(more)
-                        continue
-                except EOFError as e:
-                    sys.stdout.write("\n")
-                    sys.stdout.flush()
-                except (OSError, IOError) as e:
-                    if e.errno == 11:
-                        continue
-                    if e.errno == 5:
-                        return
-                    raise
-                else:
-                    if not child:
-                        child = int(line)
-                        continue
-                    buf.append(line)
-                    source = "\n".join(buf)
-                    more = i.runsource(source, "<pyshell>")
-                    if not more:
-                        buf = []
-                    sys.stderr.flush()
-                    prompt(more)
-            except KeyboardInterrupt:
-                i.write("\nKeyboardInterrupt\n")
-                buf = []
-                more = False
-                prompt(more)
-            except SystemExit:
-                # Easiest way to ensure everything exits
-                os.kill(child, signal.SIGTERM)
-                break
-
-python do_pydevshell() {
-    import signal
-
-    try:
-        pydevshell(d)
-    except SystemExit:
-        # Stop the SIGTERM above causing an error exit code
-        return
-    finally:
-        return
-}
-addtask pydevshell after do_patch
-
-do_pydevshell[nostamp] = "1"
-do_pydevshell[network] = "1"
diff --git a/poky/meta/classes/devtool-source.bbclass b/poky/meta/classes/devtool-source.bbclass
index 41900e6..a02b1e9 100644
--- a/poky/meta/classes/devtool-source.bbclass
+++ b/poky/meta/classes/devtool-source.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Development tool - source extraction helper class
 #
 # NOTE: this class is intended for use by devtool and should not be
diff --git a/poky/meta/classes/devupstream.bbclass b/poky/meta/classes/devupstream.bbclass
deleted file mode 100644
index ba6dc41..0000000
--- a/poky/meta/classes/devupstream.bbclass
+++ /dev/null
@@ -1,55 +0,0 @@
-# Class for use in BBCLASSEXTEND to make it easier to have a single recipe that
-# can build both stable tarballs and snapshots from upstream source
-# repositories.
-#
-# Usage:
-# BBCLASSEXTEND = "devupstream:target"
-# SRC_URI:class-devupstream = "git://git.example.com/example;branch=master"
-# SRCREV:class-devupstream = "abcdef"
-#
-# If the first entry in SRC_URI is a git: URL then S is rewritten to
-# WORKDIR/git.
-#
-# There are a few caveats that remain to be solved:
-# - You can't build native or nativesdk recipes using for example
-#   devupstream:native, you can only build target recipes.
-# - If the fetcher requires native tools (such as subversion-native) then
-#   bitbake won't be able to add them automatically.
-
-python devupstream_virtclass_handler () {
-    # Do nothing if this is inherited, as it's for BBCLASSEXTEND
-    if "devupstream" not in (d.getVar('BBCLASSEXTEND') or ""):
-        bb.error("Don't inherit devupstream, use BBCLASSEXTEND")
-        return
-
-    variant = d.getVar("BBEXTENDVARIANT")
-    if variant not in ("target", "native"):
-        bb.error("Unsupported variant %s. Pass the variant when using devupstream, for example devupstream:target" % variant)
-        return
-
-    # Develpment releases are never preferred by default
-    d.setVar("DEFAULT_PREFERENCE", "-1")
-
-    src_uri = d.getVar("SRC_URI:class-devupstream") or d.getVar("SRC_URI")
-    uri = bb.fetch2.URI(src_uri.split()[0])
-
-    if uri.scheme == "git" and not d.getVar("S:class-devupstream"):
-        d.setVar("S", "${WORKDIR}/git")
-
-    # Modify the PV if the recipe hasn't already overridden it
-    pv = d.getVar("PV")
-    proto_marker = "+" + uri.scheme
-    if proto_marker not in pv and not d.getVar("PV:class-devupstream"):
-        d.setVar("PV", pv + proto_marker + "${SRCPV}")
-
-    if variant == "native":
-        pn = d.getVar("PN")
-        d.setVar("PN", "%s-native" % (pn))
-        fn = d.getVar("FILE")
-        bb.parse.BBHandler.inherit("native", fn, 0, d)
-
-    d.appendVar("CLASSOVERRIDE", ":class-devupstream")
-}
-
-addhandler devupstream_virtclass_handler
-devupstream_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
diff --git a/poky/meta/classes/distro_features_check.bbclass b/poky/meta/classes/distro_features_check.bbclass
deleted file mode 100644
index 8124a8c..0000000
--- a/poky/meta/classes/distro_features_check.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-# Temporarily provide fallback to the old name of the class
-
-python __anonymous() {
-    bb.warn("distro_features_check.bbclass is deprecated, please use features_check.bbclass instead")
-}
-
-inherit features_check
diff --git a/poky/meta/classes/distrooverrides.bbclass b/poky/meta/classes/distrooverrides.bbclass
index bf3a2b2..8d9d7cd 100644
--- a/poky/meta/classes/distrooverrides.bbclass
+++ b/poky/meta/classes/distrooverrides.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Turns certain DISTRO_FEATURES into overrides with the same
 # name plus a df- prefix. Ensures that these special
 # distro features remain set also for native and nativesdk
diff --git a/poky/meta/classes/dos2unix.bbclass b/poky/meta/classes/dos2unix.bbclass
deleted file mode 100644
index 3fc17e2..0000000
--- a/poky/meta/classes/dos2unix.bbclass
+++ /dev/null
@@ -1,14 +0,0 @@
-# Class for use to convert all CRLF line terminators to LF
-# provided that some projects are being developed/maintained
-# on Windows so they have different line terminators(CRLF) vs
-# on Linux(LF), which can cause annoying patching errors during
-# git push/checkout processes.
-
-do_convert_crlf_to_lf[depends] += "dos2unix-native:do_populate_sysroot"
-
-# Convert CRLF line terminators to LF
-do_convert_crlf_to_lf () {
-	find ${S} -type f -exec dos2unix {} \;
-}
-
-addtask convert_crlf_to_lf after do_unpack before do_patch
diff --git a/poky/meta/classes/externalsrc.bbclass b/poky/meta/classes/externalsrc.bbclass
deleted file mode 100644
index 90792a7..0000000
--- a/poky/meta/classes/externalsrc.bbclass
+++ /dev/null
@@ -1,268 +0,0 @@
-# Copyright (C) 2012 Linux Foundation
-# Author: Richard Purdie
-# Some code and influence taken from srctree.bbclass:
-# Copyright (C) 2009 Chris Larson <clarson@kergoth.com>
-# Released under the MIT license (see COPYING.MIT for the terms)
-#
-# externalsrc.bbclass enables use of an existing source tree, usually external to
-# the build system to build a piece of software rather than the usual fetch/unpack/patch
-# process.
-#
-# To use, add externalsrc to the global inherit and set EXTERNALSRC to point at the
-# directory you want to use containing the sources e.g. from local.conf for a recipe
-# called "myrecipe" you would do:
-#
-# INHERIT += "externalsrc"
-# EXTERNALSRC:pn-myrecipe = "/path/to/my/source/tree"
-#
-# In order to make this class work for both target and native versions (or with
-# multilibs/cross or other BBCLASSEXTEND variants), B is set to point to a separate
-# directory under the work directory (split source and build directories). This is
-# the default, but the build directory can be set to the source directory if
-# circumstances dictate by setting EXTERNALSRC_BUILD to the same value, e.g.:
-#
-# EXTERNALSRC_BUILD:pn-myrecipe = "/path/to/my/source/tree"
-#
-
-SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
-EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}"
-
-python () {
-    externalsrc = d.getVar('EXTERNALSRC')
-    externalsrcbuild = d.getVar('EXTERNALSRC_BUILD')
-
-    if externalsrc and not externalsrc.startswith("/"):
-        bb.error("EXTERNALSRC must be an absolute path")
-    if externalsrcbuild and not externalsrcbuild.startswith("/"):
-        bb.error("EXTERNALSRC_BUILD must be an absolute path")
-
-    # If this is the base recipe and EXTERNALSRC is set for it or any of its
-    # derivatives, then enable BB_DONT_CACHE to force the recipe to always be
-    # re-parsed so that the file-checksums function for do_compile is run every
-    # time.
-    bpn = d.getVar('BPN')
-    classextend = (d.getVar('BBCLASSEXTEND') or '').split()
-    if bpn == d.getVar('PN') or not classextend:
-        if (externalsrc or
-                ('native' in classextend and
-                 d.getVar('EXTERNALSRC:pn-%s-native' % bpn)) or
-                ('nativesdk' in classextend and
-                 d.getVar('EXTERNALSRC:pn-nativesdk-%s' % bpn)) or
-                ('cross' in classextend and
-                 d.getVar('EXTERNALSRC:pn-%s-cross' % bpn))):
-            d.setVar('BB_DONT_CACHE', '1')
-
-    if externalsrc:
-        import oe.recipeutils
-        import oe.path
-
-        d.setVar('S', externalsrc)
-        if externalsrcbuild:
-            d.setVar('B', externalsrcbuild)
-        else:
-            d.setVar('B', '${WORKDIR}/${BPN}-${PV}/')
-
-        local_srcuri = []
-        fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
-        for url in fetch.urls:
-            url_data = fetch.ud[url]
-            parm = url_data.parm
-            if (url_data.type == 'file' or
-                    url_data.type == 'npmsw' or url_data.type == 'crate' or
-                    'type' in parm and parm['type'] == 'kmeta'):
-                local_srcuri.append(url)
-
-        d.setVar('SRC_URI', ' '.join(local_srcuri))
-
-        # Dummy value because the default function can't be called with blank SRC_URI
-        d.setVar('SRCPV', '999')
-
-        if d.getVar('CONFIGUREOPT_DEPTRACK') == '--disable-dependency-tracking':
-            d.setVar('CONFIGUREOPT_DEPTRACK', '')
-
-        tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys())
-
-        for task in tasks:
-            if task.endswith("_setscene"):
-                # sstate is never going to work for external source trees, disable it
-                bb.build.deltask(task, d)
-            elif os.path.realpath(d.getVar('S')) == os.path.realpath(d.getVar('B')):
-                # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
-                d.appendVarFlag(task, "lockfiles", " ${S}/singletask.lock")
-
-            for funcname in [task, "base_" + task, "kernel_" + task]:
-                # We do not want our source to be wiped out, ever (kernel.bbclass does this for do_clean)
-                cleandirs = oe.recipeutils.split_var_value(d.getVarFlag(funcname, 'cleandirs', False) or '')
-                setvalue = False
-                for cleandir in cleandirs[:]:
-                    if oe.path.is_path_parent(externalsrc, d.expand(cleandir)):
-                        cleandirs.remove(cleandir)
-                        setvalue = True
-                if setvalue:
-                    d.setVarFlag(funcname, 'cleandirs', ' '.join(cleandirs))
-
-        fetch_tasks = ['do_fetch', 'do_unpack']
-        # If we deltask do_patch, there's no dependency to ensure do_unpack gets run, so add one
-        # Note that we cannot use d.appendVarFlag() here because deps is expected to be a list object, not a string
-        d.setVarFlag('do_configure', 'deps', (d.getVarFlag('do_configure', 'deps', False) or []) + ['do_unpack'])
-
-        for task in d.getVar("SRCTREECOVEREDTASKS").split():
-            if local_srcuri and task in fetch_tasks:
-                continue
-            bb.build.deltask(task, d)
-            if task == 'do_unpack':
-                # The reproducible build create_source_date_epoch_stamp function must
-                # be run after the source is available and before the
-                # do_deploy_source_date_epoch task.  In the normal case, it's attached
-                # to do_unpack as a postfuncs, but since we removed do_unpack (above)
-                # we need to move the function elsewhere.  The easiest thing to do is
-                # move it into the prefuncs of the do_deploy_source_date_epoch task.
-                # This is safe, as externalsrc runs with the source already unpacked.
-                d.prependVarFlag('do_deploy_source_date_epoch', 'prefuncs', 'create_source_date_epoch_stamp ')
-
-        d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ")
-        d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ")
-
-        d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}')
-        d.setVarFlag('do_configure', 'file-checksums', '${@srctree_configure_hash_files(d)}')
-
-        # We don't want the workdir to go away
-        d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN'))
-
-        bb.build.addtask('do_buildclean',
-                         'do_clean' if d.getVar('S') == d.getVar('B') else None,
-                         None, d)
-
-        # If B=S the same builddir is used even for different architectures.
-        # Thus, use a shared CONFIGURESTAMPFILE and STAMP directory so that
-        # change of do_configure task hash is correctly detected and stamps are
-        # invalidated if e.g. MACHINE changes.
-        if d.getVar('S') == d.getVar('B'):
-            configstamp = '${TMPDIR}/work-shared/${PN}/${EXTENDPE}${PV}-${PR}/configure.sstate'
-            d.setVar('CONFIGURESTAMPFILE', configstamp)
-            d.setVar('STAMP', '${STAMPS_DIR}/work-shared/${PN}/${EXTENDPE}${PV}-${PR}')
-            d.setVar('STAMPCLEAN', '${STAMPS_DIR}/work-shared/${PN}/*-*')
-}
-
-python externalsrc_configure_prefunc() {
-    s_dir = d.getVar('S')
-    # Create desired symlinks
-    symlinks = (d.getVar('EXTERNALSRC_SYMLINKS') or '').split()
-    newlinks = []
-    for symlink in symlinks:
-        symsplit = symlink.split(':', 1)
-        lnkfile = os.path.join(s_dir, symsplit[0])
-        target = d.expand(symsplit[1])
-        if len(symsplit) > 1:
-            if os.path.islink(lnkfile):
-                # Link already exists, leave it if it points to the right location already
-                if os.readlink(lnkfile) == target:
-                    continue
-                os.unlink(lnkfile)
-            elif os.path.exists(lnkfile):
-                # File/dir exists with same name as link, just leave it alone
-                continue
-            os.symlink(target, lnkfile)
-            newlinks.append(symsplit[0])
-    # Hide the symlinks from git
-    try:
-        git_exclude_file = os.path.join(s_dir, '.git/info/exclude')
-        if os.path.exists(git_exclude_file):
-            with open(git_exclude_file, 'r+') as efile:
-                elines = efile.readlines()
-                for link in newlinks:
-                    if link in elines or '/'+link in elines:
-                        continue
-                    efile.write('/' + link + '\n')
-    except IOError as ioe:
-        bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git')
-}
-
-python externalsrc_compile_prefunc() {
-    # Make it obvious that this is happening, since forgetting about it could lead to much confusion
-    bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN'), d.getVar('EXTERNALSRC')))
-}
-
-do_buildclean[dirs] = "${S} ${B}"
-do_buildclean[nostamp] = "1"
-do_buildclean[doc] = "Call 'make clean' or equivalent in ${B}"
-externalsrc_do_buildclean() {
-	if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
-		rm -f ${@' '.join([x.split(':')[0] for x in (d.getVar('EXTERNALSRC_SYMLINKS') or '').split()])}
-		if [ "${CLEANBROKEN}" != "1" ]; then
-			oe_runmake clean || die "make failed"
-		fi
-	else
-		bbnote "nothing to do - no makefile found"
-	fi
-}
-
-def srctree_hash_files(d, srcdir=None):
-    import shutil
-    import subprocess
-    import tempfile
-    import hashlib
-
-    s_dir = srcdir or d.getVar('EXTERNALSRC')
-    git_dir = None
-
-    try:
-        git_dir = os.path.join(s_dir,
-            subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
-        top_git_dir = os.path.join(s_dir, subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'],
-            stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
-        if git_dir == top_git_dir:
-            git_dir = None
-    except subprocess.CalledProcessError:
-        pass
-
-    ret = " "
-    if git_dir is not None:
-        oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1-%s' % d.getVar('PN'))
-        with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index:
-            # Clone index
-            shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name)
-            # Update our custom index
-            env = os.environ.copy()
-            env['GIT_INDEX_FILE'] = tmp_index.name
-            subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env)
-            git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8")
-            submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8")
-            for line in submodule_helper.splitlines():
-                module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1])
-                if os.path.isdir(module_dir):
-                    proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
-                    proc.communicate()
-                    proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
-                    stdout, _ = proc.communicate()
-                    git_sha1 += stdout.decode("utf-8")
-            sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
-        with open(oe_hash_file, 'w') as fobj:
-            fobj.write(sha1)
-        ret = oe_hash_file + ':True'
-    else:
-        ret = s_dir + '/*:True'
-    return ret
-
-def srctree_configure_hash_files(d):
-    """
-    Get the list of files that should trigger do_configure to re-execute,
-    based on the value of CONFIGURE_FILES
-    """
-    in_files = (d.getVar('CONFIGURE_FILES') or '').split()
-    out_items = []
-    search_files = []
-    for entry in in_files:
-        if entry.startswith('/'):
-            out_items.append('%s:%s' % (entry, os.path.exists(entry)))
-        else:
-            search_files.append(entry)
-    if search_files:
-        s_dir = d.getVar('EXTERNALSRC')
-        for root, _, files in os.walk(s_dir):
-            for f in files:
-                if f in search_files:
-                    out_items.append('%s:True' % os.path.join(root, f))
-    return ' '.join(out_items)
-
-EXPORT_FUNCTIONS do_buildclean
diff --git a/poky/meta/classes/extrausers.bbclass b/poky/meta/classes/extrausers.bbclass
index a8ef660..94576b8 100644
--- a/poky/meta/classes/extrausers.bbclass
+++ b/poky/meta/classes/extrausers.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # This bbclass is used for image level user/group configuration.
 # Inherit this class if you want to make EXTRA_USERS_PARAMS effective.
 
diff --git a/poky/meta/classes/features_check.bbclass b/poky/meta/classes/features_check.bbclass
deleted file mode 100644
index 3ef6b35..0000000
--- a/poky/meta/classes/features_check.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-# Allow checking of required and conflicting features
-#
-# xxx = [DISTRO,MACHINE,COMBINED,IMAGE]
-#
-# ANY_OF_xxx_FEATURES:        ensure at least one item on this list is included
-#                             in xxx_FEATURES.
-# REQUIRED_xxx_FEATURES:      ensure every item on this list is included
-#                             in xxx_FEATURES.
-# CONFLICT_xxx_FEATURES:      ensure no item in this list is included in
-#                             xxx_FEATURES.
-#
-# Copyright 2019 (C) Texas Instruments Inc.
-# Copyright 2013 (C) O.S. Systems Software LTDA.
-
-python () {
-    if d.getVar('PARSE_ALL_RECIPES', False):
-        return
-
-    unused = True
-
-    for kind in ['DISTRO', 'MACHINE', 'COMBINED', 'IMAGE']:
-        if d.getVar('ANY_OF_' + kind + '_FEATURES') is None and not d.hasOverrides('ANY_OF_' + kind + '_FEATURES') and \
-           d.getVar('REQUIRED_' + kind + '_FEATURES') is None and not d.hasOverrides('REQUIRED_' + kind + '_FEATURES') and \
-           d.getVar('CONFLICT_' + kind + '_FEATURES') is None and not d.hasOverrides('CONFLICT_' + kind + '_FEATURES'):
-            continue
-
-        unused = False
-
-        # Assume at least one var is set.
-        features = set((d.getVar(kind + '_FEATURES') or '').split())
-
-        any_of_features = set((d.getVar('ANY_OF_' + kind + '_FEATURES') or '').split())
-        if any_of_features:
-            if set.isdisjoint(any_of_features, features):
-                raise bb.parse.SkipRecipe("one of '%s' needs to be in %s_FEATURES"
-                    % (' '.join(any_of_features), kind))
-
-        required_features = set((d.getVar('REQUIRED_' + kind + '_FEATURES') or '').split())
-        if required_features:
-            missing = set.difference(required_features, features)
-            if missing:
-                raise bb.parse.SkipRecipe("missing required %s feature%s '%s' (not in %s_FEATURES)"
-                    % (kind.lower(), 's' if len(missing) > 1 else '', ' '.join(missing), kind))
-
-        conflict_features = set((d.getVar('CONFLICT_' + kind + '_FEATURES') or '').split())
-        if conflict_features:
-            conflicts = set.intersection(conflict_features, features)
-            if conflicts:
-                raise bb.parse.SkipRecipe("conflicting %s feature%s '%s' (in %s_FEATURES)"
-                    % (kind.lower(), 's' if len(conflicts) > 1 else '', ' '.join(conflicts), kind))
-
-    if unused:
-        bb.warn("Recipe inherits features_check but doesn't use it")
-}
diff --git a/poky/meta/classes/fontcache.bbclass b/poky/meta/classes/fontcache.bbclass
deleted file mode 100644
index 442bfc7..0000000
--- a/poky/meta/classes/fontcache.bbclass
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# This class will generate the proper postinst/postrm scriptlets for font
-# packages.
-#
-
-PACKAGE_WRITE_DEPS += "qemu-native"
-inherit qemu
-
-FONT_PACKAGES ??= "${PN}"
-FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils"
-FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig"
-FONTCONFIG_CACHE_PARAMS ?= "-v"
-# You can change this to e.g. FC_DEBUG=16 to debug fc-cache issues,
-# something has to be set, because qemuwrapper is using this variable after -E
-# multiple variables aren't allowed because for qemu they are separated
-# by comma and in -n "$D" case they should be separated by space
-FONTCONFIG_CACHE_ENV ?= "FC_DEBUG=1"
-fontcache_common() {
-if [ -n "$D" ] ; then
-	$INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \
-		'bindir="${bindir}"' \
-		'libdir="${libdir}"' \
-		'libexecdir="${libexecdir}"' \
-		'base_libdir="${base_libdir}"' \
-		'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \
-		'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \
-		'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"'
-else
-	${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS}
-fi
-}
-
-python () {
-    font_pkgs = d.getVar('FONT_PACKAGES').split()
-    deps = d.getVar("FONT_EXTRA_RDEPENDS")
-
-    for pkg in font_pkgs:
-        if deps: d.appendVar('RDEPENDS:' + pkg, ' '+deps)
-}
-
-python add_fontcache_postinsts() {
-    for pkg in d.getVar('FONT_PACKAGES').split():
-        bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
-        postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
-        if not postinst:
-            postinst = '#!/bin/sh\n'
-        postinst += d.getVar('fontcache_common')
-        d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
-        if not postrm:
-            postrm = '#!/bin/sh\n'
-        postrm += d.getVar('fontcache_common')
-        d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
-PACKAGEFUNCS =+ "add_fontcache_postinsts"
diff --git a/poky/meta/classes/fs-uuid.bbclass b/poky/meta/classes/fs-uuid.bbclass
deleted file mode 100644
index 9b53dfb..0000000
--- a/poky/meta/classes/fs-uuid.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-# Extract UUID from ${ROOTFS}, which must have been built
-# by the time that this function gets called. Only works
-# on ext file systems and depends on tune2fs.
-def get_rootfs_uuid(d):
-    import subprocess
-    rootfs = d.getVar('ROOTFS')
-    output = subprocess.check_output(['tune2fs', '-l', rootfs])
-    for line in output.split('\n'):
-        if line.startswith('Filesystem UUID:'):
-            uuid = line.split()[-1]
-            bb.note('UUID of %s: %s' % (rootfs, uuid))
-            return uuid
-    bb.fatal('Could not determine filesystem UUID of %s' % rootfs)
-
-# Replace the special <<uuid-of-rootfs>> inside a string (like the
-# root= APPEND string in a syslinux.cfg or systemd-boot entry) with the
-# actual UUID of the rootfs. Does nothing if the special string
-# is not used.
-def replace_rootfs_uuid(d, string):
-    UUID_PLACEHOLDER = '<<uuid-of-rootfs>>'
-    if UUID_PLACEHOLDER in string:
-        uuid = get_rootfs_uuid(d)
-        string = string.replace(UUID_PLACEHOLDER, uuid)
-    return string
diff --git a/poky/meta/classes/gconf.bbclass b/poky/meta/classes/gconf.bbclass
deleted file mode 100644
index 9d3668e..0000000
--- a/poky/meta/classes/gconf.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-DEPENDS += "gconf"
-PACKAGE_WRITE_DEPS += "gconf-native"
-
-# These are for when gconftool is used natively and the prefix isn't necessarily
-# the sysroot.  TODO: replicate the postinst logic for -native packages going
-# into sysroot as they won't be running their own install-time schema
-# registration (disabled below) nor the postinst script (as they don't happen).
-export GCONF_SCHEMA_INSTALL_SOURCE = "xml:merged:${STAGING_DIR_NATIVE}${sysconfdir}/gconf/gconf.xml.defaults"
-export GCONF_BACKEND_DIR = "${STAGING_LIBDIR_NATIVE}/GConf/2"
-
-# Disable install-time schema registration as we're a packaging system so this
-# happens in the postinst script, not at install time.  Set both the configure
-# script option and the traditional envionment variable just to make sure.
-EXTRA_OECONF += "--disable-schemas-install"
-export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL = "1"
-
-gconf_postinst() {
-if [ "x$D" != "x" ]; then
-	export GCONF_CONFIG_SOURCE="xml::$D${sysconfdir}/gconf/gconf.xml.defaults"
-else
-	export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
-fi
-
-SCHEMA_LOCATION=$D/etc/gconf/schemas
-for SCHEMA in ${SCHEMA_FILES}; do
-	if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
-		HOME=$D/root gconftool-2 \
-			--makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
-	fi
-done
-}
-
-gconf_prerm() {
-SCHEMA_LOCATION=/etc/gconf/schemas
-for SCHEMA in ${SCHEMA_FILES}; do
-	if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
-		HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
-			gconftool-2 \
-			--makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
-	fi
-done
-}
-
-python populate_packages:append () {
-    import re
-    packages = d.getVar('PACKAGES').split()
-    pkgdest =  d.getVar('PKGDEST')
-    
-    for pkg in packages:
-        schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
-        schemas = []
-        schema_re = re.compile(r".*\.schemas$")
-        if os.path.exists(schema_dir):
-            for f in os.listdir(schema_dir):
-                if schema_re.match(f):
-                    schemas.append(f)
-        if schemas != []:
-            bb.note("adding gconf postinst and prerm scripts to %s" % pkg)
-            d.setVar('SCHEMA_FILES', " ".join(schemas))
-            postinst = d.getVar('pkg_postinst:%s' % pkg)
-            if not postinst:
-                postinst = '#!/bin/sh\n'
-            postinst += d.getVar('gconf_postinst')
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-            prerm = d.getVar('pkg_prerm:%s' % pkg)
-            if not prerm:
-                prerm = '#!/bin/sh\n'
-            prerm += d.getVar('gconf_prerm')
-            d.setVar('pkg_prerm:%s' % pkg, prerm)
-            d.appendVar("RDEPENDS:%s" % pkg, ' ' + d.getVar('MLPREFIX', False) + 'gconf')
-}
diff --git a/poky/meta/classes/gettext.bbclass b/poky/meta/classes/gettext.bbclass
deleted file mode 100644
index f11cb04..0000000
--- a/poky/meta/classes/gettext.bbclass
+++ /dev/null
@@ -1,22 +0,0 @@
-def gettext_dependencies(d):
-    if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'):
-        return ""
-    if d.getVar('USE_NLS') == 'no':
-        return "gettext-minimal-native"
-    return "gettext-native"
-
-def gettext_oeconf(d):
-    if d.getVar('USE_NLS') == 'no':
-        return '--disable-nls'
-    # Remove the NLS bits if USE_NLS is no or INHIBIT_DEFAULT_DEPS is set
-    if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'):
-        return '--disable-nls'
-    return "--enable-nls"
-
-BASEDEPENDS:append = " ${@gettext_dependencies(d)}"
-EXTRA_OECONF:append = " ${@gettext_oeconf(d)}"
-
-# Without this, msgfmt from gettext-native will not find ITS files
-# provided by target recipes (for example, polkit.its).
-GETTEXTDATADIRS:append:class-target = ":${STAGING_DATADIR}/gettext"
-export GETTEXTDATADIRS
diff --git a/poky/meta/classes/gi-docgen.bbclass b/poky/meta/classes/gi-docgen.bbclass
deleted file mode 100644
index 15581ca..0000000
--- a/poky/meta/classes/gi-docgen.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-# gi-docgen is a new gnome documentation generator, which
-# seems to be a successor to gtk-doc:
-# https://gitlab.gnome.org/GNOME/gi-docgen
-
-# This variable is set to True if api-documentation is in
-# DISTRO_FEATURES, and False otherwise.
-GIDOCGEN_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'True', 'False', d)}"
-# When building native recipes, disable gi-docgen, as it is not necessary,
-# pulls in additional dependencies, and makes build times longer
-GIDOCGEN_ENABLED:class-native = "False"
-GIDOCGEN_ENABLED:class-nativesdk = "False"
-
-# meson: default option name to enable/disable gi-docgen. This matches most
-# projects' configuration. In doubts - check meson_options.txt in project's
-# source path.
-GIDOCGEN_MESON_OPTION ?= 'gtk_doc'
-GIDOCGEN_MESON_ENABLE_FLAG ?= 'true'
-GIDOCGEN_MESON_DISABLE_FLAG ?= 'false'
-
-# Auto enable/disable based on GIDOCGEN_ENABLED
-EXTRA_OEMESON:prepend = "-D${GIDOCGEN_MESON_OPTION}=${@bb.utils.contains('GIDOCGEN_ENABLED', 'True', '${GIDOCGEN_MESON_ENABLE_FLAG}', '${GIDOCGEN_MESON_DISABLE_FLAG}', d)} "
-
-DEPENDS:append = "${@' gi-docgen-native gi-docgen' if d.getVar('GIDOCGEN_ENABLED') == 'True' else ''}"
-
diff --git a/poky/meta/classes/gio-module-cache.bbclass b/poky/meta/classes/gio-module-cache.bbclass
deleted file mode 100644
index 021eeb1..0000000
--- a/poky/meta/classes/gio-module-cache.bbclass
+++ /dev/null
@@ -1,38 +0,0 @@
-PACKAGE_WRITE_DEPS += "qemu-native"
-inherit qemu
-
-GIO_MODULE_PACKAGES ??= "${PN}"
-
-gio_module_cache_common() {
-if [ "x$D" != "x" ]; then
-    $INTERCEPT_DIR/postinst_intercept update_gio_module_cache ${PKG} \
-            mlprefix=${MLPREFIX} \
-            binprefix=${MLPREFIX} \
-            libdir=${libdir} \
-            libexecdir=${libexecdir} \
-            base_libdir=${base_libdir} \
-            bindir=${bindir}
-else
-    ${libexecdir}/${MLPREFIX}gio-querymodules ${libdir}/gio/modules/
-fi
-}
-
-python populate_packages:append () {
-    packages = d.getVar('GIO_MODULE_PACKAGES').split()
-
-    for pkg in packages:
-        bb.note("adding gio-module-cache postinst and postrm scripts to %s" % pkg)
-
-        postinst = d.getVar('pkg_postinst:%s' % pkg)
-        if not postinst:
-            postinst = '#!/bin/sh\n'
-        postinst += d.getVar('gio_module_cache_common')
-        d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        postrm = d.getVar('pkg_postrm:%s' % pkg)
-        if not postrm:
-            postrm = '#!/bin/sh\n'
-        postrm += d.getVar('gio_module_cache_common')
-        d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
diff --git a/poky/meta/classes/glide.bbclass b/poky/meta/classes/glide.bbclass
deleted file mode 100644
index 2db4ac6..0000000
--- a/poky/meta/classes/glide.bbclass
+++ /dev/null
@@ -1,9 +0,0 @@
-# Handle Glide Vendor Package Management use
-#
-# Copyright 2018 (C) O.S. Systems Software LTDA.
-
-DEPENDS:append = " glide-native"
-
-do_compile:prepend() {
-    ( cd ${B}/src/${GO_IMPORT} && glide install )
-}
diff --git a/poky/meta/classes/gnomebase.bbclass b/poky/meta/classes/gnomebase.bbclass
deleted file mode 100644
index 9a5bd9a..0000000
--- a/poky/meta/classes/gnomebase.bbclass
+++ /dev/null
@@ -1,31 +0,0 @@
-def gnome_verdir(v):
-    return ".".join(v.split(".")[:-1])
-
-
-GNOME_COMPRESS_TYPE ?= "xz"
-SECTION ?= "x11/gnome"
-GNOMEBN ?= "${BPN}"
-SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@gnome_verdir("${PV}")}/${GNOMEBN}-${PV}.tar.${GNOME_COMPRESS_TYPE};name=archive"
-
-FILES:${PN} += "${datadir}/application-registry  \
-                ${datadir}/mime-info \
-                ${datadir}/mime/packages \
-                ${datadir}/mime/application \
-                ${datadir}/gnome-2.0 \
-                ${datadir}/polkit* \
-                ${datadir}/GConf \
-                ${datadir}/glib-2.0/schemas \
-                ${datadir}/appdata \
-                ${datadir}/icons \
-"
-
-FILES:${PN}-doc += "${datadir}/devhelp"
-
-GNOMEBASEBUILDCLASS ??= "autotools"
-inherit ${GNOMEBASEBUILDCLASS} pkgconfig
-
-do_install:append() {
-	rm -rf ${D}${localstatedir}/lib/scrollkeeper/*
-	rm -rf ${D}${localstatedir}/scrollkeeper/*
-	rm -f ${D}${datadir}/applications/*.cache
-}
diff --git a/poky/meta/classes/go-mod.bbclass b/poky/meta/classes/go-mod.bbclass
deleted file mode 100644
index 674d243..0000000
--- a/poky/meta/classes/go-mod.bbclass
+++ /dev/null
@@ -1,20 +0,0 @@
-# Handle Go Modules support
-#
-# When using Go Modules, the the current working directory MUST be at or below
-# the location of the 'go.mod' file when the go tool is used, and there is no
-# way to tell it to look elsewhere.  It will automatically look upwards for the
-# file, but not downwards.
-#
-# To support this use case, we provide the `GO_WORKDIR` variable, which defaults
-# to `GO_IMPORT` but allows for easy override.
-#
-# Copyright 2020 (C) O.S. Systems Software LTDA.
-
-# The '-modcacherw' option ensures we have write access to the cached objects so
-# we avoid errors during clean task as well as when removing the TMPDIR.
-GOBUILDFLAGS:append = " -modcacherw"
-
-inherit go
-
-GO_WORKDIR ?= "${GO_IMPORT}"
-do_compile[dirs] += "${B}/src/${GO_WORKDIR}"
diff --git a/poky/meta/classes/go-ptest.bbclass b/poky/meta/classes/go-ptest.bbclass
deleted file mode 100644
index b282ff7..0000000
--- a/poky/meta/classes/go-ptest.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-inherit go ptest
-
-do_compile_ptest_base() {
-	export TMPDIR="${GOTMPDIR}"
-	rm -f ${B}/.go_compiled_tests.list
-	go_list_package_tests | while read pkg; do
-		cd ${B}/src/$pkg
-		${GO} test ${GOPTESTBUILDFLAGS} $pkg
-		find . -mindepth 1 -maxdepth 1 -type f -name '*.test' -exec echo $pkg/{} \; | \
-			sed -e's,/\./,/,'>> ${B}/.go_compiled_tests.list
-	done
-	do_compile_ptest
-}
-
-do_compile_ptest_base[dirs] =+ "${GOTMPDIR}"
-
-go_make_ptest_wrapper() {
-	cat >${D}${PTEST_PATH}/run-ptest <<EOF
-#!/bin/sh
-RC=0
-run_test() (
-    cd "\$1"
-    ((((./\$2 ${GOPTESTFLAGS}; echo \$? >&3) | sed -r -e"s,^(PASS|SKIP|FAIL)\$,\\1: \$1/\$2," >&4) 3>&1) | (read rc; exit \$rc)) 4>&1
-    exit \$?)
-EOF
-
-}
-
-do_install_ptest_base() {
-	test -f "${B}/.go_compiled_tests.list" || exit 0
-	install -d ${D}${PTEST_PATH}
-	go_stage_testdata
-	go_make_ptest_wrapper
-	havetests=""
-	while read test; do
-		testdir=`dirname $test`
-		testprog=`basename $test`
-		install -d ${D}${PTEST_PATH}/$testdir
-		install -m 0755 ${B}/src/$test ${D}${PTEST_PATH}/$test
-	echo "run_test $testdir $testprog || RC=1" >> ${D}${PTEST_PATH}/run-ptest
-		havetests="yes"
-	done < ${B}/.go_compiled_tests.list
-	if [ -n "$havetests" ]; then
-		echo "exit \$RC" >> ${D}${PTEST_PATH}/run-ptest
-		chmod +x ${D}${PTEST_PATH}/run-ptest
-	else
-		rm -rf ${D}${PTEST_PATH}
-	fi
-	do_install_ptest
-	chown -R root:root ${D}${PTEST_PATH}
-}
-
-INSANE_SKIP:${PN}-ptest += "ldflags"
-
diff --git a/poky/meta/classes/go.bbclass b/poky/meta/classes/go.bbclass
deleted file mode 100644
index cd2daed..0000000
--- a/poky/meta/classes/go.bbclass
+++ /dev/null
@@ -1,164 +0,0 @@
-inherit goarch
-inherit linuxloader
-
-GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
-
-export GODEBUG = "gocachehash=1"
-
-GOROOT:class-native = "${STAGING_LIBDIR_NATIVE}/go"
-GOROOT:class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go"
-GOROOT = "${STAGING_LIBDIR}/go"
-export GOROOT
-export GOROOT_FINAL = "${libdir}/go"
-export GOCACHE = "${B}/.cache"
-
-export GOARCH = "${TARGET_GOARCH}"
-export GOOS = "${TARGET_GOOS}"
-export GOHOSTARCH="${BUILD_GOARCH}"
-export GOHOSTOS="${BUILD_GOOS}"
-
-GOARM[export] = "0"
-GOARM:arm:class-target = "${TARGET_GOARM}"
-GOARM:arm:class-target[export] = "1"
-
-GO386[export] = "0"
-GO386:x86:class-target = "${TARGET_GO386}"
-GO386:x86:class-target[export] = "1"
-
-GOMIPS[export] = "0"
-GOMIPS:mips:class-target = "${TARGET_GOMIPS}"
-GOMIPS:mips:class-target[export] = "1"
-
-DEPENDS_GOLANG:class-target = "virtual/${TUNE_PKGARCH}-go virtual/${TARGET_PREFIX}go-runtime"
-DEPENDS_GOLANG:class-native = "go-native"
-DEPENDS_GOLANG:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime"
-
-DEPENDS:append = " ${DEPENDS_GOLANG}"
-
-GO_LINKSHARED ?= "${@'-linkshared' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH_LINK = "${@'-Wl,-rpath-link=${STAGING_DIR_TARGET}${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH = "${@'-r ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH:class-native = "${@'-r ${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH_LINK:class-native = "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}"
-GO_LINKMODE ?= ""
-GO_LINKMODE:class-nativesdk = "--linkmode=external"
-GO_LINKMODE:class-native = "--linkmode=external"
-GO_EXTRA_LDFLAGS ?= ""
-GO_LINUXLOADER ?= "-I ${@get_linuxloader(d)}"
-# Use system loader. If uninative is used, the uninative loader will be patched automatically
-GO_LINUXLOADER:class-native = ""
-GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_LINUXLOADER} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
-export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
-export GOPATH_OMIT_IN_ACTIONID ?= "1"
-export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
-export GOPTESTFLAGS ?= ""
-GOBUILDFLAGS:prepend:task-compile = "${GO_PARALLEL_BUILD} "
-
-export GO = "${HOST_PREFIX}go"
-GOTOOLDIR = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
-GOTOOLDIR:class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}"
-export GOTOOLDIR
-
-export CGO_ENABLED ?= "1"
-export CGO_CFLAGS ?= "${CFLAGS}"
-export CGO_CPPFLAGS ?= "${CPPFLAGS}"
-export CGO_CXXFLAGS ?= "${CXXFLAGS}"
-export CGO_LDFLAGS ?= "${LDFLAGS}"
-
-GO_INSTALL ?= "${GO_IMPORT}/..."
-GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
-
-B = "${WORKDIR}/build"
-export GOPATH = "${B}"
-export GOENV = "off"
-export GOTMPDIR ?= "${WORKDIR}/build-tmp"
-GOTMPDIR[vardepvalue] = ""
-
-python go_do_unpack() {
-    src_uri = (d.getVar('SRC_URI') or "").split()
-    if len(src_uri) == 0:
-        return
-
-    fetcher = bb.fetch2.Fetch(src_uri, d)
-    for url in fetcher.urls:
-        if fetcher.ud[url].type == 'git':
-            if fetcher.ud[url].parm.get('destsuffix') is None:
-                s_dirname = os.path.basename(d.getVar('S'))
-                fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src', d.getVar('GO_IMPORT')) + '/'
-    fetcher.unpack(d.getVar('WORKDIR'))
-}
-
-go_list_packages() {
-	${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
-		egrep -v '${GO_INSTALL_FILTEROUT}'
-}
-
-go_list_package_tests() {
-	${GO} list -f '{{.ImportPath}} {{.TestGoFiles}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
-		grep -v '\[\]$' | \
-		egrep -v '${GO_INSTALL_FILTEROUT}' | \
-		awk '{ print $1 }'
-}
-
-go_do_configure() {
-	ln -snf ${S}/src ${B}/
-}
-do_configure[dirs] =+ "${GOTMPDIR}"
-
-go_do_compile() {
-	export TMPDIR="${GOTMPDIR}"
-	if [ -n "${GO_INSTALL}" ]; then
-		if [ -n "${GO_LINKSHARED}" ]; then
-			${GO} install ${GOBUILDFLAGS} `go_list_packages`
-			rm -rf ${B}/bin
-		fi
-		${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} `go_list_packages`
-	fi
-}
-do_compile[dirs] =+ "${GOTMPDIR}"
-do_compile[cleandirs] = "${B}/bin ${B}/pkg"
-
-go_do_install() {
-	install -d ${D}${libdir}/go/src/${GO_IMPORT}
-	tar -C ${S}/src/${GO_IMPORT} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' . | \
-		tar -C ${D}${libdir}/go/src/${GO_IMPORT} --no-same-owner -xf -
-	tar -C ${B} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' pkg | \
-		tar -C ${D}${libdir}/go --no-same-owner -xf -
-
-	if [ -n "`ls ${B}/${GO_BUILD_BINDIR}/`" ]; then
-		install -d ${D}${bindir}
-		install -m 0755 ${B}/${GO_BUILD_BINDIR}/* ${D}${bindir}/
-	fi
-}
-
-go_stage_testdata() {
-	oldwd="$PWD"
-	cd ${S}/src
-	find ${GO_IMPORT} -depth -type d -name testdata | while read d; do
-		if echo "$d" | grep -q '/vendor/'; then
-			continue
-		fi
-		parent=`dirname $d`
-		install -d ${D}${PTEST_PATH}/$parent
-		cp --preserve=mode,timestamps -R $d ${D}${PTEST_PATH}/$parent/
-	done
-	cd "$oldwd"
-}
-
-EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install
-
-FILES:${PN}-dev = "${libdir}/go/src"
-FILES:${PN}-staticdev = "${libdir}/go/pkg"
-
-INSANE_SKIP:${PN} += "ldflags"
-
-# Add -buildmode=pie to GOBUILDFLAGS to satisfy "textrel" QA checking, but mips
-# doesn't support -buildmode=pie, so skip the QA checking for mips/rv32 and its
-# variants.
-python() {
-    if 'mips' in d.getVar('TARGET_ARCH') or 'riscv32' in d.getVar('TARGET_ARCH'):
-        d.appendVar('INSANE_SKIP:%s' % d.getVar('PN'), " textrel")
-    else:
-        d.appendVar('GOBUILDFLAGS', ' -buildmode=pie')
-}
diff --git a/poky/meta/classes/goarch.bbclass b/poky/meta/classes/goarch.bbclass
deleted file mode 100644
index 92fec16..0000000
--- a/poky/meta/classes/goarch.bbclass
+++ /dev/null
@@ -1,116 +0,0 @@
-BUILD_GOOS = "${@go_map_os(d.getVar('BUILD_OS'), d)}"
-BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH'), d)}"
-BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}"
-HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}"
-HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}"
-HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d)}"
-HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-HOST_GOARM:class-native = "7"
-HOST_GO386:class-native = "sse2"
-HOST_GOMIPS:class-native = "hardfloat"
-HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}"
-TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}"
-TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}"
-TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d)}"
-TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-TARGET_GOARM:class-native = "7"
-TARGET_GO386:class-native = "sse2"
-TARGET_GOMIPS:class-native = "hardfloat"
-TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
-GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}"
-
-# Use the MACHINEOVERRIDES to map ARM CPU architecture passed to GO via GOARM.
-# This is combined with *_ARCH to set HOST_GOARM and TARGET_GOARM.
-BASE_GOARM = ''
-BASE_GOARM:armv7ve = '7'
-BASE_GOARM:armv7a = '7'
-BASE_GOARM:armv6 = '6'
-BASE_GOARM:armv5 = '5'
-
-# Go supports dynamic linking on a limited set of architectures.
-# See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go
-GO_DYNLINK = ""
-GO_DYNLINK:arm ?= "1"
-GO_DYNLINK:aarch64 ?= "1"
-GO_DYNLINK:x86 ?= "1"
-GO_DYNLINK:x86-64 ?= "1"
-GO_DYNLINK:powerpc64 ?= "1"
-GO_DYNLINK:powerpc64le ?= "1"
-GO_DYNLINK:class-native ?= ""
-GO_DYNLINK:class-nativesdk = ""
-
-# define here because everybody inherits this class
-#
-COMPATIBLE_HOST:linux-gnux32 = "null"
-COMPATIBLE_HOST:linux-muslx32 = "null"
-COMPATIBLE_HOST:powerpc = "null"
-COMPATIBLE_HOST:powerpc64 = "null"
-COMPATIBLE_HOST:mipsarchn32 = "null"
-
-ARM_INSTRUCTION_SET:armv4 = "arm"
-ARM_INSTRUCTION_SET:armv5 = "arm"
-ARM_INSTRUCTION_SET:armv6 = "arm"
-
-TUNE_CCARGS:remove = "-march=mips32r2"
-SECURITY_NOPIE_CFLAGS ??= ""
-
-# go can't be built with ccache:
-# gcc: fatal error: no input files
-CCACHE_DISABLE ?= "1"
-
-def go_map_arch(a, d):
-    import re
-    if re.match('i.86', a):
-        return '386'
-    elif a == 'x86_64':
-        return 'amd64'
-    elif re.match('arm.*', a):
-        return 'arm'
-    elif re.match('aarch64.*', a):
-        return 'arm64'
-    elif re.match('mips64el.*', a):
-        return 'mips64le'
-    elif re.match('mips64.*', a):
-        return 'mips64'
-    elif a == 'mips':
-        return 'mips'
-    elif a == 'mipsel':
-        return 'mipsle'
-    elif re.match('p(pc|owerpc)(64le)', a):
-        return 'ppc64le'
-    elif re.match('p(pc|owerpc)(64)', a):
-        return 'ppc64'
-    elif a == 'riscv64':
-        return 'riscv64'
-    else:
-        raise bb.parse.SkipRecipe("Unsupported CPU architecture: %s" % a)
-
-def go_map_arm(a, d):
-    if a.startswith("arm"):
-        return d.getVar('BASE_GOARM')
-    return ''
-
-def go_map_386(a, f, d):
-    import re
-    if re.match('i.86', a):
-        if ('core2' in f) or ('corei7' in f):
-            return 'sse2'
-        else:
-            return 'softfloat'
-    return ''
-
-def go_map_mips(a, f, d):
-    import re
-    if a == 'mips' or a == 'mipsel':
-        if 'fpu-hard' in f:
-            return 'hardfloat'
-        else:
-            return 'softfloat'
-    return ''
-
-def go_map_os(o, d):
-    if o.startswith('linux'):
-        return 'linux'
-    return o
diff --git a/poky/meta/classes/gobject-introspection-data.bbclass b/poky/meta/classes/gobject-introspection-data.bbclass
deleted file mode 100644
index d90cdb4..0000000
--- a/poky/meta/classes/gobject-introspection-data.bbclass
+++ /dev/null
@@ -1,12 +0,0 @@
-# This variable is set to True if gobject-introspection-data is in
-# DISTRO_FEATURES and qemu-usermode is in MACHINE_FEATURES, and False otherwise.
-#
-# It should be used in recipes to determine whether introspection data should be built,
-# so that qemu use can be avoided when necessary.
-GI_DATA_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'gobject-introspection-data', \
-                      bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d), 'False', d)}"
-
-do_compile:prepend() {
-    # This prevents g-ir-scanner from writing cache data to $HOME
-    export GI_SCANNER_DISABLE_CACHE=1
-}
diff --git a/poky/meta/classes/gobject-introspection.bbclass b/poky/meta/classes/gobject-introspection.bbclass
deleted file mode 100644
index 7bf9feb..0000000
--- a/poky/meta/classes/gobject-introspection.bbclass
+++ /dev/null
@@ -1,55 +0,0 @@
-# Inherit this class in recipes to enable building their introspection files
-
-# python3native is inherited to prevent introspection tools being run with
-# host's python 3 (they need to be run with native python 3)
-#
-# This also sets up autoconf-based recipes to build introspection data (or not),
-# depending on distro and machine features (see gobject-introspection-data class).
-inherit python3native gobject-introspection-data
-
-# meson: default option name to enable/disable introspection. This matches most
-# project's configuration. In doubts - check meson_options.txt in project's
-# source path.
-GIR_MESON_OPTION ?= 'introspection'
-GIR_MESON_ENABLE_FLAG ?= 'true'
-GIR_MESON_DISABLE_FLAG ?= 'false'
-
-# Define g-i options such that they can be disabled completely when GIR_MESON_OPTION is empty
-GIRMESONTARGET = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', '${GIR_MESON_ENABLE_FLAG}', '${GIR_MESON_DISABLE_FLAG}', d)} "
-GIRMESONBUILD = "-D${GIR_MESON_OPTION}=${GIR_MESON_DISABLE_FLAG} "
-# Auto enable/disable based on GI_DATA_ENABLED
-EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} "
-EXTRA_OEMESON:prepend:class-target = "${@['', '${GIRMESONTARGET}'][d.getVar('GIR_MESON_OPTION') != '']}"
-# When building native recipes, disable introspection, as it is not necessary,
-# pulls in additional dependencies, and makes build times longer
-EXTRA_OECONF:prepend:class-native = "--disable-introspection "
-EXTRA_OECONF:prepend:class-nativesdk = "--disable-introspection "
-EXTRA_OEMESON:prepend:class-native = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}"
-EXTRA_OEMESON:prepend:class-nativesdk = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}"
-
-# Generating introspection data depends on a combination of native and target
-# introspection tools, and qemu to run the target tools.
-DEPENDS:append:class-target = " gobject-introspection gobject-introspection-native qemu-native"
-
-# Even though introspection is disabled on -native, gobject-introspection package is still
-# needed for m4 macros.
-DEPENDS:append:class-native = " gobject-introspection-native"
-DEPENDS:append:class-nativesdk = " gobject-introspection-native"
-
-# This is used by introspection tools to find .gir includes
-export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}"
-
-do_configure:prepend:class-target () {
-    # introspection.m4 pre-packaged with upstream tarballs does not yet
-    # have our fixes
-    mkdir -p ${S}/m4
-    cp ${STAGING_DIR_TARGET}/${datadir}/aclocal/introspection.m4 ${S}/m4
-}
-
-# .typelib files are needed at runtime and so they go to the main package (so
-# they'll be together with libraries they support).
-FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib" 
-    
-# .gir files go to dev package, as they're needed for developing (but not for
-# running) things that depends on introspection.
-FILES:${PN}-dev:append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir"
diff --git a/poky/meta/classes/grub-efi-cfg.bbclass b/poky/meta/classes/grub-efi-cfg.bbclass
deleted file mode 100644
index ea21b3d..0000000
--- a/poky/meta/classes/grub-efi-cfg.bbclass
+++ /dev/null
@@ -1,123 +0,0 @@
-# grub-efi.bbclass
-# Copyright (c) 2011, Intel Corporation.
-# All rights reserved.
-#
-# Released under the MIT license (see packages/COPYING)
-
-# Provide grub-efi specific functions for building bootable images.
-
-# External variables
-# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional)
-# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
-# ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu
-# ${LABELS} - a list of targets for the automatic config
-# ${APPEND} - an override list of append strings for each label
-# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
-# ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
-# ${GRUB_ROOT} - grub's root device.
-
-GRUB_SERIAL ?= "console=ttyS0,115200"
-GRUB_CFG_VM = "${S}/grub_vm.cfg"
-GRUB_CFG_LIVE = "${S}/grub_live.cfg"
-GRUB_TIMEOUT ?= "10"
-#FIXME: build this from the machine config
-GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
-
-GRUB_ROOT ?= "${ROOT}"
-APPEND ?= ""
-
-# Uses MACHINE specific KERNEL_IMAGETYPE
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-# Need UUID utility code.
-inherit fs-uuid
-
-python build_efi_cfg() {
-    import sys
-
-    workdir = d.getVar('WORKDIR')
-    if not workdir:
-        bb.error("WORKDIR not defined, unable to package")
-        return
-
-    gfxserial = d.getVar('GRUB_GFXSERIAL') or ""
-
-    labels = d.getVar('LABELS')
-    if not labels:
-        bb.debug(1, "LABELS not defined, nothing to do")
-        return
-
-    if labels == []:
-        bb.debug(1, "No labels, nothing to do")
-        return
-
-    cfile = d.getVar('GRUB_CFG')
-    if not cfile:
-        bb.fatal('Unable to read GRUB_CFG')
-
-    try:
-         cfgfile = open(cfile, 'w')
-    except OSError:
-        bb.fatal('Unable to open %s' % cfile)
-
-    cfgfile.write('# Automatically created by OE\n')
-
-    opts = d.getVar('GRUB_OPTS')
-    if opts:
-        for opt in opts.split(';'):
-            cfgfile.write('%s\n' % opt)
-
-    cfgfile.write('default=%s\n' % (labels.split()[0]))
-
-    timeout = d.getVar('GRUB_TIMEOUT')
-    if timeout:
-        cfgfile.write('timeout=%s\n' % timeout)
-    else:
-        cfgfile.write('timeout=50\n')
-
-    root = d.getVar('GRUB_ROOT')
-    if not root:
-        bb.fatal('GRUB_ROOT not defined')
-
-    if gfxserial == "1":
-        btypes = [ [ " graphics console", "" ],
-            [ " serial console", d.getVar('GRUB_SERIAL') or "" ] ]
-    else:
-        btypes = [ [ "", "" ] ]
-
-    for label in labels.split():
-        localdata = d.createCopy()
-
-        overrides = localdata.getVar('OVERRIDES')
-        if not overrides:
-            bb.fatal('OVERRIDES not defined')
-
-        localdata.setVar('OVERRIDES', 'grub_' + label + ':' + overrides)
-
-        for btype in btypes:
-            cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0]))
-            lb = label
-            if label == "install":
-                lb = "install-efi"
-            kernel = localdata.getVar('KERNEL_IMAGETYPE')
-            cfgfile.write('linux /%s LABEL=%s' % (kernel, lb))
-
-            cfgfile.write(' %s' % replace_rootfs_uuid(d, root))
-
-            append = localdata.getVar('APPEND')
-            initrd = localdata.getVar('INITRD')
-
-            if append:
-                append = replace_rootfs_uuid(d, append)
-                cfgfile.write(' %s' % (append))
-
-            cfgfile.write(' %s' % btype[1])
-            cfgfile.write('\n')
-
-            if initrd:
-                cfgfile.write('initrd /initrd')
-            cfgfile.write('\n}\n')
-
-    cfgfile.close()
-}
-build_efi_cfg[vardepsexclude] += "OVERRIDES"
diff --git a/poky/meta/classes/grub-efi.bbclass b/poky/meta/classes/grub-efi.bbclass
deleted file mode 100644
index 8fc6999..0000000
--- a/poky/meta/classes/grub-efi.bbclass
+++ /dev/null
@@ -1,8 +0,0 @@
-inherit grub-efi-cfg
-require conf/image-uefi.conf
-
-efi_populate() {
-	efi_populate_common "$1" grub-efi
-
-	install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
-}
diff --git a/poky/meta/classes/gsettings.bbclass b/poky/meta/classes/gsettings.bbclass
deleted file mode 100644
index 3fa5bd4..0000000
--- a/poky/meta/classes/gsettings.bbclass
+++ /dev/null
@@ -1,42 +0,0 @@
-# A bbclass to handle installed GSettings (glib) schemas, updated the compiled
-# form on package install and remove.
-#
-# The compiled schemas are platform-agnostic, so we can depend on
-# glib-2.0-native for the native tool and run the postinst script when the
-# rootfs builds to save a little time on first boot.
-
-# TODO use a trigger so that this runs once per package operation run
-
-GSETTINGS_PACKAGE ?= "${PN}"
-
-python __anonymous() {
-    pkg = d.getVar("GSETTINGS_PACKAGE")
-    if pkg:
-        d.appendVar("PACKAGE_WRITE_DEPS", " glib-2.0-native")
-        d.appendVar("RDEPENDS:" + pkg, " ${MLPREFIX}glib-2.0-utils")
-        d.appendVar("FILES:" + pkg, " ${datadir}/glib-2.0/schemas")
-}
-
-gsettings_postinstrm () {
-	glib-compile-schemas $D${datadir}/glib-2.0/schemas
-}
-
-python populate_packages:append () {
-    pkg = d.getVar('GSETTINGS_PACKAGE')
-    if pkg:
-        bb.note("adding gsettings postinst scripts to %s" % pkg)
-
-        postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
-        if not postinst:
-            postinst = '#!/bin/sh\n'
-        postinst += d.getVar('gsettings_postinstrm')
-        d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        bb.note("adding gsettings postrm scripts to %s" % pkg)
-
-        postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
-        if not postrm:
-            postrm = '#!/bin/sh\n'
-        postrm += d.getVar('gsettings_postinstrm')
-        d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
diff --git a/poky/meta/classes/gtk-doc.bbclass b/poky/meta/classes/gtk-doc.bbclass
deleted file mode 100644
index 07b46ac..0000000
--- a/poky/meta/classes/gtk-doc.bbclass
+++ /dev/null
@@ -1,83 +0,0 @@
-# Helper class to pull in the right gtk-doc dependencies and configure
-# gtk-doc to enable or disable documentation building (which requries the
-# use of usermode qemu).
-
-# This variable is set to True if api-documentation is in
-# DISTRO_FEATURES and qemu-usermode is in MACHINE_FEATURES, and False otherwise.
-#
-# It should be used in recipes to determine whether gtk-doc based documentation should be built,
-# so that qemu use can be avoided when necessary.
-GTKDOC_ENABLED:class-native = "False"
-GTKDOC_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', \
-                      bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d), 'False', d)}"
-
-# meson: default option name to enable/disable gtk-doc. This matches most
-# project's configuration. In doubts - check meson_options.txt in project's
-# source path.
-GTKDOC_MESON_OPTION ?= 'docs'
-GTKDOC_MESON_ENABLE_FLAG ?= 'true'
-GTKDOC_MESON_DISABLE_FLAG ?= 'false'
-
-# Auto enable/disable based on GTKDOC_ENABLED
-EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GTKDOC_ENABLED', 'True', '--enable-gtk-doc --enable-gtk-doc-html --disable-gtk-doc-pdf', \
-                                                                                    '--disable-gtk-doc', d)} "
-EXTRA_OEMESON:prepend:class-target = "-D${GTKDOC_MESON_OPTION}=${@bb.utils.contains('GTKDOC_ENABLED', 'True', '${GTKDOC_MESON_ENABLE_FLAG}', '${GTKDOC_MESON_DISABLE_FLAG}', d)} "
-
-# When building native recipes, disable gtkdoc, as it is not necessary,
-# pulls in additional dependencies, and makes build times longer
-EXTRA_OECONF:prepend:class-native = "--disable-gtk-doc "
-EXTRA_OECONF:prepend:class-nativesdk = "--disable-gtk-doc "
-EXTRA_OEMESON:prepend:class-native = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
-EXTRA_OEMESON:prepend:class-nativesdk = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
-
-# Even though gtkdoc is disabled on -native, gtk-doc package is still
-# needed for m4 macros.
-DEPENDS:append = " gtk-doc-native"
-
-# The documentation directory, where the infrastructure will be copied.
-# gtkdocize has a default of "." so to handle out-of-tree builds set this to $S.
-GTKDOC_DOCDIR ?= "${S}"
-
-export STAGING_DIR_HOST
-
-inherit python3native pkgconfig qemu
-DEPENDS:append = "${@' qemu-native' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
-
-do_configure:prepend () {
-	# Need to use ||true as this is only needed if configure.ac both exists
-	# and uses GTK_DOC_CHECK.
-	gtkdocize --srcdir ${S} --docdir ${GTKDOC_DOCDIR} || true
-}
-
-do_compile:prepend:class-target () {
-    if [ ${GTKDOC_ENABLED} = True ]; then
-        # Write out a qemu wrapper that will be given to gtkdoc-scangobj so that it
-        # can run target helper binaries through that.
-        qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
-        cat > ${B}/gtkdoc-qemuwrapper << EOF
-#!/bin/sh
-# Use a modules directory which doesn't exist so we don't load random things
-# which may then get deleted (or their dependencies) and potentially segfault
-export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
-
-GIR_EXTRA_LIBS_PATH=\`find ${B} -name *.so -printf "%h\n"|sort|uniq| tr '\n' ':'\`\$GIR_EXTRA_LIBS_PATH
-GIR_EXTRA_LIBS_PATH=\`find ${B} -name .libs| tr '\n' ':'\`\$GIR_EXTRA_LIBS_PATH
-
-# meson sets this wrongly (only to libs in build-dir), qemu_wrapper_cmdline() and GIR_EXTRA_LIBS_PATH take care of it properly
-unset LD_LIBRARY_PATH
-
-if [ -d ".libs" ]; then
-    $qemu_binary ".libs/\$@"
-else
-    $qemu_binary "\$@"
-fi
-
-if [ \$? -ne 0 ]; then
-    echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help."
-    echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )"
-    exit 1
-fi
-EOF
-        chmod +x ${B}/gtkdoc-qemuwrapper
-    fi
-}
diff --git a/poky/meta/classes/gtk-icon-cache.bbclass b/poky/meta/classes/gtk-icon-cache.bbclass
deleted file mode 100644
index 6808339..0000000
--- a/poky/meta/classes/gtk-icon-cache.bbclass
+++ /dev/null
@@ -1,89 +0,0 @@
-FILES:${PN} += "${datadir}/icons/hicolor"
-
-GTKIC_VERSION ??= '3'
-
-GTKPN = "${@ 'gtk4' if d.getVar('GTKIC_VERSION') == '4' else 'gtk+3' }"
-GTKIC_CMD = "${@ 'gtk-update-icon-cache-3.0.0' if d.getVar('GTKIC_VERSION') == '4' else 'gtk4-update-icon-cache' }"
-
-#gtk+3/gtk4 require GTK3DISTROFEATURES, DEPENDS on it make all the
-#recipes inherit this class require GTK3DISTROFEATURES
-inherit features_check
-ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
-
-DEPENDS +=" ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \
-            ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
-            ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \
-            ${GTKPN}-native \
-"
-
-PACKAGE_WRITE_DEPS += "${GTKPN}-native gdk-pixbuf-native"
-
-gtk_icon_cache_postinst() {
-if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
-		mlprefix=${MLPREFIX} \
-		libdir_native=${libdir_native}
-else
-
-	# Update the pixbuf loaders in case they haven't been registered yet
-	${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
-
-	for icondir in /usr/share/icons/* ; do
-		if [ -d $icondir ] ; then
-			${GTKIC_CMD} -fqt  $icondir
-		fi
-	done
-fi
-}
-
-gtk_icon_cache_postrm() {
-if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
-		mlprefix=${MLPREFIX} \
-		libdir=${libdir}
-else
-	for icondir in /usr/share/icons/* ; do
-		if [ -d $icondir ] ; then
-			${GTKIC_CMD} -qt  $icondir
-		fi
-	done
-fi
-}
-
-python populate_packages:append () {
-    packages = d.getVar('PACKAGES').split()
-    pkgdest =  d.getVar('PKGDEST')
-    
-    for pkg in packages:
-        icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir'))
-        if not os.path.exists(icon_dir):
-            continue
-
-        bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
-        rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
-        d.appendVar('RDEPENDS:%s' % pkg, rdepends)
-
-        #gtk_icon_cache_postinst depend on gdk-pixbuf and gtk+3/gtk4
-        bb.note("adding gdk-pixbuf dependency to %s" % pkg)
-        rdepends = ' ' + d.getVar('MLPREFIX', False) + "gdk-pixbuf"
-        d.appendVar('RDEPENDS:%s' % pkg, rdepends)
-
-        bb.note("adding %s dependency to %s" % (d.getVar('GTKPN'), pkg))
-        rdepends = ' ' + d.getVar('MLPREFIX', False) + d.getVar('GTKPN')
-        d.appendVar('RDEPENDS:%s' % pkg, rdepends)
-
-        bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
-
-        postinst = d.getVar('pkg_postinst:%s' % pkg)
-        if not postinst:
-            postinst = '#!/bin/sh\n'
-        postinst += d.getVar('gtk_icon_cache_postinst')
-        d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        postrm = d.getVar('pkg_postrm:%s' % pkg)
-        if not postrm:
-            postrm = '#!/bin/sh\n'
-        postrm += d.getVar('gtk_icon_cache_postrm')
-        d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
diff --git a/poky/meta/classes/gtk-immodules-cache.bbclass b/poky/meta/classes/gtk-immodules-cache.bbclass
deleted file mode 100644
index 2107517..0000000
--- a/poky/meta/classes/gtk-immodules-cache.bbclass
+++ /dev/null
@@ -1,76 +0,0 @@
-# This class will update the inputmethod module cache for virtual keyboards
-#
-# Usage: Set GTKIMMODULES_PACKAGES to the packages that needs to update the inputmethod modules
-
-PACKAGE_WRITE_DEPS += "qemu-native"
-
-inherit qemu
-
-GTKIMMODULES_PACKAGES ?= "${PN}"
-
-gtk_immodule_cache_postinst() {
-if [ "x$D" != "x" ]; then
-    $INTERCEPT_DIR/postinst_intercept update_gtk_immodules_cache ${PKG} \
-            mlprefix=${MLPREFIX} \
-            binprefix=${MLPREFIX} \
-            libdir=${libdir} \
-            libexecdir=${libexecdir} \
-            base_libdir=${base_libdir} \
-            bindir=${bindir}
-else
-    if [ ! -z `which gtk-query-immodules-2.0` ]; then
-        gtk-query-immodules-2.0 > ${libdir}/gtk-2.0/2.10.0/immodules.cache
-    fi
-    if [ ! -z `which gtk-query-immodules-3.0` ]; then
-        mkdir -p ${libdir}/gtk-3.0/3.0.0
-        gtk-query-immodules-3.0 > ${libdir}/gtk-3.0/3.0.0/immodules.cache
-    fi
-fi
-}
-
-gtk_immodule_cache_postrm() {
-if [ "x$D" != "x" ]; then
-    $INTERCEPT_DIR/postinst_intercept update_gtk_immodules_cache ${PKG} \
-            mlprefix=${MLPREFIX} \
-            binprefix=${MLPREFIX} \
-            libdir=${libdir} \
-            libexecdir=${libexecdir} \
-            base_libdir=${base_libdir} \
-            bindir=${bindir}
-else
-    if [ ! -z `which gtk-query-immodules-2.0` ]; then
-        gtk-query-immodules-2.0 > ${libdir}/gtk-2.0/2.10.0/immodules.cache
-    fi
-    if [ ! -z `which gtk-query-immodules-3.0` ]; then
-        gtk-query-immodules-3.0 > ${libdir}/gtk-3.0/3.0.0/immodules.cache
-    fi
-fi
-}
-
-python populate_packages:append () {
-    gtkimmodules_pkgs = d.getVar('GTKIMMODULES_PACKAGES').split()
-
-    for pkg in gtkimmodules_pkgs:
-            bb.note("adding gtk-immodule-cache postinst and postrm scripts to %s" % pkg)
-
-            postinst = d.getVar('pkg_postinst:%s' % pkg)
-            if not postinst:
-                postinst = '#!/bin/sh\n'
-            postinst += d.getVar('gtk_immodule_cache_postinst')
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-            postrm = d.getVar('pkg_postrm:%s' % pkg)
-            if not postrm:
-                postrm = '#!/bin/sh\n'
-            postrm += d.getVar('gtk_immodule_cache_postrm')
-            d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
-python __anonymous() {
-    if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
-        gtkimmodules_check = d.getVar('GTKIMMODULES_PACKAGES', False)
-        if not gtkimmodules_check:
-            bb_filename = d.getVar('FILE', False)
-            bb.fatal("ERROR: %s inherits gtk-immodules-cache but doesn't set GTKIMMODULES_PACKAGES" % bb_filename)
-}
-
diff --git a/poky/meta/classes/icecc.bbclass b/poky/meta/classes/icecc.bbclass
index 9b912a3..a11e781 100644
--- a/poky/meta/classes/icecc.bbclass
+++ b/poky/meta/classes/icecc.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # IceCream distributed compiling support
 #
 # Stages directories with symlinks from gcc/g++ to icecc, for both
diff --git a/poky/meta/classes/image-artifact-names.bbclass b/poky/meta/classes/image-artifact-names.bbclass
deleted file mode 100644
index f5769e5..0000000
--- a/poky/meta/classes/image-artifact-names.bbclass
+++ /dev/null
@@ -1,22 +0,0 @@
-##################################################################
-# Specific image creation and rootfs population info.
-##################################################################
-
-IMAGE_BASENAME ?= "${PN}"
-IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
-IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
-IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
-IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
-
-# IMAGE_NAME is the base name for everything produced when building images.
-# The actual image that contains the rootfs has an additional suffix (.rootfs
-# by default) followed by additional suffices which describe the format (.ext4,
-# .ext4.xz, etc.).
-IMAGE_NAME_SUFFIX ??= ".rootfs"
-
-python () {
-    if bb.data.inherits_class('deploy', d) and d.getVar("IMAGE_VERSION_SUFFIX") == "-${DATETIME}":
-        import datetime
-        d.setVar("IMAGE_VERSION_SUFFIX", "-" + datetime.datetime.fromtimestamp(int(d.getVar("SOURCE_DATE_EPOCH")), datetime.timezone.utc).strftime('%Y%m%d%H%M%S'))
-        d.setVarFlag("IMAGE_VERSION_SUFFIX", "vardepvalue", "")
-}
diff --git a/poky/meta/classes/image-buildinfo.bbclass b/poky/meta/classes/image-buildinfo.bbclass
index ef790bb..206cc9d 100644
--- a/poky/meta/classes/image-buildinfo.bbclass
+++ b/poky/meta/classes/image-buildinfo.bbclass
@@ -4,7 +4,7 @@
 # Copyright (C) 2014 Intel Corporation
 # Author: Alejandro Enedino Hernandez Samaniego <alejandro.hernandez@intel.com>
 #
-# Licensed under the MIT license, see COPYING.MIT for details
+# SPDX-License-Identifier: MIT
 #
 # Usage: add INHERIT += "image-buildinfo" to your conf file
 #
diff --git a/poky/meta/classes/image-combined-dbg.bbclass b/poky/meta/classes/image-combined-dbg.bbclass
deleted file mode 100644
index e5dc61f..0000000
--- a/poky/meta/classes/image-combined-dbg.bbclass
+++ /dev/null
@@ -1,9 +0,0 @@
-IMAGE_PREPROCESS_COMMAND:append = " combine_dbg_image; "
-
-combine_dbg_image () {
-        if [ "${IMAGE_GEN_DEBUGFS}" = "1" -a -e ${IMAGE_ROOTFS}-dbg ]; then
-                # copy target files into -dbg rootfs, so it can be used for
-                # debug purposes directly
-                tar -C ${IMAGE_ROOTFS} -cf - . | tar -C ${IMAGE_ROOTFS}-dbg -xf -
-        fi
-}
diff --git a/poky/meta/classes/image-container.bbclass b/poky/meta/classes/image-container.bbclass
deleted file mode 100644
index 3d19935..0000000
--- a/poky/meta/classes/image-container.bbclass
+++ /dev/null
@@ -1,21 +0,0 @@
-ROOTFS_BOOTSTRAP_INSTALL = ""
-IMAGE_TYPES_MASKED += "container"
-IMAGE_TYPEDEP:container = "tar.bz2"
-
-python __anonymous() {
-    if "container" in d.getVar("IMAGE_FSTYPES") and \
-       d.getVar("IMAGE_CONTAINER_NO_DUMMY") != "1" and \
-       "linux-dummy" not in d.getVar("PREFERRED_PROVIDER_virtual/kernel"):
-        msg = '"container" is in IMAGE_FSTYPES, but ' \
-              'PREFERRED_PROVIDER_virtual/kernel is not "linux-dummy". ' \
-              'Unless a particular kernel is needed, using linux-dummy will ' \
-              'prevent a kernel from being built, which can reduce ' \
-              'build times. If you don\'t want to use "linux-dummy", set ' \
-              '"IMAGE_CONTAINER_NO_DUMMY" to "1".'
-
-        # Raising skip recipe was Paul's clever idea. It causes the error to
-        # only be shown for the recipes actually requested to build, rather
-        # than bb.fatal which would appear for all recipes inheriting the
-        # class.
-        raise bb.parse.SkipRecipe(msg)
-}
diff --git a/poky/meta/classes/image-live.bbclass b/poky/meta/classes/image-live.bbclass
deleted file mode 100644
index 2c94819..0000000
--- a/poky/meta/classes/image-live.bbclass
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright (C) 2004, Advanced Micro Devices, Inc.  All Rights Reserved
-# Released under the MIT license (see packages/COPYING)
-
-# Creates a bootable image using syslinux, your kernel and an optional
-# initrd
-
-#
-# End result is two things:
-#
-# 1. A .hddimg file which is an msdos filesystem containing syslinux, a kernel,
-# an initrd and a rootfs image. These can be written to harddisks directly and
-# also booted on USB flash disks (write them there with dd).
-#
-# 2. A CD .iso image
-
-# Boot process is that the initrd will boot and process which label was selected
-# in syslinux. Actions based on the label are then performed (e.g. installing to
-# an hdd)
-
-# External variables (also used by syslinux.bbclass)
-# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional)
-# ${HDDIMG_ID} - FAT image volume-id
-# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
-
-inherit live-vm-common image-artifact-names
-
-do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
-                        mtools-native:do_populate_sysroot \
-                        cdrtools-native:do_populate_sysroot \
-                        virtual/kernel:do_deploy \
-                        ${MLPREFIX}syslinux:do_populate_sysroot \
-                        syslinux-native:do_populate_sysroot \
-                        ${@'%s:do_image_%s' % (d.getVar('PN'), d.getVar('LIVE_ROOTFS_TYPE').replace('-', '_')) if d.getVar('ROOTFS') else ''} \
-                        "
-
-
-LABELS_LIVE ?= "boot install"
-ROOT_LIVE ?= "root=/dev/ram0"
-INITRD_IMAGE_LIVE ?= "${MLPREFIX}core-image-minimal-initramfs"
-INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.${INITRAMFS_FSTYPES}"
-
-LIVE_ROOTFS_TYPE ?= "ext4"
-ROOTFS ?= "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${LIVE_ROOTFS_TYPE}"
-
-IMAGE_TYPEDEP:live = "${LIVE_ROOTFS_TYPE}"
-IMAGE_TYPEDEP:iso = "${LIVE_ROOTFS_TYPE}"
-IMAGE_TYPEDEP:hddimg = "${LIVE_ROOTFS_TYPE}"
-IMAGE_TYPES_MASKED += "live hddimg iso"
-
-python() {
-    image_b = d.getVar('IMAGE_BASENAME')
-    initrd_i = d.getVar('INITRD_IMAGE_LIVE')
-    if image_b == initrd_i:
-        bb.error('INITRD_IMAGE_LIVE %s cannot use image live, hddimg or iso.' % initrd_i)
-        bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.')
-    elif initrd_i:
-        d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i)
-}
-
-HDDDIR = "${S}/hddimg"
-ISODIR = "${S}/iso"
-EFIIMGDIR = "${S}/efi_img"
-COMPACT_ISODIR = "${S}/iso.z"
-
-ISOLINUXDIR ?= "/isolinux"
-ISO_BOOTIMG = "isolinux/isolinux.bin"
-ISO_BOOTCAT = "isolinux/boot.cat"
-MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
-
-BOOTIMG_VOLUME_ID   ?= "boot"
-BOOTIMG_EXTRA_SPACE ?= "512"
-
-populate_live() {
-    populate_kernel $1
-	if [ -s "${ROOTFS}" ]; then
-		install -m 0644 ${ROOTFS} $1/rootfs.img
-	fi
-}
-
-build_iso() {
-	# Only create an ISO if we have an INITRD and the live or iso image type was selected
-	if [ -z "${INITRD}" ] || [ "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso', '1', '0', d)}" != "1" ]; then
-		bbnote "ISO image will not be created."
-		return
-	fi
-	# ${INITRD} is a list of multiple filesystem images
-	for fs in ${INITRD}
-	do
-		if [ ! -s "$fs" ]; then
-			bbwarn "ISO image will not be created. $fs is invalid."
-			return
-		fi
-	done
-
-	populate_live ${ISODIR}
-
-	if [ "${PCBIOS}" = "1" ]; then
-		syslinux_iso_populate ${ISODIR}
-	fi
-	if [ "${EFI}" = "1" ]; then
-		efi_iso_populate ${ISODIR}
-		build_fat_img ${EFIIMGDIR} ${ISODIR}/efi.img
-	fi
-
-	# EFI only
-	if [ "${PCBIOS}" != "1" ] && [ "${EFI}" = "1" ] ; then
-		# Work around bug in isohybrid where it requires isolinux.bin
-		# In the boot catalog, even though it is not used
-		mkdir -p ${ISODIR}/${ISOLINUXDIR}
-		install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR}
-	fi
-
-	# We used to have support for zisofs; this is a relic of that
-	mkisofs_compress_opts="-r"
-
-	# Check the size of ${ISODIR}/rootfs.img, use mkisofs -iso-level 3
-	# when it exceeds 3.8GB, the specification is 4G - 1 bytes, we need
-	# leave a few space for other files.
-	mkisofs_iso_level=""
-
-        if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
-		rootfs_img_size=`stat -c '%s' ${ISODIR}/rootfs.img`
-		# 4080218931 = 3.8 * 1024 * 1024 * 1024
-		if [ $rootfs_img_size -gt 4080218931 ]; then
-			bbnote "${ISODIR}/rootfs.img execeeds 3.8GB, using '-iso-level 3' for mkisofs"
-			mkisofs_iso_level="-iso-level 3"
-		fi
-	fi
-
-	if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then
-		# PCBIOS only media
-		mkisofs -V ${BOOTIMG_VOLUME_ID} \
-		        -o ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso \
-			-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \
-			$mkisofs_compress_opts \
-			${MKISOFS_OPTIONS} $mkisofs_iso_level ${ISODIR}
-	else
-		# EFI only OR EFI+PCBIOS
-		mkisofs -A ${BOOTIMG_VOLUME_ID} -V ${BOOTIMG_VOLUME_ID} \
-		        -o ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso \
-			-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \
-			$mkisofs_compress_opts ${MKISOFS_OPTIONS} $mkisofs_iso_level \
-			-eltorito-alt-boot -eltorito-platform efi \
-			-b efi.img -no-emul-boot \
-			${ISODIR}
-		isohybrid_args="-u"
-	fi
-
-	isohybrid $isohybrid_args ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso
-}
-
-build_fat_img() {
-	FATSOURCEDIR=$1
-	FATIMG=$2
-
-	# Calculate the size required for the final image including the
-	# data and filesystem overhead.
-	# Sectors: 512 bytes
-	#  Blocks: 1024 bytes
-
-	# Determine the sector count just for the data
-	SECTORS=$(expr $(du --apparent-size -ks ${FATSOURCEDIR} | cut -f 1) \* 2)
-
-	# Account for the filesystem overhead. This includes directory
-	# entries in the clusters as well as the FAT itself.
-	# Assumptions:
-	#   FAT32 (12 or 16 may be selected by mkdosfs, but the extra
-	#   padding will be minimal on those smaller images and not
-	#   worth the logic here to caclulate the smaller FAT sizes)
-	#   < 16 entries per directory
-	#   8.3 filenames only
-
-	# 32 bytes per dir entry
-	DIR_BYTES=$(expr $(find ${FATSOURCEDIR} | tail -n +2 | wc -l) \* 32)
-	# 32 bytes for every end-of-directory dir entry
-	DIR_BYTES=$(expr $DIR_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 32))
-	# 4 bytes per FAT entry per sector of data
-	FAT_BYTES=$(expr $SECTORS \* 4)
-	# 4 bytes per FAT entry per end-of-cluster list
-	FAT_BYTES=$(expr $FAT_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 4))
-
-	# Use a ceiling function to determine FS overhead in sectors
-	DIR_SECTORS=$(expr $(expr $DIR_BYTES + 511) / 512)
-	# There are two FATs on the image
-	FAT_SECTORS=$(expr $(expr $(expr $FAT_BYTES + 511) / 512) \* 2)
-	SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS))
-
-	# Determine the final size in blocks accounting for some padding
-	BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE})
-
-	# mkdosfs will sometimes use FAT16 when it is not appropriate,
-	# resulting in a boot failure from SYSLINUX. Use FAT32 for
-	# images larger than 512MB, otherwise let mkdosfs decide.
-	if [ $(expr $BLOCKS / 1024) -gt 512 ]; then
-		FATSIZE="-F 32"
-	fi
-
-	# mkdosfs will fail if ${FATIMG} exists. Since we are creating an
-	# new image, it is safe to delete any previous image.
-	if [ -e ${FATIMG} ]; then
-		rm ${FATIMG}
-	fi
-
-	if [ -z "${HDDIMG_ID}" ]; then
-		mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} ${MKDOSFS_EXTRAOPTS} -C ${FATIMG} \
-			${BLOCKS}
-	else
-		mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} ${MKDOSFS_EXTRAOPTS} -C ${FATIMG} \
-		${BLOCKS} -i ${HDDIMG_ID}
-	fi
-
-	# Copy FATSOURCEDIR recursively into the image file directly
-	mcopy -i ${FATIMG} -s ${FATSOURCEDIR}/* ::/
-}
-
-build_hddimg() {
-	# Create an HDD image
-	if [ "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live hddimg', '1', '0', d)}" = "1" ] ; then
-		populate_live ${HDDDIR}
-
-		if [ "${PCBIOS}" = "1" ]; then
-			syslinux_hddimg_populate ${HDDDIR}
-		fi
-		if [ "${EFI}" = "1" ]; then
-			efi_hddimg_populate ${HDDDIR}
-		fi
-
-		# Check the size of ${HDDDIR}/rootfs.img, error out if it
-		# exceeds 4GB, it is the single file's max size of FAT fs.
-		if [ -f ${HDDDIR}/rootfs.img ]; then
-			rootfs_img_size=`stat -c '%s' ${HDDDIR}/rootfs.img`
-			max_size=`expr 4 \* 1024 \* 1024 \* 1024`
-			if [ $rootfs_img_size -ge $max_size ]; then
-				bberror "${HDDDIR}/rootfs.img rootfs size is greather than or equal to 4GB,"
-				bberror "and this doesn't work on a FAT filesystem. You can either:"
-				bberror "1) Reduce the size of rootfs.img, or,"
-				bbfatal "2) Use wic, vmdk,vhd, vhdx or vdi instead of hddimg\n"
-			fi
-		fi
-
-		build_fat_img ${HDDDIR} ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg
-
-		if [ "${PCBIOS}" = "1" ]; then
-			syslinux_hddimg_install
-		fi
-
-		chmod 644 ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg
-	fi
-}
-
-python do_bootimg() {
-    set_live_vm_vars(d, 'LIVE')
-    if d.getVar("PCBIOS") == "1":
-        bb.build.exec_func('build_syslinux_cfg', d)
-    if d.getVar("EFI") == "1":
-        bb.build.exec_func('build_efi_cfg', d)
-    bb.build.exec_func('build_hddimg', d)
-    bb.build.exec_func('build_iso', d)
-    bb.build.exec_func('create_symlinks', d)
-}
-do_bootimg[subimages] = "hddimg iso"
-do_bootimg[imgsuffix] = "."
-
-addtask bootimg before do_image_complete after do_rootfs
diff --git a/poky/meta/classes/image-postinst-intercepts.bbclass b/poky/meta/classes/image-postinst-intercepts.bbclass
deleted file mode 100644
index ed30bbd..0000000
--- a/poky/meta/classes/image-postinst-intercepts.bbclass
+++ /dev/null
@@ -1,23 +0,0 @@
-# Gather existing and candidate postinst intercepts from BBPATH
-POSTINST_INTERCEPTS_DIR ?= "${COREBASE}/scripts/postinst-intercepts"
-POSTINST_INTERCEPTS_PATHS ?= "${@':'.join('%s/postinst-intercepts' % p for p in '${BBPATH}'.split(':'))}:${POSTINST_INTERCEPTS_DIR}"
-
-python find_intercepts() {
-    intercepts = {}
-    search_paths = []
-    paths = d.getVar('POSTINST_INTERCEPTS_PATHS').split(':')
-    overrides = (':' + d.getVar('FILESOVERRIDES')).split(':') + ['']
-    search_paths = [os.path.join(p, op) for p in paths for op in overrides]
-    searched = oe.path.which_wild('*', ':'.join(search_paths), candidates=True)
-    files, chksums = [], []
-    for pathname, candidates in searched:
-        if os.path.isfile(pathname):
-            files.append(pathname)
-            chksums.append('%s:True' % pathname)
-            chksums.extend('%s:False' % c for c in candidates[:-1])
-
-    d.setVar('POSTINST_INTERCEPT_CHECKSUMS', ' '.join(chksums))
-    d.setVar('POSTINST_INTERCEPTS', ' '.join(files))
-}
-find_intercepts[eventmask] += "bb.event.RecipePreFinalise"
-addhandler find_intercepts
diff --git a/poky/meta/classes/image.bbclass b/poky/meta/classes/image.bbclass
deleted file mode 100644
index 2139a7e..0000000
--- a/poky/meta/classes/image.bbclass
+++ /dev/null
@@ -1,679 +0,0 @@
-
-IMAGE_CLASSES ??= ""
-
-# rootfs bootstrap install
-# warning -  image-container resets this
-ROOTFS_BOOTSTRAP_INSTALL = "run-postinsts"
-
-# Handle inherits of any of the image classes we need
-IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
-# Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
-# in the non-Linux SDK_OS case, such as mingw32
-IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
-IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
-IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
-IMGCLASSES += "image_types_wic"
-IMGCLASSES += "rootfs-postcommands"
-IMGCLASSES += "image-postinst-intercepts"
-IMGCLASSES += "overlayfs-etc"
-inherit ${IMGCLASSES}
-
-TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
-TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
-POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_sysroot_relativelinks; "
-
-LICENSE ?= "MIT"
-PACKAGES = ""
-DEPENDS += "${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross depmodwrapper-cross cross-localedef-native"
-RDEPENDS += "${PACKAGE_INSTALL} ${LINGUAS_INSTALL} ${IMAGE_INSTALL_DEBUGFS}"
-RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}"
-PATH:prepend = "${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:"
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-# IMAGE_FEATURES may contain any available package group
-IMAGE_FEATURES ?= ""
-IMAGE_FEATURES[type] = "list"
-IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs read-only-rootfs-delayed-postinsts stateless-rootfs empty-root-password allow-empty-password allow-root-login post-install-logging overlayfs-etc"
-
-# Generate companion debugfs?
-IMAGE_GEN_DEBUGFS ?= "0"
-
-# These packages will be installed as additional into debug rootfs
-IMAGE_INSTALL_DEBUGFS ?= ""
-
-# These packages will be removed from a read-only rootfs after all other
-# packages have been installed
-ROOTFS_RO_UNNEEDED ??= "update-rc.d base-passwd shadow ${VIRTUAL-RUNTIME_update-alternatives} ${ROOTFS_BOOTSTRAP_INSTALL}"
-
-# packages to install from features
-FEATURE_INSTALL = "${@' '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
-FEATURE_INSTALL[vardepvalue] = "${FEATURE_INSTALL}"
-FEATURE_INSTALL_OPTIONAL = "${@' '.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
-FEATURE_INSTALL_OPTIONAL[vardepvalue] = "${FEATURE_INSTALL_OPTIONAL}"
-
-# Define some very basic feature package groups
-FEATURE_PACKAGES_package-management = "${ROOTFS_PKGMANAGE}"
-SPLASH ?= "${@bb.utils.contains("MACHINE_FEATURES", "screen", "psplash", "", d)}"
-FEATURE_PACKAGES_splash = "${SPLASH}"
-
-IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
-
-def check_image_features(d):
-    valid_features = (d.getVarFlag('IMAGE_FEATURES', 'validitems') or "").split()
-    valid_features += d.getVarFlags('COMPLEMENTARY_GLOB').keys()
-    for var in d:
-       if var.startswith("FEATURE_PACKAGES_"):
-           valid_features.append(var[17:])
-    valid_features.sort()
-
-    features = set(oe.data.typed_value('IMAGE_FEATURES', d))
-    for feature in features:
-        if feature not in valid_features:
-            if bb.utils.contains('EXTRA_IMAGE_FEATURES', feature, True, False, d):
-                raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES (added via EXTRA_IMAGE_FEATURES) is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
-            else:
-                raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
-
-IMAGE_INSTALL ?= ""
-IMAGE_INSTALL[type] = "list"
-export PACKAGE_INSTALL ?= "${IMAGE_INSTALL} ${ROOTFS_BOOTSTRAP_INSTALL} ${FEATURE_INSTALL}"
-PACKAGE_INSTALL_ATTEMPTONLY ?= "${FEATURE_INSTALL_OPTIONAL}"
-
-IMGDEPLOYDIR = "${WORKDIR}/deploy-${PN}-image-complete"
-
-# Images are generally built explicitly, do not need to be part of world.
-EXCLUDE_FROM_WORLD = "1"
-
-USE_DEVFS ?= "1"
-USE_DEPMOD ?= "1"
-
-PID = "${@os.getpid()}"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-LDCONFIGDEPEND ?= "ldconfig-native:do_populate_sysroot"
-LDCONFIGDEPEND:libc-musl = ""
-
-# This is needed to have depmod data in PKGDATA_DIR,
-# but if you're building small initramfs image
-# e.g. to include it in your kernel, you probably
-# don't want this dependency, which is causing dependency loop
-KERNELDEPMODDEPEND ?= "virtual/kernel:do_packagedata"
-
-do_rootfs[depends] += " \
-    makedevs-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot ${LDCONFIGDEPEND} \
-    virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot \
-    ${KERNELDEPMODDEPEND} \
-"
-do_rootfs[recrdeptask] += "do_packagedata"
-
-def rootfs_command_variables(d):
-    return ['ROOTFS_POSTPROCESS_COMMAND','ROOTFS_PREPROCESS_COMMAND','ROOTFS_POSTINSTALL_COMMAND','ROOTFS_POSTUNINSTALL_COMMAND','OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','IMAGE_POSTPROCESS_COMMAND',
-            'IMAGE_PREPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS','DEB_PREPROCESS_COMMANDS','DEB_POSTPROCESS_COMMANDS']
-
-python () {
-    variables = rootfs_command_variables(d)
-    for var in variables:
-        if d.getVar(var, False):
-            d.setVarFlag(var, 'func', '1')
-}
-
-def rootfs_variables(d):
-    from oe.rootfs import variable_depends
-    variables = ['IMAGE_DEVICE_TABLE','IMAGE_DEVICE_TABLES','BUILD_IMAGES_FROM_FEEDS','IMAGE_TYPES_MASKED','IMAGE_ROOTFS_ALIGNMENT','IMAGE_OVERHEAD_FACTOR','IMAGE_ROOTFS_SIZE','IMAGE_ROOTFS_EXTRA_SPACE',
-                 'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS', 'IMAGE_LINGUAS_COMPLEMENTARY', 'IMAGE_LOCALES_ARCHIVE',
-                 'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS',
-                 'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS',
-                 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'REPRODUCIBLE_TIMESTAMP_ROOTFS', 'IMAGE_INSTALL_DEBUGFS']
-    variables.extend(rootfs_command_variables(d))
-    variables.extend(variable_depends(d))
-    return " ".join(variables)
-
-do_rootfs[vardeps] += "${@rootfs_variables(d)}"
-
-# This is needed to have kernel image in DEPLOY_DIR.
-# This follows many common usecases and user expectations.
-# But if you are building an image which doesn't need the kernel image at all,
-# you can unset this variable manually.
-KERNEL_DEPLOY_DEPEND ?= "virtual/kernel:do_deploy"
-do_build[depends] += "${KERNEL_DEPLOY_DEPEND}"
-
-
-python () {
-    def extraimage_getdepends(task):
-        deps = ""
-        for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
-            if ":" in dep:
-                deps += " %s " % (dep)
-            else:
-                deps += " %s:%s" % (dep, task)
-        return deps
-
-    d.appendVarFlag('do_image_complete', 'depends', extraimage_getdepends('do_populate_sysroot'))
-
-    deps = " " + imagetypes_getdepends(d)
-    d.appendVarFlag('do_rootfs', 'depends', deps)
-
-    #process IMAGE_FEATURES, we must do this before runtime_mapping_rename
-    #Check for replaces image features
-    features = set(oe.data.typed_value('IMAGE_FEATURES', d))
-    remain_features = features.copy()
-    for feature in features:
-        replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature) or "").split())
-        remain_features -= replaces
-
-    #Check for conflict image features
-    for feature in remain_features:
-        conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature) or "").split())
-        temp = conflicts & remain_features
-        if temp:
-            bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN'), feature, ' '.join(list(temp))))
-
-    d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features))))
-
-    check_image_features(d)
-}
-
-IMAGE_POSTPROCESS_COMMAND ?= ""
-
-# some default locales
-IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
-
-LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
-
-# per default create a locale archive
-IMAGE_LOCALES_ARCHIVE ?= '1'
-
-# Prefer image, but use the fallback files for lookups if the image ones
-# aren't yet available.
-PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
-
-PSEUDO_IGNORE_PATHS .= ",${WORKDIR}/intercept_scripts,${WORKDIR}/oe-rootfs-repo,${WORKDIR}/sstate-build-image_complete"
-
-PACKAGE_EXCLUDE ??= ""
-PACKAGE_EXCLUDE[type] = "list"
-
-fakeroot python do_rootfs () {
-    from oe.rootfs import create_rootfs
-    from oe.manifest import create_manifest
-    import logging
-
-    logger = d.getVar('BB_TASK_LOGGER', False)
-    if logger:
-        logcatcher = bb.utils.LogCatcher()
-        logger.addHandler(logcatcher)
-    else:
-        logcatcher = None
-
-    # NOTE: if you add, remove or significantly refactor the stages of this
-    # process then you should recalculate the weightings here. This is quite
-    # easy to do - just change the MultiStageProgressReporter line temporarily
-    # to pass debug=True as the last parameter and you'll get a printout of
-    # the weightings as well as a map to the lines where next_stage() was
-    # called. Of course this isn't critical, but it helps to keep the progress
-    # reporting accurate.
-    stage_weights = [1, 203, 354, 186, 65, 4228, 1, 353, 49, 330, 382, 23, 1]
-    progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights)
-    progress_reporter.next_stage()
-
-    # Handle package exclusions
-    excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split()
-    inst_pkgs = d.getVar("PACKAGE_INSTALL").split()
-    inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split()
-
-    d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
-    d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
-
-    for pkg in excl_pkgs:
-        if pkg in inst_pkgs:
-            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))
-            inst_pkgs.remove(pkg)
-
-        if pkg in inst_attempt_pkgs:
-            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))
-            inst_attempt_pkgs.remove(pkg)
-
-    d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
-    d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
-
-    # Ensure we handle package name remapping
-    # We have to delay the runtime_mapping_rename until just before rootfs runs
-    # otherwise, the multilib renaming could step in and squash any fixups that
-    # may have occurred.
-    pn = d.getVar('PN')
-    runtime_mapping_rename("PACKAGE_INSTALL", pn, d)
-    runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d)
-    runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d)
-
-    # Generate the initial manifest
-    create_manifest(d)
-
-    progress_reporter.next_stage()
-
-    # generate rootfs
-    d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
-    create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
-
-    progress_reporter.finish()
-}
-do_rootfs[dirs] = "${TOPDIR}"
-do_rootfs[cleandirs] += "${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${S}"
-do_rootfs[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
-addtask rootfs after do_prepare_recipe_sysroot
-
-fakeroot python do_image () {
-    from oe.utils import execute_pre_post_process
-
-    d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
-    pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
-
-    execute_pre_post_process(d, pre_process_cmds)
-}
-do_image[dirs] = "${TOPDIR}"
-addtask do_image after do_rootfs
-
-fakeroot python do_image_complete () {
-    from oe.utils import execute_pre_post_process
-
-    post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND")
-
-    execute_pre_post_process(d, post_process_cmds)
-}
-do_image_complete[dirs] = "${TOPDIR}"
-SSTATETASKS += "do_image_complete"
-SSTATE_SKIP_CREATION:task-image-complete = '1'
-do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
-do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
-do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}"
-addtask do_image_complete after do_image before do_build
-python do_image_complete_setscene () {
-    sstate_setscene(d)
-}
-addtask do_image_complete_setscene
-
-# Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
-#
-# IMAGE_QA_COMMANDS += " \
-#     image_check_everything_ok \
-# "
-# This task runs all functions in IMAGE_QA_COMMANDS after the rootfs
-# construction has completed in order to validate the resulting image.
-#
-# The functions should use ${IMAGE_ROOTFS} to find the unpacked rootfs
-# directory, which if QA passes will be the basis for the images.
-fakeroot python do_image_qa () {
-    from oe.utils import ImageQAFailed
-
-    qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
-    qamsg = ""
-
-    for cmd in qa_cmds:
-        try:
-            bb.build.exec_func(cmd, d)
-        except oe.utils.ImageQAFailed as e:
-            qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
-        except Exception as e:
-            qamsg = qamsg + '\tImage QA function %s failed\n' % cmd
-
-    if qamsg:
-        imgname = d.getVar('IMAGE_NAME')
-        bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg))
-}
-addtask do_image_qa after do_rootfs before do_image
-
-SSTATETASKS += "do_image_qa"
-SSTATE_SKIP_CREATION:task-image-qa = '1'
-do_image_qa[sstate-inputdirs] = ""
-do_image_qa[sstate-outputdirs] = ""
-python do_image_qa_setscene () {
-    sstate_setscene(d)
-}
-addtask do_image_qa_setscene
-
-def setup_debugfs_variables(d):
-    d.appendVar('IMAGE_ROOTFS', '-dbg')
-    if d.getVar('IMAGE_LINK_NAME'):
-        d.appendVar('IMAGE_LINK_NAME', '-dbg')
-    d.appendVar('IMAGE_NAME','-dbg')
-    d.setVar('IMAGE_BUILDING_DEBUGFS', 'true')
-    debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS')
-    if debugfs_image_fstypes:
-        d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes)
-
-python setup_debugfs () {
-    setup_debugfs_variables(d)
-}
-
-python () {
-    vardeps = set()
-    # We allow CONVERSIONTYPES to have duplicates. That avoids breaking
-    # derived distros when OE-core or some other layer independently adds
-    # the same type. There is still only one command for each type, but
-    # presumably the commands will do the same when the type is the same,
-    # even when added in different places.
-    #
-    # Without de-duplication, gen_conversion_cmds() below
-    # would create the same compression command multiple times.
-    ctypes = set(d.getVar('CONVERSIONTYPES').split())
-    old_overrides = d.getVar('OVERRIDES', False)
-
-    def _image_base_type(type):
-        basetype = type
-        for ctype in ctypes:
-            if type.endswith("." + ctype):
-                basetype = type[:-len("." + ctype)]
-                break
-
-        if basetype != type:
-            # New base type itself might be generated by a conversion command.
-            basetype = _image_base_type(basetype)
-
-        return basetype
-
-    basetypes = {}
-    alltypes = d.getVar('IMAGE_FSTYPES').split()
-    typedeps = {}
-
-    if d.getVar('IMAGE_GEN_DEBUGFS') == "1":
-        debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS').split()
-        for t in debugfs_fstypes:
-            alltypes.append("debugfs_" + t)
-
-    def _add_type(t):
-        baset = _image_base_type(t)
-        input_t = t
-        if baset not in basetypes:
-            basetypes[baset]= []
-        if t not in basetypes[baset]:
-            basetypes[baset].append(t)
-        debug = ""
-        if t.startswith("debugfs_"):
-            t = t[8:]
-            debug = "debugfs_"
-        deps = (d.getVar('IMAGE_TYPEDEP:' + t) or "").split()
-        vardeps.add('IMAGE_TYPEDEP:' + t)
-        if baset not in typedeps:
-            typedeps[baset] = set()
-        deps = [debug + dep for dep in deps]
-        for dep in deps:
-            if dep not in alltypes:
-                alltypes.append(dep)
-            _add_type(dep)
-            basedep = _image_base_type(dep)
-            typedeps[baset].add(basedep)
-
-        if baset != input_t:
-            _add_type(baset)
-
-    for t in alltypes[:]:
-        _add_type(t)
-
-    d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps))
-
-    maskedtypes = (d.getVar('IMAGE_TYPES_MASKED') or "").split()
-    maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")]
-
-    for t in basetypes:
-        vardeps = set()
-        cmds = []
-        subimages = []
-        realt = t
-
-        if t in maskedtypes:
-            continue
-
-        localdata = bb.data.createCopy(d)
-        debug = ""
-        if t.startswith("debugfs_"):
-            setup_debugfs_variables(localdata)
-            debug = "setup_debugfs "
-            realt = t[8:]
-        localdata.setVar('OVERRIDES', '%s:%s' % (realt, old_overrides))
-        localdata.setVar('type', realt)
-        # Delete DATETIME so we don't expand any references to it now
-        # This means the task's hash can be stable rather than having hardcoded
-        # date/time values. It will get expanded at execution time.
-        # Similarly TMPDIR since otherwise we see QA stamp comparision problems
-        # Expand PV else it can trigger get_srcrev which can fail due to these variables being unset
-        localdata.setVar('PV', d.getVar('PV'))
-        localdata.delVar('DATETIME')
-        localdata.delVar('DATE')
-        localdata.delVar('TMPDIR')
-        localdata.delVar('IMAGE_VERSION_SUFFIX')
-        vardepsexclude = (d.getVarFlag('IMAGE_CMD:' + realt, 'vardepsexclude', True) or '').split()
-        for dep in vardepsexclude:
-            localdata.delVar(dep)
-
-        image_cmd = localdata.getVar("IMAGE_CMD")
-        vardeps.add('IMAGE_CMD:' + realt)
-        if image_cmd:
-            cmds.append("\t" + image_cmd)
-        else:
-            bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t)
-        cmds.append(localdata.expand("\tcd ${IMGDEPLOYDIR}"))
-
-        # Since a copy of IMAGE_CMD:xxx will be inlined within do_image_xxx,
-        # prevent a redundant copy of IMAGE_CMD:xxx being emitted as a function.
-        d.delVarFlag('IMAGE_CMD:' + realt, 'func')
-
-        rm_tmp_images = set()
-        def gen_conversion_cmds(bt):
-            for ctype in sorted(ctypes):
-                if bt.endswith("." + ctype):
-                    type = bt[0:-len(ctype) - 1]
-                    if type.startswith("debugfs_"):
-                        type = type[8:]
-                    # Create input image first.
-                    gen_conversion_cmds(type)
-                    localdata.setVar('type', type)
-                    cmd = "\t" + localdata.getVar("CONVERSION_CMD:" + ctype)
-                    if cmd not in cmds:
-                        cmds.append(cmd)
-                    vardeps.add('CONVERSION_CMD:' + ctype)
-                    subimage = type + "." + ctype
-                    if subimage not in subimages:
-                        subimages.append(subimage)
-                    if type not in alltypes:
-                        rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
-
-        for bt in basetypes[t]:
-            gen_conversion_cmds(bt)
-
-        localdata.setVar('type', realt)
-        if t not in alltypes:
-            rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
-        else:
-            subimages.append(realt)
-
-        # Clean up after applying all conversion commands. Some of them might
-        # use the same input, therefore we cannot delete sooner without applying
-        # some complex dependency analysis.
-        for image in sorted(rm_tmp_images):
-            cmds.append("\trm " + image)
-
-        after = 'do_image'
-        for dep in typedeps[t]:
-            after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_")
-
-        task = "do_image_%s" % t.replace("-", "_").replace(".", "_")
-
-        d.setVar(task, '\n'.join(cmds))
-        d.setVarFlag(task, 'func', '1')
-        d.setVarFlag(task, 'fakeroot', '1')
-
-        d.appendVarFlag(task, 'prefuncs', ' ' + debug + ' set_image_size')
-        d.prependVarFlag(task, 'postfuncs', 'create_symlinks ')
-        d.appendVarFlag(task, 'subimages', ' ' + ' '.join(subimages))
-        d.appendVarFlag(task, 'vardeps', ' ' + ' '.join(vardeps))
-        d.appendVarFlag(task, 'vardepsexclude', ' DATETIME DATE ' + ' '.join(vardepsexclude))
-
-        bb.debug(2, "Adding task %s before %s, after %s" % (task, 'do_image_complete', after))
-        bb.build.addtask(task, 'do_image_complete', after, d)
-}
-
-#
-# Compute the rootfs size
-#
-def get_rootfs_size(d):
-    import subprocess, oe.utils
-
-    rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT'))
-    overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR'))
-    rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE'))
-    rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE'))
-    rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE')
-    image_fstypes = d.getVar('IMAGE_FSTYPES') or ''
-    initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or ''
-    initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
-
-    size_kb = oe.utils.directory_size(d.getVar("IMAGE_ROOTFS")) / 1024
-
-    base_size = size_kb * overhead_factor
-    bb.debug(1, '%f = %d * %f' % (base_size, size_kb, overhead_factor))
-    base_size2 = max(base_size, rootfs_req_size) + rootfs_extra_space
-    bb.debug(1, '%f = max(%f, %d)[%f] + %d' % (base_size2, base_size, rootfs_req_size, max(base_size, rootfs_req_size), rootfs_extra_space))
-
-    base_size = base_size2
-    if base_size != int(base_size):
-        base_size = int(base_size + 1)
-    else:
-        base_size = int(base_size)
-    bb.debug(1, '%f = int(%f)' % (base_size, base_size2))
-
-    base_size_saved = base_size
-    base_size += rootfs_alignment - 1
-    base_size -= base_size % rootfs_alignment
-    bb.debug(1, '%d = aligned(%d)' % (base_size, base_size_saved))
-
-    # Do not check image size of the debugfs image. This is not supposed
-    # to be deployed, etc. so it doesn't make sense to limit the size
-    # of the debug.
-    if (d.getVar('IMAGE_BUILDING_DEBUGFS') or "") == "true":
-        bb.debug(1, 'returning debugfs size %d' % (base_size))
-        return base_size
-
-    # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
-    if rootfs_maxsize:
-        rootfs_maxsize_int = int(rootfs_maxsize)
-        if base_size > rootfs_maxsize_int:
-            bb.fatal("The rootfs size %d(K) exceeds IMAGE_ROOTFS_MAXSIZE: %d(K)" % \
-                (base_size, rootfs_maxsize_int))
-
-    # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
-    if image_fstypes == initramfs_fstypes != ''  and initramfs_maxsize:
-        initramfs_maxsize_int = int(initramfs_maxsize)
-        if base_size > initramfs_maxsize_int:
-            bb.error("The initramfs size %d(K) exceeds INITRAMFS_MAXSIZE: %d(K)" % \
-                (base_size, initramfs_maxsize_int))
-            bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should")
-            bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n")
-
-    bb.debug(1, 'returning %d' % (base_size))
-    return base_size
-
-python set_image_size () {
-        rootfs_size = get_rootfs_size(d)
-        d.setVar('ROOTFS_SIZE', str(rootfs_size))
-        d.setVarFlag('ROOTFS_SIZE', 'export', '1')
-}
-
-#
-# Create symlinks to the newly created image
-#
-python create_symlinks() {
-
-    deploy_dir = d.getVar('IMGDEPLOYDIR')
-    img_name = d.getVar('IMAGE_NAME')
-    link_name = d.getVar('IMAGE_LINK_NAME')
-    manifest_name = d.getVar('IMAGE_MANIFEST')
-    taskname = d.getVar("BB_CURRENTTASK")
-    subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
-    imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix') or d.expand("${IMAGE_NAME_SUFFIX}.")
-
-    if not link_name:
-        return
-    for type in subimages:
-        dst = os.path.join(deploy_dir, link_name + "." + type)
-        src = img_name + imgsuffix + type
-        if os.path.exists(os.path.join(deploy_dir, src)):
-            bb.note("Creating symlink: %s -> %s" % (dst, src))
-            if os.path.islink(dst):
-                os.remove(dst)
-            os.symlink(src, dst)
-        else:
-            bb.note("Skipping symlink, source does not exist: %s -> %s" % (dst, src))
-}
-
-MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|${sysconfdir}|${nonarch_base_libdir}/udev|/lib/modules/[^/]*/modules.*|"
-MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
-MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
-
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_install[noexec] = "1"
-deltask do_populate_lic
-deltask do_populate_sysroot
-do_package[noexec] = "1"
-deltask do_package_qa
-deltask do_packagedata
-deltask do_package_write_ipk
-deltask do_package_write_deb
-deltask do_package_write_rpm
-
-# Prepare the root links to point to the /usr counterparts.
-create_merged_usr_symlinks() {
-    root="$1"
-    install -d $root${base_bindir} $root${base_sbindir} $root${base_libdir}
-    ln -rs $root${base_bindir} $root/bin
-    ln -rs $root${base_sbindir} $root/sbin
-    ln -rs $root${base_libdir} $root/${baselib}
-
-    if [ "${nonarch_base_libdir}" != "${base_libdir}" ]; then
-       install -d $root${nonarch_base_libdir}
-       ln -rs $root${nonarch_base_libdir} $root/lib
-    fi
-
-    # create base links for multilibs
-    multi_libdirs="${@d.getVar('MULTILIB_VARIANTS')}"
-    for d in $multi_libdirs; do
-        install -d $root${exec_prefix}/$d
-        ln -rs $root${exec_prefix}/$d $root/$d
-    done
-}
-
-create_merged_usr_symlinks_rootfs() {
-    create_merged_usr_symlinks ${IMAGE_ROOTFS}
-}
-
-create_merged_usr_symlinks_sdk() {
-    create_merged_usr_symlinks ${SDK_OUTPUT}${SDKTARGETSYSROOT}
-}
-
-ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_rootfs; ', '',d)}"
-POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk; ', '',d)}"
-
-reproducible_final_image_task () {
-    if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
-        REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct 2>/dev/null` || true
-        if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
-            REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
-        fi
-    fi
-    # Set mtime of all files to a reproducible value
-    bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
-    find  ${IMAGE_ROOTFS} -print0 | xargs -0 touch -h  --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS
-}
-
-systemd_preset_all () {
-    if [ -e ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; then
-	systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all
-    fi
-}
-
-IMAGE_PREPROCESS_COMMAND:append = " ${@ 'systemd_preset_all;' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''} reproducible_final_image_task; "
-
-CVE_PRODUCT = ""
diff --git a/poky/meta/classes/image_types.bbclass b/poky/meta/classes/image_types.bbclass
deleted file mode 100644
index 0ffea91..0000000
--- a/poky/meta/classes/image_types.bbclass
+++ /dev/null
@@ -1,349 +0,0 @@
-# The default aligment of the size of the rootfs is set to 1KiB. In case
-# you're using the SD card emulation of a QEMU system simulator you may
-# set this value to 2048 (2MiB alignment).
-IMAGE_ROOTFS_ALIGNMENT ?= "1"
-
-def imagetypes_getdepends(d):
-    def adddep(depstr, deps):
-        for d in (depstr or "").split():
-            # Add task dependency if not already present
-            if ":" not in d:
-                d += ":do_populate_sysroot"
-            deps.add(d)
-
-    # Take a type in the form of foo.bar.car and split it into the items
-    # needed for the image deps "foo", and the conversion deps ["bar", "car"]
-    def split_types(typestring):
-        types = typestring.split(".")
-        return types[0], types[1:]
-
-    fstypes = set((d.getVar('IMAGE_FSTYPES') or "").split())
-    fstypes |= set((d.getVar('IMAGE_FSTYPES_DEBUGFS') or "").split())
-
-    deprecated = set()
-    deps = set()
-    for typestring in fstypes:
-        basetype, resttypes = split_types(typestring)
-
-        var = "IMAGE_DEPENDS_%s" % basetype
-        if d.getVar(var) is not None:
-            deprecated.add(var)
-
-        for typedepends in (d.getVar("IMAGE_TYPEDEP:%s" % basetype) or "").split():
-            base, rest = split_types(typedepends)
-            resttypes += rest
-
-            var = "IMAGE_DEPENDS_%s" % base
-            if d.getVar(var) is not None:
-                deprecated.add(var)
-
-        for ctype in resttypes:
-            adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype), deps)
-            adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype), deps)
-
-    if deprecated:
-        bb.fatal('Deprecated variable(s) found: "%s". '
-                 'Use do_image_<type>[depends] += "<recipe>:<task>" instead' % ', '.join(deprecated))
-
-    # Sort the set so that ordering is consistant
-    return " ".join(sorted(deps))
-
-XZ_COMPRESSION_LEVEL ?= "-9"
-XZ_INTEGRITY_CHECK ?= "crc32"
-
-ZIP_COMPRESSION_LEVEL ?= "-9"
-
-ZSTD_COMPRESSION_LEVEL ?= "-3"
-
-JFFS2_SUM_EXTRA_ARGS ?= ""
-IMAGE_CMD:jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.jffs2 ${EXTRA_IMAGECMD}"
-
-IMAGE_CMD:cramfs = "mkfs.cramfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cramfs ${EXTRA_IMAGECMD}"
-
-oe_mkext234fs () {
-	fstype=$1
-	extra_imagecmd=""
-
-	if [ $# -gt 1 ]; then
-		shift
-		extra_imagecmd=$@
-	fi
-
-	# If generating an empty image the size of the sparse block should be large
-	# enough to allocate an ext4 filesystem using 4096 bytes per inode, this is
-	# about 60K, so dd needs a minimum count of 60, with bs=1024 (bytes per IO)
-	eval local COUNT=\"0\"
-	eval local MIN_COUNT=\"60\"
-	if [ $ROOTFS_SIZE -lt $MIN_COUNT ]; then
-		eval COUNT=\"$MIN_COUNT\"
-	fi
-	# Create a sparse image block
-	bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
-	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
-	bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-	bbdebug 1 "Actual Partition size: `stat -c '%s' ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
-	bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
-	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
-	# Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
-	fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype || [ $? -le 3 ]
-}
-
-IMAGE_CMD:ext2 = "oe_mkext234fs ext2 ${EXTRA_IMAGECMD}"
-IMAGE_CMD:ext3 = "oe_mkext234fs ext3 ${EXTRA_IMAGECMD}"
-IMAGE_CMD:ext4 = "oe_mkext234fs ext4 ${EXTRA_IMAGECMD}"
-
-MIN_BTRFS_SIZE ?= "16384"
-IMAGE_CMD:btrfs () {
-	size=${ROOTFS_SIZE}
-	if [ ${size} -lt ${MIN_BTRFS_SIZE} ] ; then
-		size=${MIN_BTRFS_SIZE}
-		bbwarn "Rootfs size is too small for BTRFS. Filesystem will be extended to ${size}K"
-	fi
-	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.btrfs seek=${size} count=0 bs=1024
-	mkfs.btrfs ${EXTRA_IMAGECMD} -r ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.btrfs
-}
-
-IMAGE_CMD:squashfs = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs ${EXTRA_IMAGECMD} -noappend"
-IMAGE_CMD:squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz ${EXTRA_IMAGECMD} -noappend -comp xz"
-IMAGE_CMD:squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo"
-IMAGE_CMD:squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4"
-IMAGE_CMD:squashfs-zst = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-zst ${EXTRA_IMAGECMD} -noappend -comp zstd"
-
-IMAGE_CMD:erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}"
-IMAGE_CMD:erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}"
-IMAGE_CMD:erofs-lz4hc = "mkfs.erofs -zlz4hc ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4hc ${IMAGE_ROOTFS}"
-
-
-IMAGE_CMD_TAR ?= "tar"
-# ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs
-IMAGE_CMD:tar = "${IMAGE_CMD_TAR} --sort=name --format=posix --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]"
-
-do_image_cpio[cleandirs] += "${WORKDIR}/cpio_append"
-IMAGE_CMD:cpio () {
-	(cd ${IMAGE_ROOTFS} && find . | sort | cpio --reproducible -o -H newc >${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio)
-	# We only need the /init symlink if we're building the real
-	# image. The -dbg image doesn't need it! By being clever
-	# about this we also avoid 'touch' below failing, as it
-	# might be trying to touch /sbin/init on the host since both
-	# the normal and the -dbg image share the same WORKDIR
-	if [ "${IMAGE_BUILDING_DEBUGFS}" != "true" ]; then
-		if [ ! -L ${IMAGE_ROOTFS}/init ] && [ ! -e ${IMAGE_ROOTFS}/init ]; then
-			if [ -L ${IMAGE_ROOTFS}/sbin/init ] || [ -e ${IMAGE_ROOTFS}/sbin/init ]; then
-				ln -sf /sbin/init ${WORKDIR}/cpio_append/init
-			else
-				touch ${WORKDIR}/cpio_append/init
-			fi
-			(cd  ${WORKDIR}/cpio_append && echo ./init | cpio -oA -H newc -F ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio)
-		fi
-	fi
-}
-
-UBI_VOLNAME ?= "${MACHINE}-rootfs"
-UBI_VOLTYPE ?= "dynamic"
-UBI_IMGTYPE ?= "ubifs"
-
-write_ubi_config() {
-	if [ -z "$1" ]; then
-		local vname=""
-	else
-		local vname="_$1"
-	fi
-
-	cat <<EOF > ubinize${vname}-${IMAGE_NAME}.cfg
-[ubifs]
-mode=ubi
-image=${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.${UBI_IMGTYPE}
-vol_id=0
-vol_type=${UBI_VOLTYPE}
-vol_name=${UBI_VOLNAME}
-vol_flags=autoresize
-EOF
-}
-
-multiubi_mkfs() {
-	local mkubifs_args="$1"
-	local ubinize_args="$2"
-
-        # Added prompt error message for ubi and ubifs image creation.
-        if [ -z "$mkubifs_args" ] || [ -z "$ubinize_args" ]; then
-            bbfatal "MKUBIFS_ARGS and UBINIZE_ARGS have to be set, see http://www.linux-mtd.infradead.org/faq/ubifs.html for details"
-        fi
-
-	write_ubi_config "$3"
-
-	if [ -n "$vname" ]; then
-		mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs ${mkubifs_args}
-	fi
-	ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi ${ubinize_args} ubinize${vname}-${IMAGE_NAME}.cfg
-
-	# Cleanup cfg file
-	mv ubinize${vname}-${IMAGE_NAME}.cfg ${IMGDEPLOYDIR}/
-
-	# Create own symlinks for 'named' volumes
-	if [ -n "$vname" ]; then
-		cd ${IMGDEPLOYDIR}
-		if [ -e ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs ]; then
-			ln -sf ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs \
-			${IMAGE_LINK_NAME}${vname}.ubifs
-		fi
-		if [ -e ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi ]; then
-			ln -sf ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi \
-			${IMAGE_LINK_NAME}${vname}.ubi
-		fi
-		cd -
-	fi
-}
-
-IMAGE_CMD:multiubi () {
-	# Split MKUBIFS_ARGS_<name> and UBINIZE_ARGS_<name>
-	for name in ${MULTIUBI_BUILD}; do
-		eval local mkubifs_args=\"\$MKUBIFS_ARGS_${name}\"
-		eval local ubinize_args=\"\$UBINIZE_ARGS_${name}\"
-
-		multiubi_mkfs "${mkubifs_args}" "${ubinize_args}" "${name}"
-	done
-}
-
-IMAGE_CMD:ubi () {
-	multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}"
-}
-IMAGE_TYPEDEP:ubi = "${UBI_IMGTYPE}"
-
-IMAGE_CMD:ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}"
-
-MIN_F2FS_SIZE ?= "524288"
-IMAGE_CMD:f2fs () {
-        # We need to add additional smarts here form devices smaller than 1.5G
-        # Need to scale appropriately between 40M -> 1.5G as the "overprovision
-        # ratio" goes down as the device gets bigger (70% -> 4.5%), below about
-        # 500M the standard IMAGE_OVERHEAD_FACTOR does not work, so add additional
-        # space here when under 500M
-	size=${ROOTFS_SIZE}
-	if [ ${size} -lt ${MIN_F2FS_SIZE} ] ; then
-		size=${MIN_F2FS_SIZE}
-		bbwarn "Rootfs size is too small for F2FS. Filesystem will be extended to ${size}K"
-	fi
-	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.f2fs seek=${size} count=0 bs=1024
-	mkfs.f2fs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.f2fs
-	sload.f2fs -f ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.f2fs
-}
-
-EXTRA_IMAGECMD = ""
-
-inherit siteinfo kernel-arch image-artifact-names
-
-JFFS2_ENDIANNESS ?= "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-l', '-b', d)}"
-JFFS2_ERASEBLOCK ?= "0x40000"
-EXTRA_IMAGECMD:jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers"
-
-# Change these if you want default mkfs behavior (i.e. create minimal inode number)
-EXTRA_IMAGECMD:ext2 ?= "-i 4096"
-EXTRA_IMAGECMD:ext3 ?= "-i 4096"
-EXTRA_IMAGECMD:ext4 ?= "-i 4096"
-EXTRA_IMAGECMD:btrfs ?= "-n 4096 --shrink"
-EXTRA_IMAGECMD:f2fs ?= ""
-
-do_image_cpio[depends] += "cpio-native:do_populate_sysroot"
-do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
-do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"
-do_image_ext3[depends] += "e2fsprogs-native:do_populate_sysroot"
-do_image_ext4[depends] += "e2fsprogs-native:do_populate_sysroot"
-do_image_btrfs[depends] += "btrfs-tools-native:do_populate_sysroot"
-do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_xz[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_lzo[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_lz4[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_zst[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot"
-do_image_erofs[depends] += "erofs-utils-native:do_populate_sysroot"
-do_image_erofs_lz4[depends] += "erofs-utils-native:do_populate_sysroot"
-do_image_erofs_lz4hc[depends] += "erofs-utils-native:do_populate_sysroot"
-
-# This variable is available to request which values are suitable for IMAGE_FSTYPES
-IMAGE_TYPES = " \
-    jffs2 jffs2.sum \
-    cramfs \
-    ext2 ext2.gz ext2.bz2 ext2.lzma \
-    ext3 ext3.gz \
-    ext4 ext4.gz \
-    btrfs \
-    squashfs squashfs-xz squashfs-lzo squashfs-lz4 squashfs-zst \
-    ubi ubifs multiubi \
-    tar tar.gz tar.bz2 tar.xz tar.lz4 tar.zst \
-    cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 cpio.zst \
-    wic wic.gz wic.bz2 wic.lzma wic.zst \
-    container \
-    f2fs \
-    erofs erofs-lz4 erofs-lz4hc \
-"
-# These image types are x86 specific as they need syslinux
-IMAGE_TYPES:append:x86 = " hddimg iso"
-IMAGE_TYPES:append:x86-64 = " hddimg iso"
-
-# Compression is a special case of conversion. The old variable
-# names are still supported for backward-compatibility. When defining
-# new compression or conversion commands, use CONVERSIONTYPES and
-# CONVERSION_CMD/DEPENDS.
-COMPRESSIONTYPES ?= ""
-
-CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip zst sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vhd vhdx vdi qcow2 base64 gzsync zsync ${COMPRESSIONTYPES}"
-CONVERSION_CMD:lzma = "lzma -k -f -7 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:gz = "gzip -f -9 -n -c --rsyncable ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz"
-CONVERSION_CMD:bz2 = "pbzip2 -f -k ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:xz = "xz -f -k -c ${XZ_COMPRESSION_LEVEL} ${XZ_DEFAULTS} --check=${XZ_INTEGRITY_CHECK} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.xz"
-CONVERSION_CMD:lz4 = "lz4 -9 -z -l ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.lz4"
-CONVERSION_CMD:lzo = "lzop -9 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:zip = "zip ${ZIP_COMPRESSION_LEVEL} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.zip ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:zst = "zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.zst"
-CONVERSION_CMD:sum = "sumtool -i ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} -o ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sum ${JFFS2_SUM_EXTRA_ARGS}"
-CONVERSION_CMD:md5sum = "md5sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.md5sum"
-CONVERSION_CMD:sha1sum = "sha1sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha1sum"
-CONVERSION_CMD:sha224sum = "sha224sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha224sum"
-CONVERSION_CMD:sha256sum = "sha256sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha256sum"
-CONVERSION_CMD:sha384sum = "sha384sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha384sum"
-CONVERSION_CMD:sha512sum = "sha512sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha512sum"
-CONVERSION_CMD:bmap = "bmaptool create ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} -o ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.bmap"
-CONVERSION_CMD:u-boot = "mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C none -n ${IMAGE_NAME} -d ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.u-boot"
-CONVERSION_CMD:vmdk = "qemu-img convert -O vmdk ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vmdk"
-CONVERSION_CMD:vhdx = "qemu-img convert -O vhdx -o subformat=dynamic ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vhdx"
-CONVERSION_CMD:vhd = "qemu-img convert -O vpc -o subformat=fixed ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vhd"
-CONVERSION_CMD:vdi = "qemu-img convert -O vdi ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vdi"
-CONVERSION_CMD:qcow2 = "qemu-img convert -O qcow2 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qcow2"
-CONVERSION_CMD:base64 = "base64 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.base64"
-CONVERSION_CMD:zsync = "zsyncmake_curl ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:gzsync = "zsyncmake_curl -z ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_DEPENDS_lzma = "xz-native"
-CONVERSION_DEPENDS_gz = "pigz-native"
-CONVERSION_DEPENDS_bz2 = "pbzip2-native"
-CONVERSION_DEPENDS_xz = "xz-native"
-CONVERSION_DEPENDS_lz4 = "lz4-native"
-CONVERSION_DEPENDS_lzo = "lzop-native"
-CONVERSION_DEPENDS_zip = "zip-native"
-CONVERSION_DEPENDS_zst = "zstd-native"
-CONVERSION_DEPENDS_sum = "mtd-utils-native"
-CONVERSION_DEPENDS_bmap = "bmap-tools-native"
-CONVERSION_DEPENDS_u-boot = "u-boot-tools-native"
-CONVERSION_DEPENDS_vmdk = "qemu-system-native"
-CONVERSION_DEPENDS_vdi = "qemu-system-native"
-CONVERSION_DEPENDS_qcow2 = "qemu-system-native"
-CONVERSION_DEPENDS_base64 = "coreutils-native"
-CONVERSION_DEPENDS_vhdx = "qemu-system-native"
-CONVERSION_DEPENDS_vhd = "qemu-system-native"
-CONVERSION_DEPENDS_zsync = "zsync-curl-native"
-CONVERSION_DEPENDS_gzsync = "zsync-curl-native"
-
-RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4"
-RUNNABLE_MACHINE_PATTERNS ?= "qemu"
-
-DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
-
-# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
-# images that will not be built at do_rootfs time: vmdk, vhd, vhdx, vdi, qcow2, hddimg, iso, etc.
-IMAGE_TYPES_MASKED ?= ""
-
-# bmap requires python3 to be in the PATH
-EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('.bmap') else ''}"
diff --git a/poky/meta/classes/image_types_wic.bbclass b/poky/meta/classes/image_types_wic.bbclass
deleted file mode 100644
index 8497916..0000000
--- a/poky/meta/classes/image_types_wic.bbclass
+++ /dev/null
@@ -1,184 +0,0 @@
-# The WICVARS variable is used to define list of bitbake variables used in wic code
-# variables from this list is written to <image>.env file
-WICVARS ?= "\
-	APPEND \
-	ASSUME_PROVIDED \
-	BBLAYERS \
-	DEPLOY_DIR_IMAGE \
-	FAKEROOTCMD \
-	HOSTTOOLS_DIR \
-	IMAGE_BASENAME \
-	IMAGE_BOOT_FILES \
-	IMAGE_EFI_BOOT_FILES \
-	IMAGE_LINK_NAME \
-	IMAGE_ROOTFS \
-	IMGDEPLOYDIR \
-	INITRAMFS_FSTYPES \
-	INITRAMFS_IMAGE \
-	INITRAMFS_IMAGE_BUNDLE \
-	INITRAMFS_LINK_NAME \
-	INITRD \
-	INITRD_LIVE \
-	ISODIR \
-	KERNEL_IMAGETYPE \
-	MACHINE \
-	PSEUDO_IGNORE_PATHS \
-	RECIPE_SYSROOT_NATIVE \
-	ROOTFS_SIZE \
-	STAGING_DATADIR \
-	STAGING_DIR \
-	STAGING_DIR_HOST \
-	STAGING_LIBDIR \
-	TARGET_SYS \
-"
-
-inherit ${@bb.utils.contains('INITRAMFS_IMAGE_BUNDLE', '1', 'kernel-artifact-names', '', d)}
-
-WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
-WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
-WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.join('%s/wic' % p for p in '${BBPATH}'.split(':'))}:${@':'.join('%s/scripts/lib/wic/canned-wks' % l for l in '${BBPATH}:${COREBASE}'.split(':'))}"
-WKS_FULL_PATH = "${@wks_search(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH')) or ''}"
-
-def wks_search(files, search_path):
-    for f in files:
-        if os.path.isabs(f):
-            if os.path.exists(f):
-                return f
-        else:
-            searched = bb.utils.which(search_path, f)
-            if searched:
-                return searched
-
-WIC_CREATE_EXTRA_ARGS ?= ""
-
-IMAGE_CMD:wic () {
-	out="${IMGDEPLOYDIR}/${IMAGE_NAME}"
-	build_wic="${WORKDIR}/build-wic"
-	tmp_wic="${WORKDIR}/tmp-wic"
-	wks="${WKS_FULL_PATH}"
-	if [ -e "$tmp_wic" ]; then
-		# Ensure we don't have any junk leftover from a previously interrupted
-		# do_image_wic execution
-		rm -rf "$tmp_wic"
-	fi
-	if [ -z "$wks" ]; then
-		bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
-	fi
-	BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" -w "$tmp_wic" ${WIC_CREATE_EXTRA_ARGS}
-	mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
-}
-IMAGE_CMD:wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
-do_image_wic[cleandirs] = "${WORKDIR}/build-wic"
-
-PSEUDO_IGNORE_PATHS .= ",${WORKDIR}/build-wic"
-
-# Rebuild when the wks file or vars in WICVARS change
-USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
-WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}"
-do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
-do_image_wic[depends] += "${@' '.join('%s-native:do_populate_sysroot' % r for r in ('parted', 'gptfdisk', 'dosfstools', 'mtools'))}"
-
-# We ensure all artfacts are deployed (e.g virtual/bootloader)
-do_image_wic[recrdeptask] += "do_deploy"
-do_image_wic[deptask] += "do_image_complete"
-
-WKS_FILE_DEPENDS_DEFAULT = '${@bb.utils.contains_any("BUILD_ARCH", [ 'x86_64', 'i686' ], "syslinux-native", "",d)}'
-WKS_FILE_DEPENDS_DEFAULT += "bmap-tools-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native"
-# Unified kernel images need objcopy
-WKS_FILE_DEPENDS_DEFAULT += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
-WKS_FILE_DEPENDS_BOOTLOADERS = ""
-WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release"
-WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux grub-efi systemd-boot os-release"
-WKS_FILE_DEPENDS_BOOTLOADERS:x86-x32 = "syslinux grub-efi"
-
-WKS_FILE_DEPENDS ??= "${WKS_FILE_DEPENDS_DEFAULT} ${WKS_FILE_DEPENDS_BOOTLOADERS}"
-
-DEPENDS += "${@ '${WKS_FILE_DEPENDS}' if d.getVar('USING_WIC') else '' }"
-
-python do_write_wks_template () {
-    """Write out expanded template contents to WKS_FULL_PATH."""
-    import re
-
-    template_body = d.getVar('_WKS_TEMPLATE')
-
-    # Remove any remnant variable references left behind by the expansion
-    # due to undefined variables
-    expand_var_regexp = re.compile(r"\${[^{}@\n\t :]+}")
-    while True:
-        new_body = re.sub(expand_var_regexp, '', template_body)
-        if new_body == template_body:
-            break
-        else:
-            template_body = new_body
-
-    wks_file = d.getVar('WKS_FULL_PATH')
-    with open(wks_file, 'w') as f:
-        f.write(template_body)
-    f.close()
-    # Copy the finalized wks file to the deploy directory for later use
-    depdir = d.getVar('IMGDEPLOYDIR')
-    basename = d.getVar('IMAGE_BASENAME')
-    bb.utils.copyfile(wks_file, "%s/%s" % (depdir, basename + '-' + os.path.basename(wks_file)))
-}
-
-do_flush_pseudodb() {
-	${FAKEROOTENV} ${FAKEROOTCMD} -S
-}
-
-python () {
-    if d.getVar('USING_WIC'):
-        wks_file_u = d.getVar('WKS_FULL_PATH', False)
-        wks_file = d.expand(wks_file_u)
-        base, ext = os.path.splitext(wks_file)
-        if ext == '.in' and os.path.exists(wks_file):
-            wks_out_file = os.path.join(d.getVar('WORKDIR'), os.path.basename(base))
-            d.setVar('WKS_FULL_PATH', wks_out_file)
-            d.setVar('WKS_TEMPLATE_PATH', wks_file_u)
-            d.setVar('WKS_FILE_CHECKSUM', '${WKS_TEMPLATE_PATH}:True')
-
-            # We need to re-parse each time the file changes, and bitbake
-            # needs to be told about that explicitly.
-            bb.parse.mark_dependency(d, wks_file)
-
-            try:
-                with open(wks_file, 'r') as f:
-                    body = f.read()
-            except (IOError, OSError) as exc:
-                pass
-            else:
-                # Previously, I used expandWithRefs to get the dependency list
-                # and add it to WICVARS, but there's no point re-parsing the
-                # file in process_wks_template as well, so just put it in
-                # a variable and let the metadata deal with the deps.
-                d.setVar('_WKS_TEMPLATE', body)
-                bb.build.addtask('do_write_wks_template', 'do_image_wic', 'do_image', d)
-        bb.build.addtask('do_image_wic', 'do_image_complete', None, d)
-}
-
-#
-# Write environment variables used by wic
-# to tmp/sysroots/<machine>/imgdata/<image>.env
-#
-python do_rootfs_wicenv () {
-    wicvars = d.getVar('WICVARS')
-    if not wicvars:
-        return
-
-    stdir = d.getVar('STAGING_DIR')
-    outdir = os.path.join(stdir, d.getVar('MACHINE'), 'imgdata')
-    bb.utils.mkdirhier(outdir)
-    basename = d.getVar('IMAGE_BASENAME')
-    with open(os.path.join(outdir, basename) + '.env', 'w') as envf:
-        for var in wicvars.split():
-            value = d.getVar(var)
-            if value:
-                envf.write('%s="%s"\n' % (var, value.strip()))
-    envf.close()
-    # Copy .env file to deploy directory for later use with stand alone wic
-    depdir = d.getVar('IMGDEPLOYDIR')
-    bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env')
-}
-addtask do_flush_pseudodb after do_rootfs before do_image do_image_qa
-addtask do_rootfs_wicenv after do_image before do_image_wic
-do_rootfs_wicenv[vardeps] += "${WICVARS}"
-do_rootfs_wicenv[prefuncs] = 'set_image_size'
diff --git a/poky/meta/classes/insane.bbclass b/poky/meta/classes/insane.bbclass
deleted file mode 100644
index c8b434b..0000000
--- a/poky/meta/classes/insane.bbclass
+++ /dev/null
@@ -1,1447 +0,0 @@
-# BB Class inspired by ebuild.sh
-#
-# This class will test files after installation for certain
-# security issues and other kind of issues.
-#
-# Checks we do:
-#  -Check the ownership and permissions
-#  -Check the RUNTIME path for the $TMPDIR
-#  -Check if .la files wrongly point to workdir
-#  -Check if .pc files wrongly point to workdir
-#  -Check if packages contains .debug directories or .so files
-#   where they should be in -dev or -dbg
-#  -Check if config.log contains traces to broken autoconf tests
-#  -Check invalid characters (non-utf8) on some package metadata
-#  -Ensure that binaries in base_[bindir|sbindir|libdir] do not link
-#   into exec_prefix
-#  -Check that scripts in base_[bindir|sbindir|libdir] do not reference
-#   files under exec_prefix
-#  -Check if the package name is upper case
-
-# Elect whether a given type of error is a warning or error, they may
-# have been set by other files.
-WARN_QA ?= " libdir xorg-driver-abi buildpaths \
-            textrel incompatible-license files-invalid \
-            infodir build-deps src-uri-bad symlink-to-sysroot multilib \
-            invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
-            mime mime-xdg unlisted-pkg-lics unhandled-features-check \
-            missing-update-alternatives native-last missing-ptest \
-            license-exists license-no-generic license-syntax license-format \
-            license-incompatible license-file-missing obsolete-license \
-            "
-ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
-            perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
-            split-strip packages-list pkgv-undefined var-undefined \
-            version-going-backwards expanded-d invalid-chars \
-            license-checksum dev-elf file-rdeps configure-unsafe \
-            configure-gettext perllocalpod shebang-size \
-            already-stripped installed-vs-shipped ldflags compile-host-path \
-            install-host-path pn-overrides unknown-configure-option \
-            useless-rpaths rpaths staticdev empty-dirs \
-            "
-# Add usrmerge QA check based on distro feature
-ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
-
-FAKEROOT_QA = "host-user-contaminated"
-FAKEROOT_QA[doc] = "QA tests which need to run under fakeroot. If any \
-enabled tests are listed here, the do_package_qa task will run under fakeroot."
-
-ALL_QA = "${WARN_QA} ${ERROR_QA}"
-
-UNKNOWN_CONFIGURE_OPT_IGNORE ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static"
-
-# This is a list of directories that are expected to be empty.
-QA_EMPTY_DIRS ?= " \
-    /dev/pts \
-    /media \
-    /proc \
-    /run \
-    /tmp \
-    ${localstatedir}/run \
-    ${localstatedir}/volatile \
-"
-# It is possible to specify why a directory is expected to be empty by defining
-# QA_EMPTY_DIRS_RECOMMENDATION:<path>, which will then be included in the error
-# message if the directory is not empty. If it is not specified for a directory,
-# then "but it is expected to be empty" will be used.
-
-def package_qa_clean_path(path, d, pkg=None):
-    """
-    Remove redundant paths from the path for display.  If pkg isn't set then
-    TMPDIR is stripped, otherwise PKGDEST/pkg is stripped.
-    """
-    if pkg:
-        path = path.replace(os.path.join(d.getVar("PKGDEST"), pkg), "/")
-    return path.replace(d.getVar("TMPDIR"), "/").replace("//", "/")
-
-QAPATHTEST[shebang-size] = "package_qa_check_shebang_size"
-def package_qa_check_shebang_size(path, name, d, elf, messages):
-    import stat
-    if os.path.islink(path) or stat.S_ISFIFO(os.stat(path).st_mode) or elf:
-        return
-
-    try:
-        with open(path, 'rb') as f:
-            stanza = f.readline(130)
-    except IOError:
-        return
-
-    if stanza.startswith(b'#!'):
-        #Shebang not found
-        try:
-            stanza = stanza.decode("utf-8")
-        except UnicodeDecodeError:
-            #If it is not a text file, it is not a script
-            return
-
-        if len(stanza) > 129:
-            oe.qa.add_message(messages, "shebang-size", "%s: %s maximum shebang size exceeded, the maximum size is 128." % (name, package_qa_clean_path(path, d)))
-            return
-
-QAPATHTEST[libexec] = "package_qa_check_libexec"
-def package_qa_check_libexec(path,name, d, elf, messages):
-
-    # Skip the case where the default is explicitly /usr/libexec
-    libexec = d.getVar('libexecdir')
-    if libexec == "/usr/libexec":
-        return True
-
-    if 'libexec' in path.split(os.path.sep):
-        oe.qa.add_message(messages, "libexec", "%s: %s is using libexec please relocate to %s" % (name, package_qa_clean_path(path, d), libexec))
-        return False
-
-    return True
-
-QAPATHTEST[rpaths] = "package_qa_check_rpath"
-def package_qa_check_rpath(file,name, d, elf, messages):
-    """
-    Check for dangerous RPATHs
-    """
-    if not elf:
-        return
-
-    if os.path.islink(file):
-        return
-
-    bad_dirs = [d.getVar('BASE_WORKDIR'), d.getVar('STAGING_DIR_TARGET')]
-
-    phdrs = elf.run_objdump("-p", d)
-
-    import re
-    rpath_re = re.compile(r"\s+RPATH\s+(.*)")
-    for line in phdrs.split("\n"):
-        m = rpath_re.match(line)
-        if m:
-            rpath = m.group(1)
-            for dir in bad_dirs:
-                if dir in rpath:
-                    oe.qa.add_message(messages, "rpaths", "package %s contains bad RPATH %s in file %s" % (name, rpath, file))
-
-QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
-def package_qa_check_useless_rpaths(file, name, d, elf, messages):
-    """
-    Check for RPATHs that are useless but not dangerous
-    """
-    def rpath_eq(a, b):
-        return os.path.normpath(a) == os.path.normpath(b)
-
-    if not elf:
-        return
-
-    if os.path.islink(file):
-        return
-
-    libdir = d.getVar("libdir")
-    base_libdir = d.getVar("base_libdir")
-
-    phdrs = elf.run_objdump("-p", d)
-
-    import re
-    rpath_re = re.compile(r"\s+RPATH\s+(.*)")
-    for line in phdrs.split("\n"):
-        m = rpath_re.match(line)
-        if m:
-            rpath = m.group(1)
-            if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir):
-                # The dynamic linker searches both these places anyway.  There is no point in
-                # looking there again.
-                oe.qa.add_message(messages, "useless-rpaths", "%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d, name), rpath))
-
-QAPATHTEST[dev-so] = "package_qa_check_dev"
-def package_qa_check_dev(path, name, d, elf, messages):
-    """
-    Check for ".so" library symlinks in non-dev packages
-    """
-
-    if not name.endswith("-dev") and not name.endswith("-dbg") and not name.endswith("-ptest") and not name.startswith("nativesdk-") and path.endswith(".so") and os.path.islink(path):
-        oe.qa.add_message(messages, "dev-so", "non -dev/-dbg/nativesdk- package %s contains symlink .so '%s'" % \
-                 (name, package_qa_clean_path(path, d, name)))
-
-QAPATHTEST[dev-elf] = "package_qa_check_dev_elf"
-def package_qa_check_dev_elf(path, name, d, elf, messages):
-    """
-    Check that -dev doesn't contain real shared libraries.  The test has to
-    check that the file is not a link and is an ELF object as some recipes
-    install link-time .so files that are linker scripts.
-    """
-    if name.endswith("-dev") and path.endswith(".so") and not os.path.islink(path) and elf:
-        oe.qa.add_message(messages, "dev-elf", "-dev package %s contains non-symlink .so '%s'" % \
-                 (name, package_qa_clean_path(path, d, name)))
-
-QAPATHTEST[staticdev] = "package_qa_check_staticdev"
-def package_qa_check_staticdev(path, name, d, elf, messages):
-    """
-    Check for ".a" library in non-staticdev packages
-    There are a number of exceptions to this rule, -pic packages can contain
-    static libraries, the _nonshared.a belong with their -dev packages and
-    libgcc.a, libgcov.a will be skipped in their packages
-    """
-
-    if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a") and not '/usr/lib/debug-static/' in path and not '/.debug-static/' in path:
-        oe.qa.add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \
-                 (name, package_qa_clean_path(path,d, name)))
-
-QAPATHTEST[mime] = "package_qa_check_mime"
-def package_qa_check_mime(path, name, d, elf, messages):
-    """
-    Check if package installs mime types to /usr/share/mime/packages
-    while no inheriting mime.bbclass
-    """
-
-    if d.getVar("datadir") + "/mime/packages" in path and path.endswith('.xml') and not bb.data.inherits_class("mime", d):
-        oe.qa.add_message(messages, "mime", "package contains mime types but does not inherit mime: %s path '%s'" % \
-                 (name, package_qa_clean_path(path,d)))
-
-QAPATHTEST[mime-xdg] = "package_qa_check_mime_xdg"
-def package_qa_check_mime_xdg(path, name, d, elf, messages):
-    """
-    Check if package installs desktop file containing MimeType and requires
-    mime-types.bbclass to create /usr/share/applications/mimeinfo.cache
-    """
-
-    if d.getVar("datadir") + "/applications" in path and path.endswith('.desktop') and not bb.data.inherits_class("mime-xdg", d):
-        mime_type_found = False
-        try:
-            with open(path, 'r') as f:
-                for line in f.read().split('\n'):
-                    if 'MimeType' in line:
-                        mime_type_found = True
-                        break;
-        except:
-            # At least libreoffice installs symlinks with absolute paths that are dangling here.
-            # We could implement some magic but for few (one) recipes it is not worth the effort so just warn:
-            wstr = "%s cannot open %s - is it a symlink with absolute path?\n" % (name, package_qa_clean_path(path,d))
-            wstr += "Please check if (linked) file contains key 'MimeType'.\n"
-            pkgname = name
-            if name == d.getVar('PN'):
-                pkgname = '${PN}'
-            wstr += "If yes: add \'inhert mime-xdg\' and \'MIME_XDG_PACKAGES += \"%s\"\' / if no add \'INSANE_SKIP:%s += \"mime-xdg\"\' to recipe." % (pkgname, pkgname)
-            oe.qa.add_message(messages, "mime-xdg", wstr)
-        if mime_type_found:
-            oe.qa.add_message(messages, "mime-xdg", "package contains desktop file with key 'MimeType' but does not inhert mime-xdg: %s path '%s'" % \
-                    (name, package_qa_clean_path(path,d)))
-
-def package_qa_check_libdir(d):
-    """
-    Check for wrong library installation paths. For instance, catch
-    recipes installing /lib/bar.so when ${base_libdir}="lib32" or
-    installing in /usr/lib64 when ${libdir}="/usr/lib"
-    """
-    import re
-
-    pkgdest = d.getVar('PKGDEST')
-    base_libdir = d.getVar("base_libdir") + os.sep
-    libdir = d.getVar("libdir") + os.sep
-    libexecdir = d.getVar("libexecdir") + os.sep
-    exec_prefix = d.getVar("exec_prefix") + os.sep
-
-    messages = []
-
-    # The re's are purposely fuzzy, as some there are some .so.x.y.z files
-    # that don't follow the standard naming convention. It checks later
-    # that they are actual ELF files
-    lib_re = re.compile(r"^/lib.+\.so(\..+)?$")
-    exec_re = re.compile(r"^%s.*/lib.+\.so(\..+)?$" % exec_prefix)
-
-    for root, dirs, files in os.walk(pkgdest):
-        if root == pkgdest:
-            # Skip subdirectories for any packages with libdir in INSANE_SKIP
-            skippackages = []
-            for package in dirs:
-                if 'libdir' in (d.getVar('INSANE_SKIP:' + package) or "").split():
-                    bb.note("Package %s skipping libdir QA test" % (package))
-                    skippackages.append(package)
-                elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-file-directory' and package.endswith("-dbg"):
-                    bb.note("Package %s skipping libdir QA test for PACKAGE_DEBUG_SPLIT_STYLE equals debug-file-directory" % (package))
-                    skippackages.append(package)
-            for package in skippackages:
-                dirs.remove(package)
-        for file in files:
-            full_path = os.path.join(root, file)
-            rel_path = os.path.relpath(full_path, pkgdest)
-            if os.sep in rel_path:
-                package, rel_path = rel_path.split(os.sep, 1)
-                rel_path = os.sep + rel_path
-                if lib_re.match(rel_path):
-                    if base_libdir not in rel_path:
-                        # make sure it's an actual ELF file
-                        elf = oe.qa.ELFFile(full_path)
-                        try:
-                            elf.open()
-                            messages.append("%s: found library in wrong location: %s" % (package, rel_path))
-                        except (oe.qa.NotELFFileError):
-                            pass
-                if exec_re.match(rel_path):
-                    if libdir not in rel_path and libexecdir not in rel_path:
-                        # make sure it's an actual ELF file
-                        elf = oe.qa.ELFFile(full_path)
-                        try:
-                            elf.open()
-                            messages.append("%s: found library in wrong location: %s" % (package, rel_path))
-                        except (oe.qa.NotELFFileError):
-                            pass
-
-    if messages:
-        oe.qa.handle_error("libdir", "\n".join(messages), d)
-
-QAPATHTEST[debug-files] = "package_qa_check_dbg"
-def package_qa_check_dbg(path, name, d, elf, messages):
-    """
-    Check for ".debug" files or directories outside of the dbg package
-    """
-
-    if not "-dbg" in name and not "-ptest" in name:
-        if '.debug' in path.split(os.path.sep):
-            oe.qa.add_message(messages, "debug-files", "non debug package contains .debug directory: %s path %s" % \
-                     (name, package_qa_clean_path(path,d)))
-
-QAPATHTEST[arch] = "package_qa_check_arch"
-def package_qa_check_arch(path,name,d, elf, messages):
-    """
-    Check if archs are compatible
-    """
-    import re, oe.elf
-
-    if not elf:
-        return
-
-    target_os   = d.getVar('HOST_OS')
-    target_arch = d.getVar('HOST_ARCH')
-    provides = d.getVar('PROVIDES')
-    bpn = d.getVar('BPN')
-
-    if target_arch == "allarch":
-        pn = d.getVar('PN')
-        oe.qa.add_message(messages, "arch", pn + ": Recipe inherits the allarch class, but has packaged architecture-specific binaries")
-        return
-
-    # FIXME: Cross package confuse this check, so just skip them
-    for s in ['cross', 'nativesdk', 'cross-canadian']:
-        if bb.data.inherits_class(s, d):
-            return
-
-    # avoid following links to /usr/bin (e.g. on udev builds)
-    # we will check the files pointed to anyway...
-    if os.path.islink(path):
-        return
-
-    #if this will throw an exception, then fix the dict above
-    (machine, osabi, abiversion, littleendian, bits) \
-        = oe.elf.machine_dict(d)[target_os][target_arch]
-
-    # Check the architecture and endiannes of the binary
-    is_32 = (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and \
-            (target_os == "linux-gnux32" or target_os == "linux-muslx32" or \
-            target_os == "linux-gnu_ilp32" or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE')))
-    is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF")
-    if not ((machine == elf.machine()) or is_32 or is_bpf):
-        oe.qa.add_message(messages, "arch", "Architecture did not match (%s, expected %s) in %s" % \
-                 (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine), package_qa_clean_path(path, d, name)))
-    elif not ((bits == elf.abiSize()) or is_32 or is_bpf):
-        oe.qa.add_message(messages, "arch", "Bit size did not match (%d, expected %d) in %s" % \
-                 (elf.abiSize(), bits, package_qa_clean_path(path, d, name)))
-    elif not ((littleendian == elf.isLittleEndian()) or is_bpf):
-        oe.qa.add_message(messages, "arch", "Endiannes did not match (%d, expected %d) in %s" % \
-                 (elf.isLittleEndian(), littleendian, package_qa_clean_path(path,d, name)))
-
-QAPATHTEST[desktop] = "package_qa_check_desktop"
-def package_qa_check_desktop(path, name, d, elf, messages):
-    """
-    Run all desktop files through desktop-file-validate.
-    """
-    if path.endswith(".desktop"):
-        desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE'),'desktop-file-validate')
-        output = os.popen("%s %s" % (desktop_file_validate, path))
-        # This only produces output on errors
-        for l in output:
-            oe.qa.add_message(messages, "desktop", "Desktop file issue: " + l.strip())
-
-QAPATHTEST[textrel] = "package_qa_textrel"
-def package_qa_textrel(path, name, d, elf, messages):
-    """
-    Check if the binary contains relocations in .text
-    """
-
-    if not elf:
-        return
-
-    if os.path.islink(path):
-        return
-
-    phdrs = elf.run_objdump("-p", d)
-    sane = True
-
-    import re
-    textrel_re = re.compile(r"\s+TEXTREL\s+")
-    for line in phdrs.split("\n"):
-        if textrel_re.match(line):
-            sane = False
-            break
-
-    if not sane:
-        path = package_qa_clean_path(path, d, name)
-        oe.qa.add_message(messages, "textrel", "%s: ELF binary %s has relocations in .text" % (name, path))
-
-QAPATHTEST[ldflags] = "package_qa_hash_style"
-def package_qa_hash_style(path, name, d, elf, messages):
-    """
-    Check if the binary has the right hash style...
-    """
-
-    if not elf:
-        return
-
-    if os.path.islink(path):
-        return
-
-    gnu_hash = "--hash-style=gnu" in d.getVar('LDFLAGS')
-    if not gnu_hash:
-        gnu_hash = "--hash-style=both" in d.getVar('LDFLAGS')
-    if not gnu_hash:
-        return
-
-    sane = False
-    has_syms = False
-
-    phdrs = elf.run_objdump("-p", d)
-
-    # If this binary has symbols, we expect it to have GNU_HASH too.
-    for line in phdrs.split("\n"):
-        if "SYMTAB" in line:
-            has_syms = True
-        if "GNU_HASH" in line or "MIPS_XHASH" in line:
-            sane = True
-        if ("[mips32]" in line or "[mips64]" in line) and d.getVar('TCLIBC') == "musl":
-            sane = True
-    if has_syms and not sane:
-        path = package_qa_clean_path(path, d, name)
-        oe.qa.add_message(messages, "ldflags", "File %s in package %s doesn't have GNU_HASH (didn't pass LDFLAGS?)" % (path, name))
-
-
-QAPATHTEST[buildpaths] = "package_qa_check_buildpaths"
-def package_qa_check_buildpaths(path, name, d, elf, messages):
-    """
-    Check for build paths inside target files and error if paths are not
-    explicitly ignored.
-    """
-    import stat
-
-    # Ignore symlinks/devs/fifos
-    mode = os.lstat(path).st_mode
-    if stat.S_ISLNK(mode) or stat.S_ISBLK(mode) or stat.S_ISFIFO(mode) or stat.S_ISCHR(mode) or stat.S_ISSOCK(mode):
-        return
-
-    tmpdir = bytes(d.getVar('TMPDIR'), encoding="utf-8")
-    with open(path, 'rb') as f:
-        file_content = f.read()
-        if tmpdir in file_content:
-            trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "")
-            oe.qa.add_message(messages, "buildpaths", "File %s in package %s contains reference to TMPDIR" % (trimmed, name))
-
-
-QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi"
-def package_qa_check_xorg_driver_abi(path, name, d, elf, messages):
-    """
-    Check that all packages containing Xorg drivers have ABI dependencies
-    """
-
-    # Skip dev, dbg or nativesdk packages
-    if name.endswith("-dev") or name.endswith("-dbg") or name.startswith("nativesdk-"):
-        return
-
-    driverdir = d.expand("${libdir}/xorg/modules/drivers/")
-    if driverdir in path and path.endswith(".so"):
-        mlprefix = d.getVar('MLPREFIX') or ''
-        for rdep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + name) or ""):
-            if rdep.startswith("%sxorg-abi-" % mlprefix):
-                return
-        oe.qa.add_message(messages, "xorg-driver-abi", "Package %s contains Xorg driver (%s) but no xorg-abi- dependencies" % (name, os.path.basename(path)))
-
-QAPATHTEST[infodir] = "package_qa_check_infodir"
-def package_qa_check_infodir(path, name, d, elf, messages):
-    """
-    Check that /usr/share/info/dir isn't shipped in a particular package
-    """
-    infodir = d.expand("${infodir}/dir")
-
-    if infodir in path:
-        oe.qa.add_message(messages, "infodir", "The /usr/share/info/dir file is not meant to be shipped in a particular package.")
-
-QAPATHTEST[symlink-to-sysroot] = "package_qa_check_symlink_to_sysroot"
-def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
-    """
-    Check that the package doesn't contain any absolute symlinks to the sysroot.
-    """
-    if os.path.islink(path):
-        target = os.readlink(path)
-        if os.path.isabs(target):
-            tmpdir = d.getVar('TMPDIR')
-            if target.startswith(tmpdir):
-                trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "")
-                oe.qa.add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name))
-
-# Check license variables
-do_populate_lic[postfuncs] += "populate_lic_qa_checksum"
-python populate_lic_qa_checksum() {
-    """
-    Check for changes in the license files.
-    """
-
-    lic_files = d.getVar('LIC_FILES_CHKSUM') or ''
-    lic = d.getVar('LICENSE')
-    pn = d.getVar('PN')
-
-    if lic == "CLOSED":
-        return
-
-    if not lic_files and d.getVar('SRC_URI'):
-        oe.qa.handle_error("license-checksum", pn + ": Recipe file fetches files and does not have license file information (LIC_FILES_CHKSUM)", d)
-
-    srcdir = d.getVar('S')
-    corebase_licensefile = d.getVar('COREBASE') + "/LICENSE"
-    for url in lic_files.split():
-        try:
-            (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
-        except bb.fetch.MalformedUrl:
-            oe.qa.handle_error("license-checksum", pn + ": LIC_FILES_CHKSUM contains an invalid URL: " + url, d)
-            continue
-        srclicfile = os.path.join(srcdir, path)
-        if not os.path.isfile(srclicfile):
-            oe.qa.handle_error("license-checksum", pn + ": LIC_FILES_CHKSUM points to an invalid file: " + srclicfile, d)
-            continue
-
-        if (srclicfile == corebase_licensefile):
-            bb.warn("${COREBASE}/LICENSE is not a valid license file, please use '${COMMON_LICENSE_DIR}/MIT' for a MIT License file in LIC_FILES_CHKSUM. This will become an error in the future")
-
-        recipemd5 = parm.get('md5', '')
-        beginline, endline = 0, 0
-        if 'beginline' in parm:
-            beginline = int(parm['beginline'])
-        if 'endline' in parm:
-            endline = int(parm['endline'])
-
-        if (not beginline) and (not endline):
-            md5chksum = bb.utils.md5_file(srclicfile)
-            with open(srclicfile, 'r', errors='replace') as f:
-                license = f.read().splitlines()
-        else:
-            with open(srclicfile, 'rb') as f:
-                import hashlib
-                lineno = 0
-                license = []
-                m = hashlib.new('MD5', usedforsecurity=False)
-                for line in f:
-                    lineno += 1
-                    if (lineno >= beginline):
-                        if ((lineno <= endline) or not endline):
-                            m.update(line)
-                            license.append(line.decode('utf-8', errors='replace').rstrip())
-                        else:
-                            break
-                md5chksum = m.hexdigest()
-        if recipemd5 == md5chksum:
-            bb.note (pn + ": md5 checksum matched for ", url)
-        else:
-            if recipemd5:
-                msg = pn + ": The LIC_FILES_CHKSUM does not match for " + url
-                msg = msg + "\n" + pn + ": The new md5 checksum is " + md5chksum
-                max_lines = int(d.getVar('QA_MAX_LICENSE_LINES') or 20)
-                if not license or license[-1] != '':
-                    # Ensure that our license text ends with a line break
-                    # (will be added with join() below).
-                    license.append('')
-                remove = len(license) - max_lines
-                if remove > 0:
-                    start = max_lines // 2
-                    end = start + remove - 1
-                    del license[start:end]
-                    license.insert(start, '...')
-                msg = msg + "\n" + pn + ": Here is the selected license text:" + \
-                        "\n" + \
-                        "{:v^70}".format(" beginline=%d " % beginline if beginline else "") + \
-                        "\n" + "\n".join(license) + \
-                        "{:^^70}".format(" endline=%d " % endline if endline else "")
-                if beginline:
-                    if endline:
-                        srcfiledesc = "%s (lines %d through to %d)" % (srclicfile, beginline, endline)
-                    else:
-                        srcfiledesc = "%s (beginning on line %d)" % (srclicfile, beginline)
-                elif endline:
-                    srcfiledesc = "%s (ending on line %d)" % (srclicfile, endline)
-                else:
-                    srcfiledesc = srclicfile
-                msg = msg + "\n" + pn + ": Check if the license information has changed in %s to verify that the LICENSE value \"%s\" remains valid" % (srcfiledesc, lic)
-
-            else:
-                msg = pn + ": LIC_FILES_CHKSUM is not specified for " +  url
-                msg = msg + "\n" + pn + ": The md5 checksum is " + md5chksum
-            oe.qa.handle_error("license-checksum", msg, d)
-
-    oe.qa.exit_if_errors(d)
-}
-
-def qa_check_staged(path,d):
-    """
-    Check staged la and pc files for common problems like references to the work
-    directory.
-
-    As this is run after every stage we should be able to find the one
-    responsible for the errors easily even if we look at every .pc and .la file.
-    """
-
-    tmpdir = d.getVar('TMPDIR')
-    workdir = os.path.join(tmpdir, "work")
-    recipesysroot = d.getVar("RECIPE_SYSROOT")
-
-    if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d):
-        pkgconfigcheck = workdir
-    else:
-        pkgconfigcheck = tmpdir
-
-    skip = (d.getVar('INSANE_SKIP') or "").split()
-    skip_la = False
-    if 'la' in skip:
-        bb.note("Recipe %s skipping qa checking: la" % d.getVar('PN'))
-        skip_la = True
-
-    skip_pkgconfig = False
-    if 'pkgconfig' in skip:
-        bb.note("Recipe %s skipping qa checking: pkgconfig" % d.getVar('PN'))
-        skip_pkgconfig = True
-
-    skip_shebang_size = False
-    if 'shebang-size' in skip:
-        bb.note("Recipe %s skipping qa checkking: shebang-size" % d.getVar('PN'))
-        skip_shebang_size = True
-
-    # find all .la and .pc files
-    # read the content
-    # and check for stuff that looks wrong
-    for root, dirs, files in os.walk(path):
-        for file in files:
-            path = os.path.join(root,file)
-            if file.endswith(".la") and not skip_la:
-                with open(path) as f:
-                    file_content = f.read()
-                    file_content = file_content.replace(recipesysroot, "")
-                    if workdir in file_content:
-                        error_msg = "%s failed sanity test (workdir) in path %s" % (file,root)
-                        oe.qa.handle_error("la", error_msg, d)
-            elif file.endswith(".pc") and not skip_pkgconfig:
-                with open(path) as f:
-                    file_content = f.read()
-                    file_content = file_content.replace(recipesysroot, "")
-                    if pkgconfigcheck in file_content:
-                        error_msg = "%s failed sanity test (tmpdir) in path %s" % (file,root)
-                        oe.qa.handle_error("pkgconfig", error_msg, d)
-
-            if not skip_shebang_size:
-                errors = {}
-                package_qa_check_shebang_size(path, "", d, None, errors)
-                for e in errors:
-                    oe.qa.handle_error(e, errors[e], d)
-
-
-# Run all package-wide warnfuncs and errorfuncs
-def package_qa_package(warnfuncs, errorfuncs, package, d):
-    warnings = {}
-    errors = {}
-
-    for func in warnfuncs:
-        func(package, d, warnings)
-    for func in errorfuncs:
-        func(package, d, errors)
-
-    for w in warnings:
-        oe.qa.handle_error(w, warnings[w], d)
-    for e in errors:
-        oe.qa.handle_error(e, errors[e], d)
-
-    return len(errors) == 0
-
-# Run all recipe-wide warnfuncs and errorfuncs
-def package_qa_recipe(warnfuncs, errorfuncs, pn, d):
-    warnings = {}
-    errors = {}
-
-    for func in warnfuncs:
-        func(pn, d, warnings)
-    for func in errorfuncs:
-        func(pn, d, errors)
-
-    for w in warnings:
-        oe.qa.handle_error(w, warnings[w], d)
-    for e in errors:
-        oe.qa.handle_error(e, errors[e], d)
-
-    return len(errors) == 0
-
-def prepopulate_objdump_p(elf, d):
-    output = elf.run_objdump("-p", d)
-    return (elf.name, output)
-
-# Walk over all files in a directory and call func
-def package_qa_walk(warnfuncs, errorfuncs, package, d):
-    #if this will throw an exception, then fix the dict above
-    target_os   = d.getVar('HOST_OS')
-    target_arch = d.getVar('HOST_ARCH')
-
-    warnings = {}
-    errors = {}
-    elves = {}
-    for path in pkgfiles[package]:
-            elf = None
-            if os.path.isfile(path):
-                elf = oe.qa.ELFFile(path)
-                try:
-                    elf.open()
-                    elf.close()
-                except oe.qa.NotELFFileError:
-                    elf = None
-            if elf:
-                elves[path] = elf
-
-    results = oe.utils.multiprocess_launch(prepopulate_objdump_p, elves.values(), d, extraargs=(d,))
-    for item in results:
-        elves[item[0]].set_objdump("-p", item[1])
-
-    for path in pkgfiles[package]:
-            if path in elves:
-                elves[path].open()
-            for func in warnfuncs:
-                func(path, package, d, elves.get(path), warnings)
-            for func in errorfuncs:
-                func(path, package, d, elves.get(path), errors)
-            if path in elves:
-                elves[path].close()
-
-    for w in warnings:
-        oe.qa.handle_error(w, warnings[w], d)
-    for e in errors:
-        oe.qa.handle_error(e, errors[e], d)
-
-def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
-    # Don't do this check for kernel/module recipes, there aren't too many debug/development
-    # packages and you can get false positives e.g. on kernel-module-lirc-dev
-    if bb.data.inherits_class("kernel", d) or bb.data.inherits_class("module-base", d):
-        return
-
-    if not "-dbg" in pkg and not "packagegroup-" in pkg and not "-image" in pkg:
-        localdata = bb.data.createCopy(d)
-        localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES') + ':' + pkg)
-
-        # Now check the RDEPENDS
-        rdepends = bb.utils.explode_deps(localdata.getVar('RDEPENDS') or "")
-
-        # Now do the sanity check!!!
-        if "build-deps" not in skip:
-            for rdepend in rdepends:
-                if "-dbg" in rdepend and "debug-deps" not in skip:
-                    error_msg = "%s rdepends on %s" % (pkg,rdepend)
-                    oe.qa.handle_error("debug-deps", error_msg, d)
-                if (not "-dev" in pkg and not "-staticdev" in pkg) and rdepend.endswith("-dev") and "dev-deps" not in skip:
-                    error_msg = "%s rdepends on %s" % (pkg, rdepend)
-                    oe.qa.handle_error("dev-deps", error_msg, d)
-                if rdepend not in packages:
-                    rdep_data = oe.packagedata.read_subpkgdata(rdepend, d)
-                    if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
-                        continue
-                    if not rdep_data or not 'PN' in rdep_data:
-                        pkgdata_dir = d.getVar("PKGDATA_DIR")
-                        try:
-                            possibles = os.listdir("%s/runtime-rprovides/%s/" % (pkgdata_dir, rdepend))
-                        except OSError:
-                            possibles = []
-                        for p in possibles:
-                            rdep_data = oe.packagedata.read_subpkgdata(p, d)
-                            if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
-                                break
-                    if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
-                        continue
-                    if rdep_data and 'PN' in rdep_data:
-                        error_msg = "%s rdepends on %s, but it isn't a build dependency, missing %s in DEPENDS or PACKAGECONFIG?" % (pkg, rdepend, rdep_data['PN'])
-                    else:
-                        error_msg = "%s rdepends on %s, but it isn't a build dependency?" % (pkg, rdepend)
-                    oe.qa.handle_error("build-deps", error_msg, d)
-
-        if "file-rdeps" not in skip:
-            ignored_file_rdeps = set(['/bin/sh', '/usr/bin/env', 'rtld(GNU_HASH)'])
-            if bb.data.inherits_class('nativesdk', d):
-                ignored_file_rdeps |= set(['/bin/bash', '/usr/bin/perl', 'perl'])
-            # For Saving the FILERDEPENDS
-            filerdepends = {}
-            rdep_data = oe.packagedata.read_subpkgdata(pkg, d)
-            for key in rdep_data:
-                if key.startswith("FILERDEPENDS:"):
-                    for subkey in bb.utils.explode_deps(rdep_data[key]):
-                        if subkey not in ignored_file_rdeps and \
-                                not subkey.startswith('perl('):
-                            # We already know it starts with FILERDEPENDS_
-                            filerdepends[subkey] = key[13:]
-
-            if filerdepends:
-                done = rdepends[:]
-                # Add the rprovides of itself
-                if pkg not in done:
-                    done.insert(0, pkg)
-
-                # The python is not a package, but python-core provides it, so
-                # skip checking /usr/bin/python if python is in the rdeps, in
-                # case there is a RDEPENDS:pkg = "python" in the recipe.
-                for py in [ d.getVar('MLPREFIX') + "python", "python" ]:
-                    if py in done:
-                        filerdepends.pop("/usr/bin/python",None)
-                        done.remove(py)
-                for rdep in done:
-                    # The file dependencies may contain package names, e.g.,
-                    # perl
-                    filerdepends.pop(rdep,None)
-
-                    # For Saving the FILERPROVIDES, RPROVIDES and FILES_INFO
-                    rdep_data = oe.packagedata.read_subpkgdata(rdep, d)
-                    for key in rdep_data:
-                        if key.startswith("FILERPROVIDES:") or key.startswith("RPROVIDES:"):
-                            for subkey in bb.utils.explode_deps(rdep_data[key]):
-                                filerdepends.pop(subkey,None)
-                        # Add the files list to the rprovides
-                        if key.startswith("FILES_INFO:"):
-                            # Use eval() to make it as a dict
-                            for subkey in eval(rdep_data[key]):
-                                filerdepends.pop(subkey,None)
-                    if not filerdepends:
-                        # Break if all the file rdepends are met
-                        break
-            if filerdepends:
-                for key in filerdepends:
-                    error_msg = "%s contained in package %s requires %s, but no providers found in RDEPENDS:%s?" % \
-                            (filerdepends[key].replace(":%s" % pkg, "").replace("@underscore@", "_"), pkg, key, pkg)
-                    oe.qa.handle_error("file-rdeps", error_msg, d)
-package_qa_check_rdepends[vardepsexclude] = "OVERRIDES"
-
-def package_qa_check_deps(pkg, pkgdest, d):
-
-    localdata = bb.data.createCopy(d)
-    localdata.setVar('OVERRIDES', pkg)
-
-    def check_valid_deps(var):
-        try:
-            rvar = bb.utils.explode_dep_versions2(localdata.getVar(var) or "")
-        except ValueError as e:
-            bb.fatal("%s:%s: %s" % (var, pkg, e))
-        for dep in rvar:
-            for v in rvar[dep]:
-                if v and not v.startswith(('< ', '= ', '> ', '<= ', '>=')):
-                    error_msg = "%s:%s is invalid: %s (%s)   only comparisons <, =, >, <=, and >= are allowed" % (var, pkg, dep, v)
-                    oe.qa.handle_error("dep-cmp", error_msg, d)
-
-    check_valid_deps('RDEPENDS')
-    check_valid_deps('RRECOMMENDS')
-    check_valid_deps('RSUGGESTS')
-    check_valid_deps('RPROVIDES')
-    check_valid_deps('RREPLACES')
-    check_valid_deps('RCONFLICTS')
-
-QAPKGTEST[usrmerge] = "package_qa_check_usrmerge"
-def package_qa_check_usrmerge(pkg, d, messages):
-
-    pkgdest = d.getVar('PKGDEST')
-    pkg_dir = pkgdest + os.sep + pkg + os.sep
-    merged_dirs = ['bin', 'sbin', 'lib'] + d.getVar('MULTILIB_VARIANTS').split()
-    for f in merged_dirs:
-        if os.path.exists(pkg_dir + f) and not os.path.islink(pkg_dir + f):
-            msg = "%s package is not obeying usrmerge distro feature. /%s should be relocated to /usr." % (pkg, f)
-            oe.qa.add_message(messages, "usrmerge", msg)
-            return False
-    return True
-
-QAPKGTEST[perllocalpod] = "package_qa_check_perllocalpod"
-def package_qa_check_perllocalpod(pkg, d, messages):
-    """
-    Check that the recipe didn't ship a perlocal.pod file, which shouldn't be
-    installed in a distribution package.  cpan.bbclass sets NO_PERLLOCAL=1 to
-    handle this for most recipes.
-    """
-    import glob
-    pkgd = oe.path.join(d.getVar('PKGDEST'), pkg)
-    podpath = oe.path.join(pkgd, d.getVar("libdir"), "perl*", "*", "*", "perllocal.pod")
-
-    matches = glob.glob(podpath)
-    if matches:
-        matches = [package_qa_clean_path(path, d, pkg) for path in matches]
-        msg = "%s contains perllocal.pod (%s), should not be installed" % (pkg, " ".join(matches))
-        oe.qa.add_message(messages, "perllocalpod", msg)
-
-QAPKGTEST[expanded-d] = "package_qa_check_expanded_d"
-def package_qa_check_expanded_d(package, d, messages):
-    """
-    Check for the expanded D (${D}) value in pkg_* and FILES
-    variables, warn the user to use it correctly.
-    """
-    sane = True
-    expanded_d = d.getVar('D')
-
-    for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm':
-        bbvar = d.getVar(var + ":" + package) or ""
-        if expanded_d in bbvar:
-            if var == 'FILES':
-                oe.qa.add_message(messages, "expanded-d", "FILES in %s recipe should not contain the ${D} variable as it references the local build directory not the target filesystem, best solution is to remove the ${D} reference" % package)
-                sane = False
-            else:
-                oe.qa.add_message(messages, "expanded-d", "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, package))
-                sane = False
-    return sane
-
-QAPKGTEST[unlisted-pkg-lics] = "package_qa_check_unlisted_pkg_lics"
-def package_qa_check_unlisted_pkg_lics(package, d, messages):
-    """
-    Check that all licenses for a package are among the licenses for the recipe.
-    """
-    pkg_lics = d.getVar('LICENSE:' + package)
-    if not pkg_lics:
-        return True
-
-    recipe_lics_set = oe.license.list_licenses(d.getVar('LICENSE'))
-    package_lics = oe.license.list_licenses(pkg_lics)
-    unlisted = package_lics - recipe_lics_set
-    if unlisted:
-        oe.qa.add_message(messages, "unlisted-pkg-lics",
-                               "LICENSE:%s includes licenses (%s) that are not "
-                               "listed in LICENSE" % (package, ' '.join(unlisted)))
-        return False
-    obsolete = set(oe.license.obsolete_license_list()) & package_lics - recipe_lics_set
-    if obsolete:
-        oe.qa.add_message(messages, "obsolete-license",
-                               "LICENSE:%s includes obsolete licenses %s" % (package, ' '.join(obsolete)))
-        return False
-    return True
-
-QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs"
-def package_qa_check_empty_dirs(pkg, d, messages):
-    """
-    Check for the existence of files in directories that are expected to be
-    empty.
-    """
-
-    pkgd = oe.path.join(d.getVar('PKGDEST'), pkg)
-    for dir in (d.getVar('QA_EMPTY_DIRS') or "").split():
-        empty_dir = oe.path.join(pkgd, dir)
-        if os.path.exists(empty_dir) and os.listdir(empty_dir):
-            recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or
-                              "but it is expected to be empty")
-            msg = "%s installs files in %s, %s" % (pkg, dir, recommendation)
-            oe.qa.add_message(messages, "empty-dirs", msg)
-
-def package_qa_check_encoding(keys, encode, d):
-    def check_encoding(key, enc):
-        sane = True
-        value = d.getVar(key)
-        if value:
-            try:
-                s = value.encode(enc)
-            except UnicodeDecodeError as e:
-                error_msg = "%s has non %s characters" % (key,enc)
-                sane = False
-                oe.qa.handle_error("invalid-chars", error_msg, d)
-        return sane
-
-    for key in keys:
-        sane = check_encoding(key, encode)
-        if not sane:
-            break
-
-HOST_USER_UID := "${@os.getuid()}"
-HOST_USER_GID := "${@os.getgid()}"
-
-QAPATHTEST[host-user-contaminated] = "package_qa_check_host_user"
-def package_qa_check_host_user(path, name, d, elf, messages):
-    """Check for paths outside of /home which are owned by the user running bitbake."""
-
-    if not os.path.lexists(path):
-        return
-
-    dest = d.getVar('PKGDEST')
-    pn = d.getVar('PN')
-    home = os.path.join(dest, name, 'home')
-    if path == home or path.startswith(home + os.sep):
-        return
-
-    try:
-        stat = os.lstat(path)
-    except OSError as exc:
-        import errno
-        if exc.errno != errno.ENOENT:
-            raise
-    else:
-        check_uid = int(d.getVar('HOST_USER_UID'))
-        if stat.st_uid == check_uid:
-            oe.qa.add_message(messages, "host-user-contaminated", "%s: %s is owned by uid %d, which is the same as the user running bitbake. This may be due to host contamination" % (pn, package_qa_clean_path(path, d, name), check_uid))
-            return False
-
-        check_gid = int(d.getVar('HOST_USER_GID'))
-        if stat.st_gid == check_gid:
-            oe.qa.add_message(messages, "host-user-contaminated", "%s: %s is owned by gid %d, which is the same as the user running bitbake. This may be due to host contamination" % (pn, package_qa_clean_path(path, d, name), check_gid))
-            return False
-    return True
-
-QARECIPETEST[unhandled-features-check] = "package_qa_check_unhandled_features_check"
-def package_qa_check_unhandled_features_check(pn, d, messages):
-    if not bb.data.inherits_class('features_check', d):
-        var_set = False
-        for kind in ['DISTRO', 'MACHINE', 'COMBINED']:
-            for var in ['ANY_OF_' + kind + '_FEATURES', 'REQUIRED_' + kind + '_FEATURES', 'CONFLICT_' + kind + '_FEATURES']:
-                if d.getVar(var) is not None or d.hasOverrides(var):
-                    var_set = True
-        if var_set:
-            oe.qa.handle_error("unhandled-features-check", "%s: recipe doesn't inherit features_check" % pn, d)
-
-QARECIPETEST[missing-update-alternatives] = "package_qa_check_missing_update_alternatives"
-def package_qa_check_missing_update_alternatives(pn, d, messages):
-    # Look at all packages and find out if any of those sets ALTERNATIVE variable
-    # without inheriting update-alternatives class
-    for pkg in (d.getVar('PACKAGES') or '').split():
-        if d.getVar('ALTERNATIVE:%s' % pkg) and not bb.data.inherits_class('update-alternatives', d):
-            oe.qa.handle_error("missing-update-alternatives", "%s: recipe defines ALTERNATIVE:%s but doesn't inherit update-alternatives. This might fail during do_rootfs later!" % (pn, pkg), d)
-
-# The PACKAGE FUNC to scan each package
-python do_package_qa () {
-    import subprocess
-    import oe.packagedata
-
-    bb.note("DO PACKAGE QA")
-
-    main_lic = d.getVar('LICENSE')
-
-    # Check for obsolete license references in main LICENSE (packages are checked below for any changes)
-    main_licenses = oe.license.list_licenses(d.getVar('LICENSE'))
-    obsolete = set(oe.license.obsolete_license_list()) & main_licenses
-    if obsolete:
-        oe.qa.handle_error("obsolete-license", "Recipe LICENSE includes obsolete licenses %s" % ' '.join(obsolete), d)
-
-    bb.build.exec_func("read_subpackage_metadata", d)
-
-    # Check non UTF-8 characters on recipe's metadata
-    package_qa_check_encoding(['DESCRIPTION', 'SUMMARY', 'LICENSE', 'SECTION'], 'utf-8', d)
-
-    logdir = d.getVar('T')
-    pn = d.getVar('PN')
-
-    # Scan the packages...
-    pkgdest = d.getVar('PKGDEST')
-    packages = set((d.getVar('PACKAGES') or '').split())
-
-    global pkgfiles
-    pkgfiles = {}
-    for pkg in packages:
-        pkgfiles[pkg] = []
-        pkgdir = os.path.join(pkgdest, pkg)
-        for walkroot, dirs, files in os.walk(pkgdir):
-            # Don't walk into top-level CONTROL or DEBIAN directories as these
-            # are temporary directories created by do_package.
-            if walkroot == pkgdir:
-                for control in ("CONTROL", "DEBIAN"):
-                    if control in dirs:
-                        dirs.remove(control)
-            for file in files:
-                pkgfiles[pkg].append(os.path.join(walkroot, file))
-
-    # no packages should be scanned
-    if not packages:
-        return
-
-    import re
-    # The package name matches the [a-z0-9.+-]+ regular expression
-    pkgname_pattern = re.compile(r"^[a-z0-9.+-]+$")
-
-    taskdepdata = d.getVar("BB_TASKDEPDATA", False)
-    taskdeps = set()
-    for dep in taskdepdata:
-        taskdeps.add(taskdepdata[dep][0])
-
-    def parse_test_matrix(matrix_name):
-        testmatrix = d.getVarFlags(matrix_name) or {}
-        g = globals()
-        warnchecks = []
-        for w in (d.getVar("WARN_QA") or "").split():
-            if w in skip:
-               continue
-            if w in testmatrix and testmatrix[w] in g:
-                warnchecks.append(g[testmatrix[w]])
-
-        errorchecks = []
-        for e in (d.getVar("ERROR_QA") or "").split():
-            if e in skip:
-               continue
-            if e in testmatrix and testmatrix[e] in g:
-                errorchecks.append(g[testmatrix[e]])
-        return warnchecks, errorchecks
-
-    for package in packages:
-        skip = set((d.getVar('INSANE_SKIP') or "").split() +
-                   (d.getVar('INSANE_SKIP:' + package) or "").split())
-        if skip:
-            bb.note("Package %s skipping QA tests: %s" % (package, str(skip)))
-
-        bb.note("Checking Package: %s" % package)
-        # Check package name
-        if not pkgname_pattern.match(package):
-            oe.qa.handle_error("pkgname",
-                    "%s doesn't match the [a-z0-9.+-]+ regex" % package, d)
-
-        warn_checks, error_checks = parse_test_matrix("QAPATHTEST")
-        package_qa_walk(warn_checks, error_checks, package, d)
-
-        warn_checks, error_checks = parse_test_matrix("QAPKGTEST")
-        package_qa_package(warn_checks, error_checks, package, d)
-
-        package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d)
-        package_qa_check_deps(package, pkgdest, d)
-
-    warn_checks, error_checks = parse_test_matrix("QARECIPETEST")
-    package_qa_recipe(warn_checks, error_checks, pn, d)
-
-    if 'libdir' in d.getVar("ALL_QA").split():
-        package_qa_check_libdir(d)
-
-    oe.qa.exit_if_errors(d)
-}
-
-# binutils is used for most checks, so need to set as dependency
-# POPULATESYSROOTDEPS is defined in staging class.
-do_package_qa[depends] += "${POPULATESYSROOTDEPS}"
-do_package_qa[vardeps] = "${@bb.utils.contains('ERROR_QA', 'empty-dirs', 'QA_EMPTY_DIRS', '', d)}"
-do_package_qa[vardepsexclude] = "BB_TASKDEPDATA"
-do_package_qa[rdeptask] = "do_packagedata"
-addtask do_package_qa after do_packagedata do_package before do_build
-
-# Add the package specific INSANE_SKIPs to the sstate dependencies
-python() {
-    pkgs = (d.getVar('PACKAGES') or '').split()
-    for pkg in pkgs:
-        d.appendVarFlag("do_package_qa", "vardeps", " INSANE_SKIP:{}".format(pkg))
-}
-
-SSTATETASKS += "do_package_qa"
-do_package_qa[sstate-inputdirs] = ""
-do_package_qa[sstate-outputdirs] = ""
-python do_package_qa_setscene () {
-    sstate_setscene(d)
-}
-addtask do_package_qa_setscene
-
-python do_qa_sysroot() {
-    bb.note("QA checking do_populate_sysroot")
-    sysroot_destdir = d.expand('${SYSROOT_DESTDIR}')
-    for sysroot_dir in d.expand('${SYSROOT_DIRS}').split():
-        qa_check_staged(sysroot_destdir + sysroot_dir, d)
-    oe.qa.exit_with_message_if_errors("do_populate_sysroot for this recipe installed files with QA issues", d)
-}
-do_populate_sysroot[postfuncs] += "do_qa_sysroot"
-
-python do_qa_patch() {
-    import subprocess
-
-    ###########################################################################
-    # Check patch.log for fuzz warnings
-    #
-    # Further information on why we check for patch fuzz warnings:
-    # http://lists.openembedded.org/pipermail/openembedded-core/2018-March/148675.html
-    # https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450
-    ###########################################################################
-
-    logdir = d.getVar('T')
-    patchlog = os.path.join(logdir,"log.do_patch")
-
-    if os.path.exists(patchlog):
-        fuzzheader = '--- Patch fuzz start ---'
-        fuzzfooter = '--- Patch fuzz end ---'
-        statement = "grep -e '%s' %s > /dev/null" % (fuzzheader, patchlog)
-        if subprocess.call(statement, shell=True) == 0:
-            msg = "Fuzz detected:\n\n"
-            fuzzmsg = ""
-            inFuzzInfo = False
-            f = open(patchlog, "r")
-            for line in f:
-                if fuzzheader in line:
-                    inFuzzInfo = True
-                    fuzzmsg = ""
-                elif fuzzfooter in line:
-                    fuzzmsg = fuzzmsg.replace('\n\n', '\n')
-                    msg += fuzzmsg
-                    msg += "\n"
-                    inFuzzInfo = False
-                elif inFuzzInfo and not 'Now at patch' in line:
-                    fuzzmsg += line
-            f.close()
-            msg += "The context lines in the patches can be updated with devtool:\n"
-            msg += "\n"
-            msg += "    devtool modify %s\n" % d.getVar('PN')
-            msg += "    devtool finish --force-patch-refresh %s <layer_path>\n\n" % d.getVar('PN')
-            msg += "Don't forget to review changes done by devtool!\n"
-            if bb.utils.filter('ERROR_QA', 'patch-fuzz', d):
-                bb.error(msg)
-            elif bb.utils.filter('WARN_QA', 'patch-fuzz', d):
-                bb.warn(msg)
-            msg = "Patch log indicates that patches do not apply cleanly."
-            oe.qa.handle_error("patch-fuzz", msg, d)
-
-    # Check if the patch contains a correctly formatted and spelled Upstream-Status
-    import re
-    from oe import patch
-
-    for url in patch.src_patches(d):
-       (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url)
-
-       # skip patches not in oe-core
-       if '/meta/' not in fullpath:
-           continue
-
-       kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE)
-       strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport|Inactive-Upstream)( .+)?$", re.MULTILINE)
-       guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status"
-
-       with open(fullpath, encoding='utf-8', errors='ignore') as f:
-           file_content = f.read()
-           match_kinda = kinda_status_re.search(file_content)
-           match_strict = strict_status_re.search(file_content)
-
-           if not match_strict:
-               if match_kinda:
-                   bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)))
-               else:
-                   bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines))
-}
-
-python do_qa_configure() {
-    import subprocess
-
-    ###########################################################################
-    # Check config.log for cross compile issues
-    ###########################################################################
-
-    configs = []
-    workdir = d.getVar('WORKDIR')
-
-    skip = (d.getVar('INSANE_SKIP') or "").split()
-    skip_configure_unsafe = False
-    if 'configure-unsafe' in skip:
-        bb.note("Recipe %s skipping qa checking: configure-unsafe" % d.getVar('PN'))
-        skip_configure_unsafe = True
-
-    if bb.data.inherits_class('autotools', d) and not skip_configure_unsafe:
-        bb.note("Checking autotools environment for common misconfiguration")
-        for root, dirs, files in os.walk(workdir):
-            statement = "grep -q -F -e 'is unsafe for cross-compilation' %s" % \
-                        os.path.join(root,"config.log")
-            if "config.log" in files:
-                if subprocess.call(statement, shell=True) == 0:
-                    error_msg = """This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities.
-Rerun configure task after fixing this."""
-                    oe.qa.handle_error("configure-unsafe", error_msg, d)
-
-            if "configure.ac" in files:
-                configs.append(os.path.join(root,"configure.ac"))
-            if "configure.in" in files:
-                configs.append(os.path.join(root, "configure.in"))
-
-    ###########################################################################
-    # Check gettext configuration and dependencies are correct
-    ###########################################################################
-
-    skip_configure_gettext = False
-    if 'configure-gettext' in skip:
-        bb.note("Recipe %s skipping qa checking: configure-gettext" % d.getVar('PN'))
-        skip_configure_gettext = True
-
-    cnf = d.getVar('EXTRA_OECONF') or ""
-    if not ("gettext" in d.getVar('P') or "gcc-runtime" in d.getVar('P') or \
-            "--disable-nls" in cnf or skip_configure_gettext):
-        ml = d.getVar("MLPREFIX") or ""
-        if bb.data.inherits_class('cross-canadian', d):
-            gt = "nativesdk-gettext"
-        else:
-            gt = "gettext-native"
-        deps = bb.utils.explode_deps(d.getVar('DEPENDS') or "")
-        if gt not in deps:
-            for config in configs:
-                gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config
-                if subprocess.call(gnu, shell=True) == 0:
-                    error_msg = "AM_GNU_GETTEXT used but no inherit gettext"
-                    oe.qa.handle_error("configure-gettext", error_msg, d)
-
-    ###########################################################################
-    # Check unrecognised configure options (with a white list)
-    ###########################################################################
-    if bb.data.inherits_class("autotools", d):
-        bb.note("Checking configure output for unrecognised options")
-        try:
-            if bb.data.inherits_class("autotools", d):
-                flag = "WARNING: unrecognized options:"
-                log = os.path.join(d.getVar('B'), 'config.log')
-            output = subprocess.check_output(['grep', '-F', flag, log]).decode("utf-8").replace(', ', ' ').replace('"', '')
-            options = set()
-            for line in output.splitlines():
-                options |= set(line.partition(flag)[2].split())
-            ignore_opts = set(d.getVar("UNKNOWN_CONFIGURE_OPT_IGNORE").split())
-            options -= ignore_opts
-            if options:
-                pn = d.getVar('PN')
-                error_msg = pn + ": configure was passed unrecognised options: " + " ".join(options)
-                oe.qa.handle_error("unknown-configure-option", error_msg, d)
-        except subprocess.CalledProcessError:
-            pass
-
-    # Check invalid PACKAGECONFIG
-    pkgconfig = (d.getVar("PACKAGECONFIG") or "").split()
-    if pkgconfig:
-        pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
-        for pconfig in pkgconfig:
-            if pconfig not in pkgconfigflags:
-                pn = d.getVar('PN')
-                error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig)
-                oe.qa.handle_error("invalid-packageconfig", error_msg, d)
-
-    oe.qa.exit_if_errors(d)
-}
-
-def unpack_check_src_uri(pn, d):
-    import re
-
-    skip = (d.getVar('INSANE_SKIP') or "").split()
-    if 'src-uri-bad' in skip:
-        bb.note("Recipe %s skipping qa checking: src-uri-bad" % d.getVar('PN'))
-        return
-
-    if "${PN}" in d.getVar("SRC_URI", False):
-        oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses PN not BPN" % pn, d)
-
-    for url in d.getVar("SRC_URI").split():
-        # Search for github and gitlab URLs that pull unstable archives (comment for future greppers)
-        if re.search(r"git(hu|la)b\.com/.+/.+/archive/.+", url):
-            oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses unstable GitHub/GitLab archives, convert recipe to use git protocol" % pn, d)
-
-python do_qa_unpack() {
-    src_uri = d.getVar('SRC_URI')
-    s_dir = d.getVar('S')
-    if src_uri and not os.path.exists(s_dir):
-        bb.warn('%s: the directory %s (%s) pointed to by the S variable doesn\'t exist - please set S within the recipe to point to where the source has been unpacked to' % (d.getVar('PN'), d.getVar('S', False), s_dir))
-
-    unpack_check_src_uri(d.getVar('PN'), d)
-}
-
-# Check for patch fuzz
-do_patch[postfuncs] += "do_qa_patch "
-
-# Check broken config.log files, for packages requiring Gettext which
-# don't have it in DEPENDS.
-#addtask qa_configure after do_configure before do_compile
-do_configure[postfuncs] += "do_qa_configure "
-
-# Check does S exist.
-do_unpack[postfuncs] += "do_qa_unpack"
-
-python () {
-    import re
-    
-    tests = d.getVar('ALL_QA').split()
-    if "desktop" in tests:
-        d.appendVar("PACKAGE_DEPENDS", " desktop-file-utils-native")
-
-    ###########################################################################
-    # Check various variables
-    ###########################################################################
-
-    # Checking ${FILESEXTRAPATHS}
-    extrapaths = (d.getVar("FILESEXTRAPATHS") or "")
-    if '__default' not in extrapaths.split(":"):
-        msg = "FILESEXTRAPATHS-variable, must always use :prepend (or :append)\n"
-        msg += "type of assignment, and don't forget the colon.\n"
-        msg += "Please assign it with the format of:\n"
-        msg += "  FILESEXTRAPATHS:append := \":${THISDIR}/Your_Files_Path\" or\n"
-        msg += "  FILESEXTRAPATHS:prepend := \"${THISDIR}/Your_Files_Path:\"\n"
-        msg += "in your bbappend file\n\n"
-        msg += "Your incorrect assignment is:\n"
-        msg += "%s\n" % extrapaths
-        bb.warn(msg)
-
-    overrides = d.getVar('OVERRIDES').split(':')
-    pn = d.getVar('PN')
-    if pn in overrides:
-        msg = 'Recipe %s has PN of "%s" which is in OVERRIDES, this can result in unexpected behaviour.' % (d.getVar("FILE"), pn)
-        oe.qa.handle_error("pn-overrides", msg, d)
-    prog = re.compile(r'[A-Z]')
-    if prog.search(pn):
-        oe.qa.handle_error("uppercase-pn", 'PN: %s is upper case, this can result in unexpected behavior.' % pn, d)
-
-    # Some people mistakenly use DEPENDS:${PN} instead of DEPENDS and wonder
-    # why it doesn't work.
-    if (d.getVar(d.expand('DEPENDS:${PN}'))):
-        oe.qa.handle_error("pkgvarcheck", "recipe uses DEPENDS:${PN}, should use DEPENDS", d)
-
-    issues = []
-    if (d.getVar('PACKAGES') or "").split():
-        for dep in (d.getVar('QADEPENDS') or "").split():
-            d.appendVarFlag('do_package_qa', 'depends', " %s:do_populate_sysroot" % dep)
-        for var in 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RCONFLICTS', 'RPROVIDES', 'RREPLACES', 'FILES', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'ALLOW_EMPTY':
-            if d.getVar(var, False):
-                issues.append(var)
-
-        fakeroot_tests = d.getVar('FAKEROOT_QA').split()
-        if set(tests) & set(fakeroot_tests):
-            d.setVarFlag('do_package_qa', 'fakeroot', '1')
-            d.appendVarFlag('do_package_qa', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
-    else:
-        d.setVarFlag('do_package_qa', 'rdeptask', '')
-    for i in issues:
-        oe.qa.handle_error("pkgvarcheck", "%s: Variable %s is set as not being package specific, please fix this." % (d.getVar("FILE"), i), d)
-
-    if 'native-last' not in (d.getVar('INSANE_SKIP') or "").split():
-        for native_class in ['native', 'nativesdk']:
-            if bb.data.inherits_class(native_class, d):
-
-                inherited_classes = d.getVar('__inherit_cache', False) or []
-                needle = os.path.join('classes', native_class)
-
-                bbclassextend = (d.getVar('BBCLASSEXTEND') or '').split()
-                # BBCLASSEXTEND items are always added in the end
-                skip_classes = bbclassextend
-                if bb.data.inherits_class('native', d) or 'native' in bbclassextend:
-                    # native also inherits nopackages and relocatable bbclasses
-                    skip_classes.extend(['nopackages', 'relocatable'])
-
-                broken_order = []
-                for class_item in reversed(inherited_classes):
-                    if needle not in class_item:
-                        for extend_item in skip_classes:
-                            if os.path.join('classes', '%s.bbclass' % extend_item) in class_item:
-                                break
-                        else:
-                            pn = d.getVar('PN')
-                            broken_order.append(os.path.basename(class_item))
-                    else:
-                        break
-                if broken_order:
-                    oe.qa.handle_error("native-last", "%s: native/nativesdk class is not inherited last, this can result in unexpected behaviour. "
-                                             "Classes inherited after native/nativesdk: %s" % (pn, " ".join(broken_order)), d)
-
-    oe.qa.exit_if_errors(d)
-}
diff --git a/poky/meta/classes/kernel-arch.bbclass b/poky/meta/classes/kernel-arch.bbclass
deleted file mode 100644
index 348a3ad..0000000
--- a/poky/meta/classes/kernel-arch.bbclass
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# set the ARCH environment variable for kernel compilation (including
-# modules). return value must match one of the architecture directories
-# in the kernel source "arch" directory
-#
-
-valid_archs = "alpha cris ia64 \
-               i386 x86 \
-               m68knommu m68k ppc powerpc powerpc64 ppc64  \
-               sparc sparc64 \
-               arm aarch64 \
-               m32r mips \
-               sh sh64 um h8300   \
-               parisc s390  v850 \
-               avr32 blackfin \
-               microblaze \
-               nios2 arc riscv xtensa"
-
-def map_kernel_arch(a, d):
-    import re
-
-    valid_archs = d.getVar('valid_archs').split()
-
-    if   re.match('(i.86|athlon|x86.64)$', a):  return 'x86'
-    elif re.match('arceb$', a):                 return 'arc'
-    elif re.match('armeb$', a):                 return 'arm'
-    elif re.match('aarch64$', a):               return 'arm64'
-    elif re.match('aarch64_be$', a):            return 'arm64'
-    elif re.match('aarch64_ilp32$', a):         return 'arm64'
-    elif re.match('aarch64_be_ilp32$', a):      return 'arm64'
-    elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a):      return 'mips'
-    elif re.match('mcf', a):                    return 'm68k'
-    elif re.match('riscv(32|64|)(eb|)$', a):    return 'riscv'
-    elif re.match('p(pc|owerpc)(|64)', a):      return 'powerpc'
-    elif re.match('sh(3|4)$', a):               return 'sh'
-    elif re.match('bfin', a):                   return 'blackfin'
-    elif re.match('microblazee[bl]', a):        return 'microblaze'
-    elif a in valid_archs:                      return a
-    else:
-        if not d.getVar("TARGET_OS").startswith("linux"):
-            return a
-        bb.error("cannot map '%s' to a linux kernel architecture" % a)
-
-export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
-
-def map_uboot_arch(a, d):
-    import re
-
-    if   re.match('p(pc|owerpc)(|64)', a): return 'ppc'
-    elif re.match('i.86$', a): return 'x86'
-    return a
-
-export UBOOT_ARCH = "${@map_uboot_arch(d.getVar('ARCH'), d)}"
-
-# Set TARGET_??_KERNEL_ARCH in the machine .conf to set architecture
-# specific options necessary for building the kernel and modules.
-TARGET_CC_KERNEL_ARCH ?= ""
-HOST_CC_KERNEL_ARCH ?= "${TARGET_CC_KERNEL_ARCH}"
-TARGET_LD_KERNEL_ARCH ?= ""
-HOST_LD_KERNEL_ARCH ?= "${TARGET_LD_KERNEL_ARCH}"
-TARGET_AR_KERNEL_ARCH ?= ""
-HOST_AR_KERNEL_ARCH ?= "${TARGET_AR_KERNEL_ARCH}"
-
-KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH}"
-KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
-KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
-TOOLCHAIN = "gcc"
-
diff --git a/poky/meta/classes/kernel-artifact-names.bbclass b/poky/meta/classes/kernel-artifact-names.bbclass
deleted file mode 100644
index e77107c..0000000
--- a/poky/meta/classes/kernel-artifact-names.bbclass
+++ /dev/null
@@ -1,31 +0,0 @@
-##################################################################
-# Specific kernel creation info
-# for recipes/bbclasses which need to reuse some of the kernel
-# artifacts, but aren't kernel recipes themselves
-##################################################################
-
-inherit image-artifact-names
-
-KERNEL_ARTIFACT_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
-KERNEL_ARTIFACT_LINK_NAME ?= "${MACHINE}"
-KERNEL_ARTIFACT_BIN_EXT ?= ".bin"
-
-KERNEL_IMAGE_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-KERNEL_IMAGE_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-KERNEL_IMAGE_BIN_EXT ?= "${KERNEL_ARTIFACT_BIN_EXT}"
-KERNEL_IMAGETYPE_SYMLINK ?= "1"
-
-KERNEL_DTB_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-KERNEL_DTB_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-KERNEL_DTB_BIN_EXT ?= "${KERNEL_ARTIFACT_BIN_EXT}"
-
-KERNEL_FIT_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-KERNEL_FIT_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-KERNEL_FIT_BIN_EXT ?= "${KERNEL_ARTIFACT_BIN_EXT}"
-
-MODULE_TARBALL_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-MODULE_TARBALL_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-MODULE_TARBALL_DEPLOY ?= "1"
-
-INITRAMFS_NAME ?= "initramfs-${KERNEL_ARTIFACT_NAME}"
-INITRAMFS_LINK_NAME ?= "initramfs-${KERNEL_ARTIFACT_LINK_NAME}"
diff --git a/poky/meta/classes/kernel-devicetree.bbclass b/poky/meta/classes/kernel-devicetree.bbclass
deleted file mode 100644
index b4338da..0000000
--- a/poky/meta/classes/kernel-devicetree.bbclass
+++ /dev/null
@@ -1,113 +0,0 @@
-# Support for device tree generation
-python () {
-    if not bb.data.inherits_class('nopackages', d):
-        d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
-        if d.getVar('KERNEL_DEVICETREE_BUNDLE') == '1':
-            d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle")
-}
-
-FILES:${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
-FILES:${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
-
-# Generate kernel+devicetree bundle
-KERNEL_DEVICETREE_BUNDLE ?= "0"
-
-# dtc flags passed via DTC_FLAGS env variable
-KERNEL_DTC_FLAGS ?= ""
-
-normalize_dtb () {
-	dtb="$1"
-	if echo $dtb | grep -q '/dts/'; then
-		bbwarn "$dtb contains the full path to the the dts file, but only the dtb name should be used."
-		dtb=`basename $dtb | sed 's,\.dts$,.dtb,g'`
-	fi
-	echo "$dtb"
-}
-
-get_real_dtb_path_in_kernel () {
-	dtb="$1"
-	dtb_path="${B}/arch/${ARCH}/boot/dts/$dtb"
-	if [ ! -e "$dtb_path" ]; then
-		dtb_path="${B}/arch/${ARCH}/boot/$dtb"
-	fi
-	echo "$dtb_path"
-}
-
-do_configure:append() {
-	if [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
-		if echo ${KERNEL_IMAGETYPE_FOR_MAKE} | grep -q 'zImage'; then
-			case "${ARCH}" in
-				"arm")
-				config="${B}/.config"
-				if ! grep -q 'CONFIG_ARM_APPENDED_DTB=y' $config; then
-					bbwarn 'CONFIG_ARM_APPENDED_DTB is NOT enabled in the kernel. Enabling it to allow the kernel to boot with the Device Tree appended!'
-					sed -i "/CONFIG_ARM_APPENDED_DTB[ =]/d" $config
-					echo "CONFIG_ARM_APPENDED_DTB=y" >> $config
-					echo "# CONFIG_ARM_ATAG_DTB_COMPAT is not set" >> $config
-				fi
-				;;
-				*)
-				bberror "KERNEL_DEVICETREE_BUNDLE is not supported for ${ARCH}. Currently it is only supported for 'ARM'."
-			esac
-		else
-			bberror 'The KERNEL_DEVICETREE_BUNDLE requires the KERNEL_IMAGETYPE to contain zImage.'
-		fi
-	fi
-}
-
-do_compile:append() {
-	if [ -n "${KERNEL_DTC_FLAGS}" ]; then
-		export DTC_FLAGS="${KERNEL_DTC_FLAGS}"
-	fi
-
-	for dtbf in ${KERNEL_DEVICETREE}; do
-		dtb=`normalize_dtb "$dtbf"`
-		oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
-	done
-}
-
-do_install:append() {
-	for dtbf in ${KERNEL_DEVICETREE}; do
-		dtb=`normalize_dtb "$dtbf"`
-		dtb_ext=${dtb##*.}
-		dtb_base_name=`basename $dtb .$dtb_ext`
-		dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
-		install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext
-	done
-}
-
-do_deploy:append() {
-	for dtbf in ${KERNEL_DEVICETREE}; do
-		dtb=`normalize_dtb "$dtbf"`
-		dtb_ext=${dtb##*.}
-		dtb_base_name=`basename $dtb .$dtb_ext`
-		install -d $deployDir
-		install -m 0644 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext
-		if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then
-			ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext
-		fi
-		if [ -n "${KERNEL_DTB_LINK_NAME}" ] ; then
-			ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext
-		fi
-		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
-			if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
-				cat ${D}/${KERNEL_IMAGEDEST}/$type \
-					$deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \
-					> $deployDir/$type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
-				if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then
-					ln -sf $type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \
-						$deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
-				fi
-				if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
-					cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \
-						$deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \
-						>  $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
-					if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then
-						ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \
-							$deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
-					fi
-				fi
-			fi
-		done
-	done
-}
diff --git a/poky/meta/classes/kernel-fitimage.bbclass b/poky/meta/classes/kernel-fitimage.bbclass
deleted file mode 100644
index 7531645..0000000
--- a/poky/meta/classes/kernel-fitimage.bbclass
+++ /dev/null
@@ -1,797 +0,0 @@
-inherit kernel-uboot kernel-artifact-names uboot-sign
-
-def get_fit_replacement_type(d):
-    kerneltypes = d.getVar('KERNEL_IMAGETYPES') or ""
-    replacementtype = ""
-    if 'fitImage' in kerneltypes.split():
-        uarch = d.getVar("UBOOT_ARCH")
-        if uarch == "arm64":
-            replacementtype = "Image"
-        elif uarch == "riscv":
-            replacementtype = "Image"
-        elif uarch == "mips":
-            replacementtype = "vmlinuz.bin"
-        elif uarch == "x86":
-            replacementtype = "bzImage"
-        elif uarch == "microblaze":
-            replacementtype = "linux.bin"
-        else:
-            replacementtype = "zImage"
-    return replacementtype
-
-KERNEL_IMAGETYPE_REPLACEMENT ?= "${@get_fit_replacement_type(d)}"
-DEPENDS:append = " ${@'u-boot-tools-native dtc-native' if 'fitImage' in (d.getVar('KERNEL_IMAGETYPES') or '').split() else ''}"
-
-python __anonymous () {
-        # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
-        # to kernel.bbclass . We have to override it, since we pack zImage
-        # (at least for now) into the fitImage .
-        typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
-        if 'fitImage' in typeformake.split():
-            d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', d.getVar('KERNEL_IMAGETYPE_REPLACEMENT')))
-
-        image = d.getVar('INITRAMFS_IMAGE')
-        if image:
-            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
-
-        ubootenv = d.getVar('UBOOT_ENV')
-        if ubootenv:
-            d.appendVarFlag('do_assemble_fitimage', 'depends', ' virtual/bootloader:do_populate_sysroot')
-
-        #check if there are any dtb providers
-        providerdtb = d.getVar("PREFERRED_PROVIDER_virtual/dtb")
-        if providerdtb:
-            d.appendVarFlag('do_assemble_fitimage', 'depends', ' virtual/dtb:do_populate_sysroot')
-            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' virtual/dtb:do_populate_sysroot')
-            d.setVar('EXTERNAL_KERNEL_DEVICETREE', "${RECIPE_SYSROOT}/boot/devicetree")
-
-        # Verified boot will sign the fitImage and append the public key to
-        # U-Boot dtb. We ensure the U-Boot dtb is deployed before assembling
-        # the fitImage:
-        if d.getVar('UBOOT_SIGN_ENABLE') == "1" and d.getVar('UBOOT_DTB_BINARY'):
-            uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
-            d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
-            if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
-                d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
-}
-
-
-# Description string
-FIT_DESC ?= "Kernel fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"
-
-# Sign individual images as well
-FIT_SIGN_INDIVIDUAL ?= "0"
-
-FIT_CONF_PREFIX ?= "conf-"
-FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name"
-
-FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
-
-# Keys used to sign individually image nodes.
-# The keys to sign image nodes must be different from those used to sign
-# configuration nodes, otherwise the "required" property, from
-# UBOOT_DTB_BINARY, will be set to "conf", because "conf" prevails on "image".
-# Then the images signature checking will not be mandatory and no error will be
-# raised in case of failure.
-# UBOOT_SIGN_IMG_KEYNAME = "dev2" # keys name in keydir (eg. "dev2.crt", "dev2.key")
-
-#
-# Emit the fitImage ITS header
-#
-# $1 ... .its filename
-fitimage_emit_fit_header() {
-	cat << EOF >> $1
-/dts-v1/;
-
-/ {
-        description = "${FIT_DESC}";
-        #address-cells = <1>;
-EOF
-}
-
-#
-# Emit the fitImage section bits
-#
-# $1 ... .its filename
-# $2 ... Section bit type: imagestart - image section start
-#                          confstart  - configuration section start
-#                          sectend    - section end
-#                          fitend     - fitimage end
-#
-fitimage_emit_section_maint() {
-	case $2 in
-	imagestart)
-		cat << EOF >> $1
-
-        images {
-EOF
-	;;
-	confstart)
-		cat << EOF >> $1
-
-        configurations {
-EOF
-	;;
-	sectend)
-		cat << EOF >> $1
-	};
-EOF
-	;;
-	fitend)
-		cat << EOF >> $1
-};
-EOF
-	;;
-	esac
-}
-
-#
-# Emit the fitImage ITS kernel section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to kernel image
-# $4 ... Compression type
-fitimage_emit_section_kernel() {
-
-	kernel_csum="${FIT_HASH_ALG}"
-	kernel_sign_algo="${FIT_SIGN_ALG}"
-	kernel_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
-
-	ENTRYPOINT="${UBOOT_ENTRYPOINT}"
-	if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
-		ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
-			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
-	fi
-
-	cat << EOF >> $1
-                kernel-$2 {
-                        description = "Linux kernel";
-                        data = /incbin/("$3");
-                        type = "${UBOOT_MKIMAGE_KERNEL_TYPE}";
-                        arch = "${UBOOT_ARCH}";
-                        os = "linux";
-                        compression = "$4";
-                        load = <${UBOOT_LOADADDRESS}>;
-                        entry = <$ENTRYPOINT>;
-                        hash-1 {
-                                algo = "$kernel_csum";
-                        };
-                };
-EOF
-
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$kernel_sign_keyname" ] ; then
-		sed -i '$ d' $1
-		cat << EOF >> $1
-                        signature-1 {
-                                algo = "$kernel_csum,$kernel_sign_algo";
-                                key-name-hint = "$kernel_sign_keyname";
-                        };
-                };
-EOF
-	fi
-}
-
-#
-# Emit the fitImage ITS DTB section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to DTB image
-fitimage_emit_section_dtb() {
-
-	dtb_csum="${FIT_HASH_ALG}"
-	dtb_sign_algo="${FIT_SIGN_ALG}"
-	dtb_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
-
-	dtb_loadline=""
-	dtb_ext=${DTB##*.}
-	if [ "${dtb_ext}" = "dtbo" ]; then
-		if [ -n "${UBOOT_DTBO_LOADADDRESS}" ]; then
-			dtb_loadline="load = <${UBOOT_DTBO_LOADADDRESS}>;"
-		fi
-	elif [ -n "${UBOOT_DTB_LOADADDRESS}" ]; then
-		dtb_loadline="load = <${UBOOT_DTB_LOADADDRESS}>;"
-	fi
-	cat << EOF >> $1
-                fdt-$2 {
-                        description = "Flattened Device Tree blob";
-                        data = /incbin/("$3");
-                        type = "flat_dt";
-                        arch = "${UBOOT_ARCH}";
-                        compression = "none";
-                        $dtb_loadline
-                        hash-1 {
-                                algo = "$dtb_csum";
-                        };
-                };
-EOF
-
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$dtb_sign_keyname" ] ; then
-		sed -i '$ d' $1
-		cat << EOF >> $1
-                        signature-1 {
-                                algo = "$dtb_csum,$dtb_sign_algo";
-                                key-name-hint = "$dtb_sign_keyname";
-                        };
-                };
-EOF
-	fi
-}
-
-#
-# Emit the fitImage ITS u-boot script section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to boot script image
-fitimage_emit_section_boot_script() {
-
-	bootscr_csum="${FIT_HASH_ALG}"
-	bootscr_sign_algo="${FIT_SIGN_ALG}"
-	bootscr_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
-
-        cat << EOF >> $1
-                bootscr-$2 {
-                        description = "U-boot script";
-                        data = /incbin/("$3");
-                        type = "script";
-                        arch = "${UBOOT_ARCH}";
-                        compression = "none";
-                        hash-1 {
-                                algo = "$bootscr_csum";
-                        };
-                };
-EOF
-
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$bootscr_sign_keyname" ] ; then
-		sed -i '$ d' $1
-		cat << EOF >> $1
-                        signature-1 {
-                                algo = "$bootscr_csum,$bootscr_sign_algo";
-                                key-name-hint = "$bootscr_sign_keyname";
-                        };
-                };
-EOF
-	fi
-}
-
-#
-# Emit the fitImage ITS setup section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to setup image
-fitimage_emit_section_setup() {
-
-	setup_csum="${FIT_HASH_ALG}"
-
-	cat << EOF >> $1
-                setup-$2 {
-                        description = "Linux setup.bin";
-                        data = /incbin/("$3");
-                        type = "x86_setup";
-                        arch = "${UBOOT_ARCH}";
-                        os = "linux";
-                        compression = "none";
-                        load = <0x00090000>;
-                        entry = <0x00090000>;
-                        hash-1 {
-                                algo = "$setup_csum";
-                        };
-                };
-EOF
-}
-
-#
-# Emit the fitImage ITS ramdisk section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to ramdisk image
-fitimage_emit_section_ramdisk() {
-
-	ramdisk_csum="${FIT_HASH_ALG}"
-	ramdisk_sign_algo="${FIT_SIGN_ALG}"
-	ramdisk_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
-	ramdisk_loadline=""
-	ramdisk_entryline=""
-
-	if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
-		ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
-	fi
-	if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
-		ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
-	fi
-
-	cat << EOF >> $1
-                ramdisk-$2 {
-                        description = "${INITRAMFS_IMAGE}";
-                        data = /incbin/("$3");
-                        type = "ramdisk";
-                        arch = "${UBOOT_ARCH}";
-                        os = "linux";
-                        compression = "none";
-                        $ramdisk_loadline
-                        $ramdisk_entryline
-                        hash-1 {
-                                algo = "$ramdisk_csum";
-                        };
-                };
-EOF
-
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$ramdisk_sign_keyname" ] ; then
-		sed -i '$ d' $1
-		cat << EOF >> $1
-                        signature-1 {
-                                algo = "$ramdisk_csum,$ramdisk_sign_algo";
-                                key-name-hint = "$ramdisk_sign_keyname";
-                        };
-                };
-EOF
-	fi
-}
-
-#
-# Emit the fitImage ITS configuration section
-#
-# $1 ... .its filename
-# $2 ... Linux kernel ID
-# $3 ... DTB image name
-# $4 ... ramdisk ID
-# $5 ... u-boot script ID
-# $6 ... config ID
-# $7 ... default flag
-fitimage_emit_section_config() {
-
-	conf_csum="${FIT_HASH_ALG}"
-	conf_sign_algo="${FIT_SIGN_ALG}"
-	conf_padding_algo="${FIT_PAD_ALG}"
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
-		conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
-	fi
-
-	its_file="$1"
-	kernel_id="$2"
-	dtb_image="$3"
-	ramdisk_id="$4"
-	bootscr_id="$5"
-	config_id="$6"
-	default_flag="$7"
-
-	# Test if we have any DTBs at all
-	sep=""
-	conf_desc=""
-	conf_node="${FIT_CONF_PREFIX}"
-	kernel_line=""
-	fdt_line=""
-	ramdisk_line=""
-	bootscr_line=""
-	setup_line=""
-	default_line=""
-
-	# conf node name is selected based on dtb ID if it is present,
-	# otherwise its selected based on kernel ID
-	if [ -n "$dtb_image" ]; then
-		conf_node=$conf_node$dtb_image
-	else
-		conf_node=$conf_node$kernel_id
-	fi
-
-	if [ -n "$kernel_id" ]; then
-		conf_desc="Linux kernel"
-		sep=", "
-		kernel_line="kernel = \"kernel-$kernel_id\";"
-	fi
-
-	if [ -n "$dtb_image" ]; then
-		conf_desc="$conf_desc${sep}FDT blob"
-		sep=", "
-		fdt_line="fdt = \"fdt-$dtb_image\";"
-	fi
-
-	if [ -n "$ramdisk_id" ]; then
-		conf_desc="$conf_desc${sep}ramdisk"
-		sep=", "
-		ramdisk_line="ramdisk = \"ramdisk-$ramdisk_id\";"
-	fi
-
-	if [ -n "$bootscr_id" ]; then
-		conf_desc="$conf_desc${sep}u-boot script"
-		sep=", "
-		bootscr_line="bootscr = \"bootscr-$bootscr_id\";"
-	fi
-
-	if [ -n "$config_id" ]; then
-		conf_desc="$conf_desc${sep}setup"
-		setup_line="setup = \"setup-$config_id\";"
-	fi
-
-	if [ "$default_flag" = "1" ]; then
-		# default node is selected based on dtb ID if it is present,
-		# otherwise its selected based on kernel ID
-		if [ -n "$dtb_image" ]; then
-			default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";"
-		else
-			default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";"
-		fi
-	fi
-
-	cat << EOF >> $its_file
-                $default_line
-                $conf_node {
-                        description = "$default_flag $conf_desc";
-                        $kernel_line
-                        $fdt_line
-                        $ramdisk_line
-                        $bootscr_line
-                        $setup_line
-                        hash-1 {
-                                algo = "$conf_csum";
-                        };
-EOF
-
-	if [ -n "$conf_sign_keyname" ] ; then
-
-		sign_line="sign-images = "
-		sep=""
-
-		if [ -n "$kernel_id" ]; then
-			sign_line="$sign_line${sep}\"kernel\""
-			sep=", "
-		fi
-
-		if [ -n "$dtb_image" ]; then
-			sign_line="$sign_line${sep}\"fdt\""
-			sep=", "
-		fi
-
-		if [ -n "$ramdisk_id" ]; then
-			sign_line="$sign_line${sep}\"ramdisk\""
-			sep=", "
-		fi
-
-		if [ -n "$bootscr_id" ]; then
-			sign_line="$sign_line${sep}\"bootscr\""
-			sep=", "
-		fi
-
-		if [ -n "$config_id" ]; then
-			sign_line="$sign_line${sep}\"setup\""
-		fi
-
-		sign_line="$sign_line;"
-
-		cat << EOF >> $its_file
-                        signature-1 {
-                                algo = "$conf_csum,$conf_sign_algo";
-                                key-name-hint = "$conf_sign_keyname";
-                                padding = "$conf_padding_algo";
-                                $sign_line
-                        };
-EOF
-	fi
-
-	cat << EOF >> $its_file
-                };
-EOF
-}
-
-#
-# Assemble fitImage
-#
-# $1 ... .its filename
-# $2 ... fitImage name
-# $3 ... include ramdisk
-fitimage_assemble() {
-	kernelcount=1
-	dtbcount=""
-	DTBS=""
-	ramdiskcount=$3
-	setupcount=""
-	bootscr_id=""
-	rm -f $1 arch/${ARCH}/boot/$2
-
-	if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then
-		bbfatal "Keys used to sign images and configuration nodes must be different."
-	fi
-
-	fitimage_emit_fit_header $1
-
-	#
-	# Step 1: Prepare a kernel image section.
-	#
-	fitimage_emit_section_maint $1 imagestart
-
-	uboot_prep_kimage
-	fitimage_emit_section_kernel $1 $kernelcount linux.bin "$linux_comp"
-
-	#
-	# Step 2: Prepare a DTB image section
-	#
-
-	if [ -n "${KERNEL_DEVICETREE}" ]; then
-		dtbcount=1
-		for DTB in ${KERNEL_DEVICETREE}; do
-			if echo $DTB | grep -q '/dts/'; then
-				bbwarn "$DTB contains the full path to the the dts file, but only the dtb name should be used."
-				DTB=`basename $DTB | sed 's,\.dts$,.dtb,g'`
-			fi
-
-			# Skip ${DTB} if it's also provided in ${EXTERNAL_KERNEL_DEVICETREE}
-			if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -s ${EXTERNAL_KERNEL_DEVICETREE}/${DTB} ]; then
-				continue
-			fi
-
-			DTB_PATH="arch/${ARCH}/boot/dts/$DTB"
-			if [ ! -e "$DTB_PATH" ]; then
-				DTB_PATH="arch/${ARCH}/boot/$DTB"
-			fi
-
-			DTB=$(echo "$DTB" | tr '/' '_')
-			DTBS="$DTBS $DTB"
-			fitimage_emit_section_dtb $1 $DTB $DTB_PATH
-		done
-	fi
-
-	if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then
-		dtbcount=1
-		for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do
-			DTB=$(echo "$DTB" | tr '/' '_')
-			DTBS="$DTBS $DTB"
-			fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB"
-		done
-	fi
-
-	#
-	# Step 3: Prepare a u-boot script section
-	#
-
-	if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
-		if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
-			cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
-			bootscr_id="${UBOOT_ENV_BINARY}"
-			fitimage_emit_section_boot_script $1 "$bootscr_id" ${UBOOT_ENV_BINARY}
-		else
-			bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not found."
-		fi
-	fi
-
-	#
-	# Step 4: Prepare a setup section. (For x86)
-	#
-	if [ -e arch/${ARCH}/boot/setup.bin ]; then
-		setupcount=1
-		fitimage_emit_section_setup $1 $setupcount arch/${ARCH}/boot/setup.bin
-	fi
-
-	#
-	# Step 5: Prepare a ramdisk section.
-	#
-	if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
-		# Find and use the first initramfs image archive type we find
-		found=
-		for img in ${FIT_SUPPORTED_INITRAMFS_FSTYPES}; do
-			initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img"
-			if [ -e "$initramfs_path" ]; then
-				bbnote "Found initramfs image: $initramfs_path"
-				found=true
-				fitimage_emit_section_ramdisk $1 "$ramdiskcount" "$initramfs_path"
-				break
-			else
-				bbnote "Did not find initramfs image: $initramfs_path"
-			fi
-		done
-
-		if [ -z "$found" ]; then
-			bbfatal "Could not find a valid initramfs type for ${INITRAMFS_IMAGE_NAME}, the supported types are: ${FIT_SUPPORTED_INITRAMFS_FSTYPES}"
-		fi
-	fi
-
-	fitimage_emit_section_maint $1 sectend
-
-	# Force the first Kernel and DTB in the default config
-	kernelcount=1
-	if [ -n "$dtbcount" ]; then
-		dtbcount=1
-	fi
-
-	#
-	# Step 6: Prepare a configurations section
-	#
-	fitimage_emit_section_maint $1 confstart
-
-	# kernel-fitimage.bbclass currently only supports a single kernel (no less or
-	# more) to be added to the FIT image along with 0 or more device trees and
-	# 0 or 1 ramdisk.
-        # It is also possible to include an initramfs bundle (kernel and rootfs in one binary)
-        # When the initramfs bundle is used ramdisk is disabled.
-	# If a device tree is to be part of the FIT image, then select
-	# the default configuration to be used is based on the dtbcount. If there is
-	# no dtb present than select the default configuation to be based on
-	# the kernelcount.
-	if [ -n "$DTBS" ]; then
-		i=1
-		for DTB in ${DTBS}; do
-			dtb_ext=${DTB##*.}
-			if [ "$dtb_ext" = "dtbo" ]; then
-				fitimage_emit_section_config $1 "" "$DTB" "" "$bootscr_id" "" "`expr $i = $dtbcount`"
-			else
-				fitimage_emit_section_config $1 $kernelcount "$DTB" "$ramdiskcount" "$bootscr_id" "$setupcount" "`expr $i = $dtbcount`"
-			fi
-			i=`expr $i + 1`
-		done
-	else
-		defaultconfigcount=1
-		fitimage_emit_section_config $1 $kernelcount "" "$ramdiskcount" "$bootscr_id"  "$setupcount" $defaultconfigcount
-	fi
-
-	fitimage_emit_section_maint $1 sectend
-
-	fitimage_emit_section_maint $1 fitend
-
-	#
-	# Step 7: Assemble the image
-	#
-	${UBOOT_MKIMAGE} \
-		${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
-		-f $1 \
-		arch/${ARCH}/boot/$2
-
-	#
-	# Step 8: Sign the image and add public key to U-Boot dtb
-	#
-	if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
-		add_key_to_u_boot=""
-		if [ -n "${UBOOT_DTB_BINARY}" ]; then
-			# The u-boot.dtb is a symlink to UBOOT_DTB_IMAGE, so we need copy
-			# both of them, and don't dereference the symlink.
-			cp -P ${STAGING_DATADIR}/u-boot*.dtb ${B}
-			add_key_to_u_boot="-K ${B}/${UBOOT_DTB_BINARY}"
-		fi
-		${UBOOT_MKIMAGE_SIGN} \
-			${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
-			-F -k "${UBOOT_SIGN_KEYDIR}" \
-			$add_key_to_u_boot \
-			-r arch/${ARCH}/boot/$2 \
-			${UBOOT_MKIMAGE_SIGN_ARGS}
-	fi
-}
-
-do_assemble_fitimage() {
-	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
-		cd ${B}
-		fitimage_assemble fit-image.its fitImage ""
-	fi
-}
-
-addtask assemble_fitimage before do_install after do_compile
-
-do_assemble_fitimage_initramfs() {
-	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
-		test -n "${INITRAMFS_IMAGE}" ; then
-		cd ${B}
-		if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
-			fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage ""
-		else
-			fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
-		fi
-	fi
-}
-
-addtask assemble_fitimage_initramfs before do_deploy after do_bundle_initramfs
-
-do_kernel_generate_rsa_keys() {
-	if [ "${UBOOT_SIGN_ENABLE}" = "0" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then
-		bbwarn "FIT_GENERATE_KEYS is set to 1 even though UBOOT_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used."
-	fi
-
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then
-
-		# Generate keys to sign configuration nodes, only if they don't already exist
-		if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key ] || \
-			[ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt ]; then
-
-			# make directory if it does not already exist
-			mkdir -p "${UBOOT_SIGN_KEYDIR}"
-
-			bbnote "Generating RSA private key for signing fitImage"
-			openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \
-				"${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
-			"${FIT_SIGN_NUMBITS}"
-
-			bbnote "Generating certificate for signing fitImage"
-			openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \
-				-key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
-				-out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt
-		fi
-
-		# Generate keys to sign image nodes, only if they don't already exist
-		if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key ] || \
-			[ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".crt ]; then
-
-			# make directory if it does not already exist
-			mkdir -p "${UBOOT_SIGN_KEYDIR}"
-
-			bbnote "Generating RSA private key for signing fitImage"
-			openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \
-				"${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key \
-			"${FIT_SIGN_NUMBITS}"
-
-			bbnote "Generating certificate for signing fitImage"
-			openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \
-				-key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key \
-				-out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".crt
-		fi
-	fi
-}
-
-addtask kernel_generate_rsa_keys before do_assemble_fitimage after do_compile
-
-kernel_do_deploy[vardepsexclude] = "DATETIME"
-kernel_do_deploy:append() {
-	# Update deploy directory
-	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
-
-		if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
-			bbnote "Copying fit-image.its source file..."
-			install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
-			if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
-				ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}"
-			fi
-
-			bbnote "Copying linux.bin file..."
-			install -m 0644 ${B}/linux.bin $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}
-			if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
-				ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}"
-			fi
-		fi
-
-		if [ -n "${INITRAMFS_IMAGE}" ]; then
-			bbnote "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
-			install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its"
-			if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
-				ln -snf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
-			fi
-
-			if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
-				bbnote "Copying fitImage-${INITRAMFS_IMAGE} file..."
-				install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}"
-				if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
-					ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
-				fi
-			fi
-		fi
-	fi
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" -o "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
-	   [ -n "${UBOOT_DTB_BINARY}" ] ; then
-		# UBOOT_DTB_IMAGE is a realfile, but we can't use
-		# ${UBOOT_DTB_IMAGE} since it contains ${PV} which is aimed
-		# for u-boot, but we are in kernel env now.
-		install -m 0644 ${B}/u-boot-${MACHINE}*.dtb "$deployDir/"
-	fi
-	if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${UBOOT_BINARY}" -a -n "${SPL_DTB_BINARY}" ] ; then
-		# If we're also creating and/or signing the uboot fit, now we need to
-		# deploy it, it's its file, as well as u-boot-spl.dtb
-		install -m 0644 ${B}/u-boot-spl-${MACHINE}*.dtb "$deployDir/"
-		bbnote "Copying u-boot-fitImage file..."
-		install -m 0644 ${B}/u-boot-fitImage-* "$deployDir/"
-		bbnote "Copying u-boot-its file..."
-		install -m 0644 ${B}/u-boot-its-* "$deployDir/"
-	fi
-}
-
-# The function below performs the following in case of initramfs bundles:
-# - Removes do_assemble_fitimage. FIT generation is done through
-#   do_assemble_fitimage_initramfs. do_assemble_fitimage is not needed
-#   and should not be part of the tasks to be executed.
-# - Since do_kernel_generate_rsa_keys is inserted by default
-#   between do_compile and do_assemble_fitimage, this is
-#   not suitable in case of initramfs bundles.  do_kernel_generate_rsa_keys
-#   should be between do_bundle_initramfs and do_assemble_fitimage_initramfs.
-python () {
-    if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
-        bb.build.deltask('do_assemble_fitimage', d)
-        bb.build.deltask('kernel_generate_rsa_keys', d)
-        bb.build.addtask('kernel_generate_rsa_keys', 'do_assemble_fitimage_initramfs', 'do_bundle_initramfs', d)
-}
diff --git a/poky/meta/classes/kernel-grub.bbclass b/poky/meta/classes/kernel-grub.bbclass
deleted file mode 100644
index 44b2015..0000000
--- a/poky/meta/classes/kernel-grub.bbclass
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# While installing a rpm to update kernel on a deployed target, it will update
-# the boot area and the boot menu with the kernel as the priority but allow
-# you to fall back to the original kernel as well.
-#
-# - In kernel-image's preinstall scriptlet, it backs up original kernel to avoid
-#   probable confliction with the new one.
-#
-# - In kernel-image's postinstall scriptlet, it modifies grub's config file to
-#   updates the new kernel as the boot priority.
-#
-
-python __anonymous () {
-    import re
-
-    preinst = '''
-	# Parsing confliction
-	[ -f "$D/boot/grub/menu.list" ] && grubcfg="$D/boot/grub/menu.list"
-	[ -f "$D/boot/grub/grub.cfg" ] && grubcfg="$D/boot/grub/grub.cfg"
-	if [ -n "$grubcfg" ]; then
-		# Dereference symlink to avoid confliction with new kernel name.
-		if grep -q "/KERNEL_IMAGETYPE \+root=" $grubcfg; then
-			if [ -L "$D/boot/KERNEL_IMAGETYPE" ]; then
-				kimage=`realpath $D/boot/KERNEL_IMAGETYPE 2>/dev/null`
-				if [ -f "$D$kimage" ]; then
-					sed -i "s:KERNEL_IMAGETYPE \+root=:${kimage##*/} root=:" $grubcfg
-				fi
-			fi
-		fi
-
-		# Rename old kernel if it conflicts with new kernel name.
-		if grep -q "/KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=" $grubcfg; then
-			if [ -f "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" ]; then
-				timestamp=`date +%s`
-				kimage="$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}-$timestamp-back"
-				sed -i "s:KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
-				mv "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" "$kimage"
-			fi
-		fi
-	fi
-'''
-
-    postinst = '''
-	get_new_grub_cfg() {
-		grubcfg="$1"
-		old_image="$2"
-		title="Update KERNEL_IMAGETYPE-${KERNEL_VERSION}-${PV}"
-		if [ "${grubcfg##*/}" = "grub.cfg" ]; then
-			rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \
-				 sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
-
-			echo "menuentry \"$title\" {"
-			echo "    set root=(hd0,1)"
-			echo "$rootfs"
-			echo "}"
-		elif [ "${grubcfg##*/}" = "menu.list" ]; then
-			rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \
-				 sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
-
-			echo "default 0"
-			echo "timeout 30"
-			echo "title $title"
-			echo "root  (hd0,0)"
-			echo "$rootfs"
-		fi
-	}
-
-	get_old_grub_cfg() {
-		grubcfg="$1"
-		if [ "${grubcfg##*/}" = "grub.cfg" ]; then
-			cat "$grubcfg"
-		elif [ "${grubcfg##*/}" = "menu.list" ]; then
-			sed -e '/^default/d' -e '/^timeout/d' "$grubcfg"
-		fi
-	}
-
-	if [ -f "$D/boot/grub/grub.cfg" ]; then
-		grubcfg="$D/boot/grub/grub.cfg"
-		old_image=`grep ' *linux \+[^ ]\+ \+root=' -m 1 "$grubcfg" | awk '{print $2}'`
-	elif [ -f "$D/boot/grub/menu.list" ]; then
-		grubcfg="$D/boot/grub/menu.list"
-		old_image=`grep '^kernel \+[^ ]\+ \+root=' -m 1 "$grubcfg" | awk '{print $2}'`
-	fi
-
-	# Don't update grubcfg at first install while old bzImage doesn't exist.
-	if [ -f "$D/boot/${old_image##*/}" ]; then
-		grubcfgtmp="$grubcfg.tmp"
-		get_new_grub_cfg "$grubcfg" "$old_image"  > $grubcfgtmp
-		get_old_grub_cfg "$grubcfg" >> $grubcfgtmp
-		mv $grubcfgtmp $grubcfg
-		echo "Caution! Update kernel may affect kernel-module!"
-	fi
-'''
-
-    imagetypes = d.getVar('KERNEL_IMAGETYPES')
-    imagetypes = re.sub(r'\.gz$', '', imagetypes)
-
-    for type in imagetypes.split():
-        typelower = type.lower()
-        preinst_append = preinst.replace('KERNEL_IMAGETYPE', type)
-        postinst_prepend = postinst.replace('KERNEL_IMAGETYPE', type)
-        d.setVar('pkg_preinst:kernel-image-' + typelower + ':append', preinst_append)
-        d.setVar('pkg_postinst:kernel-image-' + typelower + ':prepend', postinst_prepend)
-}
-
diff --git a/poky/meta/classes/kernel-module-split.bbclass b/poky/meta/classes/kernel-module-split.bbclass
deleted file mode 100644
index a29c294..0000000
--- a/poky/meta/classes/kernel-module-split.bbclass
+++ /dev/null
@@ -1,191 +0,0 @@
-pkg_postinst:modules () {
-if [ -z "$D" ]; then
-	depmod -a ${KERNEL_VERSION}
-else
-	# image.bbclass will call depmodwrapper after everything is installed,
-	# no need to do it here as well
-	:
-fi
-}
-
-pkg_postrm:modules () {
-if [ -z "$D" ]; then
-	depmod -a ${KERNEL_VERSION}
-else
-	depmodwrapper -a -b $D ${KERNEL_VERSION}
-fi
-}
-
-autoload_postinst_fragment() {
-if [ x"$D" = "x" ]; then
-	modprobe %s || true
-fi
-}
-
-PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross"
-
-do_install:append() {
-	install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/
-}
-
-KERNEL_SPLIT_MODULES ?= "1"
-PACKAGESPLITFUNCS:prepend = "split_kernel_module_packages "
-
-KERNEL_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or "kernel" }-modules"
-
-KERNEL_MODULE_PACKAGE_PREFIX ?= ""
-KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}"
-KERNEL_MODULE_PROVIDE_VIRTUAL ?= "1"
-
-python split_kernel_module_packages () {
-    import re
-
-    modinfoexp = re.compile("([^=]+)=(.*)")
-
-    def extract_modinfo(file):
-        import tempfile, subprocess
-        tempfile.tempdir = d.getVar("WORKDIR")
-        compressed = re.match( r'.*\.(gz|xz|zst)$', file)
-        tf = tempfile.mkstemp()
-        tmpfile = tf[1]
-        if compressed:
-            tmpkofile = tmpfile + ".ko"
-            if compressed.group(1) == 'gz':
-                cmd = "gunzip -dc %s > %s" % (file, tmpkofile)
-                subprocess.check_call(cmd, shell=True)
-            elif compressed.group(1) == 'xz':
-                cmd = "xz -dc %s > %s" % (file, tmpkofile)
-                subprocess.check_call(cmd, shell=True)
-            elif compressed.group(1) == 'zst':
-                cmd = "zstd -dc %s > %s" % (file, tmpkofile)
-                subprocess.check_call(cmd, shell=True)
-            else:
-                msg = "Cannot decompress '%s'" % file
-                raise msg
-            cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", tmpkofile, tmpfile)
-        else:
-            cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile)
-        subprocess.check_call(cmd, shell=True)
-        # errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'ö')
-        f = open(tmpfile, errors='replace')
-        l = f.read().split("\000")
-        f.close()
-        os.close(tf[0])
-        os.unlink(tmpfile)
-        if compressed:
-            os.unlink(tmpkofile)
-        vals = {}
-        for i in l:
-            m = modinfoexp.match(i)
-            if not m:
-                continue
-            vals[m.group(1)] = m.group(2)
-        return vals
-
-    def frob_metadata(file, pkg, pattern, format, basename):
-        vals = extract_modinfo(file)
-
-        dvar = d.getVar('PKGD')
-
-        # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
-        # appropriate modprobe commands to the postinst
-        autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split()
-        autoload = d.getVar('module_autoload_%s' % basename)
-        if autoload and autoload == basename:
-            bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename)
-        if autoload and basename not in autoloadlist:
-            bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename))
-        if basename in autoloadlist:
-            name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
-            f = open(name, 'w')
-            if autoload:
-                for m in autoload.split():
-                    f.write('%s\n' % m)
-            else:
-                f.write('%s\n' % basename)
-            f.close()
-            postinst = d.getVar('pkg_postinst:%s' % pkg)
-            if not postinst:
-                bb.fatal("pkg_postinst:%s not defined" % pkg)
-            postinst += d.getVar('autoload_postinst_fragment') % (autoload or basename)
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        # Write out any modconf fragment
-        modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()
-        modconf = d.getVar('module_conf_%s' % basename)
-        if modconf and basename in modconflist:
-            name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
-            f = open(name, 'w')
-            f.write("%s\n" % modconf)
-            f.close()
-        elif modconf:
-            bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
-
-        files = d.getVar('FILES:%s' % pkg)
-        files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
-        d.setVar('FILES:%s' % pkg, files)
-
-        conffiles = d.getVar('CONFFILES:%s' % pkg)
-        conffiles = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (conffiles, basename, basename)
-        d.setVar('CONFFILES:%s' % pkg, conffiles)
-
-        if "description" in vals:
-            old_desc = d.getVar('DESCRIPTION:' + pkg) or ""
-            d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"])
-
-        rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "")
-        modinfo_deps = []
-        if "depends" in vals and vals["depends"] != "":
-            for dep in vals["depends"].split(","):
-                on = legitimize_package_name(dep)
-                dependency_pkg = format % on
-                modinfo_deps.append(dependency_pkg)
-        for dep in modinfo_deps:
-            if not dep in rdepends:
-                rdepends[dep] = []
-        d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False))
-
-        # Avoid automatic -dev recommendations for modules ending with -dev.
-        d.setVarFlag('RRECOMMENDS:' + pkg, 'nodeprrecs', 1)
-
-        # Provide virtual package without postfix
-        providevirt = d.getVar('KERNEL_MODULE_PROVIDE_VIRTUAL')
-        if providevirt == "1":
-           postfix = format.split('%s')[1]
-           d.setVar('RPROVIDES:' + pkg, pkg.replace(postfix, ''))
-
-    kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel"
-    kernel_version = d.getVar("KERNEL_VERSION")
-
-    metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE')
-    splitmods = d.getVar('KERNEL_SPLIT_MODULES')
-    postinst = d.getVar('pkg_postinst:modules')
-    postrm = d.getVar('pkg_postrm:modules')
-
-    if splitmods != '1':
-        etcdir = d.getVar('sysconfdir')
-        d.appendVar('FILES:' + metapkg, '%s/modules-load.d/ %s/modprobe.d/ %s/modules/' % (etcdir, etcdir, d.getVar("nonarch_base_libdir")))
-        d.appendVar('pkg_postinst:%s' % metapkg, postinst)
-        d.prependVar('pkg_postrm:%s' % metapkg, postrm);
-        return
-
-    module_regex = r'^(.*)\.k?o(?:\.(gz|xz|zst))?$'
-
-    module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
-    module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
-    module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix
-
-    modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
-    if modules:
-        d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
-
-    # If modules-load.d and modprobe.d are empty at this point, remove them to
-    # avoid warnings. removedirs only raises an OSError if an empty
-    # directory cannot be removed.
-    dvar = d.getVar('PKGD')
-    for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]:
-        if len(os.listdir(dir)) == 0:
-            os.rmdir(dir)
-}
-
-do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()))}'
diff --git a/poky/meta/classes/kernel-uboot.bbclass b/poky/meta/classes/kernel-uboot.bbclass
deleted file mode 100644
index 1bc98e0..0000000
--- a/poky/meta/classes/kernel-uboot.bbclass
+++ /dev/null
@@ -1,43 +0,0 @@
-# fitImage kernel compression algorithm
-FIT_KERNEL_COMP_ALG ?= "gzip"
-FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
-
-# Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
-UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
-
-uboot_prep_kimage() {
-	if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then
-		vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
-		linux_suffix=""
-		linux_comp="none"
-	elif [ -e arch/${ARCH}/boot/vmlinuz.bin ]; then
-		rm -f linux.bin
-		cp -l arch/${ARCH}/boot/vmlinuz.bin linux.bin
-		vmlinux_path=""
-		linux_suffix=""
-		linux_comp="none"
-	else
-		vmlinux_path="vmlinux"
-		# Use vmlinux.initramfs for linux.bin when INITRAMFS_IMAGE_BUNDLE set
-		# As per the implementation in kernel.bbclass.
-		# See do_bundle_initramfs function
-		if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] && [ -e vmlinux.initramfs ]; then
-			vmlinux_path="vmlinux.initramfs"
-		fi
-		linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}"
-		linux_comp="${FIT_KERNEL_COMP_ALG}"
-	fi
-
-	[ -n "${vmlinux_path}" ] && ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
-
-	if [ "${linux_comp}" != "none" ] ; then
-		if [ "${linux_comp}" = "gzip" ] ; then
-			gzip -9 linux.bin
-		elif [ "${linux_comp}" = "lzo" ] ; then
-			lzop -9 linux.bin
-		fi
-		mv -f "linux.bin${linux_suffix}" linux.bin
-	fi
-
-	echo "${linux_comp}"
-}
diff --git a/poky/meta/classes/kernel-uimage.bbclass b/poky/meta/classes/kernel-uimage.bbclass
deleted file mode 100644
index 2e661ea..0000000
--- a/poky/meta/classes/kernel-uimage.bbclass
+++ /dev/null
@@ -1,35 +0,0 @@
-inherit kernel-uboot
-
-python __anonymous () {
-    if "uImage" in d.getVar('KERNEL_IMAGETYPES'):
-        depends = d.getVar("DEPENDS")
-        depends = "%s u-boot-tools-native" % depends
-        d.setVar("DEPENDS", depends)
-
-        # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
-        # to kernel.bbclass . We override the variable here, since we need
-        # to build uImage using the kernel build system if and only if
-        # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
-        # the uImage .
-        if d.getVar("KEEPUIMAGE") != 'yes':
-            typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
-            if "uImage" in typeformake.split():
-                d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux'))
-
-            # Enable building of uImage with mkimage
-            bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d)
-}
-
-do_uboot_mkimage[dirs] += "${B}"
-do_uboot_mkimage() {
-	uboot_prep_kimage
-
-	ENTRYPOINT=${UBOOT_ENTRYPOINT}
-	if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
-		ENTRYPOINT=`${HOST_PREFIX}nm ${B}/vmlinux | \
-			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
-	fi
-
-	uboot-mkimage -A ${UBOOT_ARCH} -O linux -T ${UBOOT_MKIMAGE_KERNEL_TYPE} -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage
-	rm -f linux.bin
-}
diff --git a/poky/meta/classes/kernel-yocto.bbclass b/poky/meta/classes/kernel-yocto.bbclass
deleted file mode 100644
index ce1446f..0000000
--- a/poky/meta/classes/kernel-yocto.bbclass
+++ /dev/null
@@ -1,726 +0,0 @@
-# remove tasks that modify the source tree in case externalsrc is inherited
-SRCTREECOVEREDTASKS += "do_validate_branches do_kernel_configcheck do_kernel_checkout do_fetch do_unpack do_patch"
-PATCH_GIT_USER_EMAIL ?= "kernel-yocto@oe"
-PATCH_GIT_USER_NAME ?= "OpenEmbedded"
-
-# The distro or local.conf should set this, but if nobody cares...
-LINUX_KERNEL_TYPE ??= "standard"
-
-# KMETA ?= ""
-KBRANCH ?= "master"
-KMACHINE ?= "${MACHINE}"
-SRCREV_FORMAT ?= "meta_machine"
-
-# LEVELS:
-#   0: no reporting
-#   1: report options that are specified, but not in the final config
-#   2: report options that are not hardware related, but set by a BSP
-KCONF_AUDIT_LEVEL ?= "1"
-KCONF_BSP_AUDIT_LEVEL ?= "0"
-KMETA_AUDIT ?= "yes"
-KMETA_AUDIT_WERROR ?= ""
-
-# returns local (absolute) path names for all valid patches in the
-# src_uri
-def find_patches(d,subdir):
-    patches = src_patches(d)
-    patch_list=[]
-    for p in patches:
-        _, _, local, _, _, parm = bb.fetch.decodeurl(p)
-        # if patchdir has been passed, we won't be able to apply it so skip
-        # the patch for now, and special processing happens later
-        patchdir = ''
-        if "patchdir" in parm:
-            patchdir = parm["patchdir"]
-        if subdir:
-            if subdir == patchdir:
-                patch_list.append(local)
-        else:
-            # skip the patch if a patchdir was supplied, it won't be handled
-            # properly
-            if not patchdir:
-                patch_list.append(local)
-
-    return patch_list
-
-# returns all the elements from the src uri that are .scc files
-def find_sccs(d):
-    sources=src_patches(d, True)
-    sources_list=[]
-    for s in sources:
-        base, ext = os.path.splitext(os.path.basename(s))
-        if ext and ext in [".scc", ".cfg"]:
-            sources_list.append(s)
-        elif base and 'defconfig' in base:
-            sources_list.append(s)
-
-    return sources_list
-
-# check the SRC_URI for "kmeta" type'd git repositories. Return the name of
-# the repository as it will be found in WORKDIR
-def find_kernel_feature_dirs(d):
-    feature_dirs=[]
-    fetch = bb.fetch2.Fetch([], d)
-    for url in fetch.urls:
-        urldata = fetch.ud[url]
-        parm = urldata.parm
-        type=""
-        if "type" in parm:
-            type = parm["type"]
-        if "destsuffix" in parm:
-            destdir = parm["destsuffix"]
-            if type == "kmeta":
-                feature_dirs.append(destdir)
-	    
-    return feature_dirs
-
-# find the master/machine source branch. In the same way that the fetcher proceses
-# git repositories in the SRC_URI we take the first repo found, first branch.
-def get_machine_branch(d, default):
-    fetch = bb.fetch2.Fetch([], d)
-    for url in fetch.urls:
-        urldata = fetch.ud[url]
-        parm = urldata.parm
-        if "branch" in parm:
-            branches = urldata.parm.get("branch").split(',')
-            btype = urldata.parm.get("type")
-            if btype != "kmeta":
-                return branches[0]
-	    
-    return default
-
-# returns a list of all directories that are on FILESEXTRAPATHS (and
-# hence available to the build) that contain .scc or .cfg files
-def get_dirs_with_fragments(d):
-    extrapaths = []
-    extrafiles = []
-    extrapathsvalue = (d.getVar("FILESEXTRAPATHS") or "")
-    # Remove default flag which was used for checking
-    extrapathsvalue = extrapathsvalue.replace("__default:", "")
-    extrapaths = extrapathsvalue.split(":")
-    for path in extrapaths:
-        if path + ":True" not in extrafiles:
-            extrafiles.append(path + ":" + str(os.path.exists(path)))
-
-    return " ".join(extrafiles)
-
-do_kernel_metadata() {
-	set +e
-
-	if [ -n "$1" ]; then
-		mode="$1"
-	else
-		mode="patch"
-	fi
-
-	cd ${S}
-	export KMETA=${KMETA}
-
-	bbnote "do_kernel_metadata: for summary/debug, set KCONF_AUDIT_LEVEL > 0"
-
-	# if kernel tools are available in-tree, they are preferred
-	# and are placed on the path before any external tools. Unless
-	# the external tools flag is set, in that case we do nothing.
-	if [ -f "${S}/scripts/util/configme" ]; then
-		if [ -z "${EXTERNAL_KERNEL_TOOLS}" ]; then
-			PATH=${S}/scripts/util:${PATH}
-		fi
-	fi
-
-	# In a similar manner to the kernel itself:
-	#
-	#   defconfig: $(obj)/conf
-	#   ifeq ($(KBUILD_DEFCONFIG),)
-	#	$< --defconfig $(Kconfig)
-	#   else
-	#	@echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
-	#	$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
-	#   endif
-	#
-	# If a defconfig is specified via the KBUILD_DEFCONFIG variable, we copy it
-	# from the source tree, into a common location and normalized "defconfig" name,
-	# where the rest of the process will include and incoroporate it into the build
-	#
-	# If the fetcher has already placed a defconfig in WORKDIR (from the SRC_URI),
-	# we don't overwrite it, but instead warn the user that SRC_URI defconfigs take
-	# precendence.
-	#
-	if [ -n "${KBUILD_DEFCONFIG}" ]; then
-		if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
-			if [ -f "${WORKDIR}/defconfig" ]; then
-				# If the two defconfig's are different, warn that we overwrote the
-				# one already placed in WORKDIR
-				cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}"
-				if [ $? -ne 0 ]; then
-					bbdebug 1 "detected SRC_URI or unpatched defconfig in WORKDIR. ${KBUILD_DEFCONFIG} copied over it"
-				fi
-				cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
-			else
-				cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
-			fi
-			in_tree_defconfig="${WORKDIR}/defconfig"
-		else
-			bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree (${S}/arch/${ARCH}/configs/)"
-		fi
-	fi
-
-	if [ "$mode" = "patch" ]; then
-		# was anyone trying to patch the kernel meta data ?, we need to do
-		# this here, since the scc commands migrate the .cfg fragments to the
-		# kernel source tree, where they'll be used later.
-		check_git_config
-		patches="${@" ".join(find_patches(d,'kernel-meta'))}"
-		for p in $patches; do
-		    (
-			cd ${WORKDIR}/kernel-meta
-			git am -s $p
-		    )
-		done
-	fi
-
-	sccs_from_src_uri="${@" ".join(find_sccs(d))}"
-	patches="${@" ".join(find_patches(d,''))}"
-	feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}"
-
-	# a quick check to make sure we don't have duplicate defconfigs If
-	# there's a defconfig in the SRC_URI, did we also have one from the
-	# KBUILD_DEFCONFIG processing above ?
-	src_uri_defconfig=$(echo $sccs_from_src_uri | awk '(match($0, "defconfig") != 0) { print $0 }' RS=' ')
-	# drop and defconfig's from the src_uri variable, we captured it just above here if it existed
-	sccs_from_src_uri=$(echo $sccs_from_src_uri | awk '(match($0, "defconfig") == 0) { print $0 }' RS=' ')
-
-	if [ -n "$in_tree_defconfig" ]; then
-		sccs_defconfig=$in_tree_defconfig
-		if [ -n "$src_uri_defconfig" ]; then
-			bbwarn "[NOTE]: defconfig was supplied both via KBUILD_DEFCONFIG and SRC_URI. Dropping SRC_URI entry $src_uri_defconfig"
-		fi
-	else
-		# if we didn't have an in-tree one, make our defconfig the one
-		# from the src_uri. Note: there may not have been one from the
-		# src_uri, so this can be an empty variable.
-		sccs_defconfig=$src_uri_defconfig
-	fi
-	sccs="$sccs_from_src_uri"
-
-	# check for feature directories/repos/branches that were part of the
-	# SRC_URI. If they were supplied, we convert them into include directives
-	# for the update part of the process
-	for f in ${feat_dirs}; do
-		if [ -d "${WORKDIR}/$f/meta" ]; then
-			includes="$includes -I${WORKDIR}/$f/kernel-meta"
-		elif [ -d "${WORKDIR}/../oe-local-files/$f" ]; then
-			includes="$includes -I${WORKDIR}/../oe-local-files/$f"
-	        elif [ -d "${WORKDIR}/$f" ]; then
-			includes="$includes -I${WORKDIR}/$f"
-		fi
-	done
-	for s in ${sccs} ${patches}; do
-		sdir=$(dirname $s)
-		includes="$includes -I${sdir}"
-                # if a SRC_URI passed patch or .scc has a subdir of "kernel-meta",
-                # then we add it to the search path
-                if [ -d "${sdir}/kernel-meta" ]; then
-			includes="$includes -I${sdir}/kernel-meta"
-                fi
-	done
-
-	# expand kernel features into their full path equivalents
-	bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE})
-	if [ -z "$bsp_definition" ]; then
-		if [ -z "$sccs_defconfig" ]; then
-			bbfatal_log "Could not locate BSP definition for ${KMACHINE}/${LINUX_KERNEL_TYPE} and no defconfig was provided"
-		fi
-	else
-		# if the bsp definition has "define KMETA_EXTERNAL_BSP t",
-		# then we need to set a flag that will instruct the next
-		# steps to use the BSP as both configuration and patches.
-		grep -q KMETA_EXTERNAL_BSP $bsp_definition
-		if [ $? -eq 0 ]; then
-		    KMETA_EXTERNAL_BSPS="t"
-		fi
-	fi
-	meta_dir=$(kgit --meta)
-
-	KERNEL_FEATURES_FINAL=""
-	if [ -n "${KERNEL_FEATURES}" ]; then
-		for feature in ${KERNEL_FEATURES}; do
-			feature_found=f
-			for d in $includes; do
-				path_to_check=$(echo $d | sed 's/^-I//')
-				if [ "$feature_found" = "f" ] && [ -e "$path_to_check/$feature" ]; then
-				    feature_found=t
-				fi
-			done
-			if [ "$feature_found" = "f" ]; then
-				if [ -n "${KERNEL_DANGLING_FEATURES_WARN_ONLY}" ]; then
-				    bbwarn "Feature '$feature' not found, but KERNEL_DANGLING_FEATURES_WARN_ONLY is set"
-				    bbwarn "This may cause runtime issues, dropping feature and allowing configuration to continue"
-				else
-				    bberror "Feature '$feature' not found, this will cause configuration failures."
-				    bberror "Check the SRC_URI for meta-data repositories or directories that may be missing"
-				    bbfatal_log "Set KERNEL_DANGLING_FEATURES_WARN_ONLY to ignore this issue"
-				fi
-			else
-				KERNEL_FEATURES_FINAL="$KERNEL_FEATURES_FINAL $feature"
-			fi
-		done
-        fi
-
-	if [ "$mode" = "config" ]; then
-		# run1: pull all the configuration fragments, no matter where they come from
-		elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
-		if [ -n "${elements}" ]; then
-			echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
-			scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL
-			if [ $? -ne 0 ]; then
-				bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
-			fi
-		fi
-	fi
-
-	# if KMETA_EXTERNAL_BSPS has been set, or it has been detected from
-	# the bsp definition, then we inject the bsp_definition into the
-	# patch phase below.  we'll piggy back on the sccs variable.
-	if [ -n "${KMETA_EXTERNAL_BSPS}" ]; then
-		sccs="${bsp_definition} ${sccs}"
-	fi
-
-	if [ "$mode" = "patch" ]; then
-		# run2: only generate patches for elements that have been passed on the SRC_URI
-		elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
-		if [ -n "${elements}" ]; then
-			scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL
-			if [ $? -ne 0 ]; then
-				bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
-			fi
-		fi
-	fi
-
-	if [ ${KCONF_AUDIT_LEVEL} -gt 0 ]; then
-		bbnote "kernel meta data summary for ${KMACHINE} (${LINUX_KERNEL_TYPE}):"
-		bbnote "======================================================================"
-		if [ -n "${KMETA_EXTERNAL_BSPS}" ]; then
-			bbnote "Non kernel-cache (external) bsp"
-		fi
-		bbnote "BSP entry point / definition: $bsp_definition"
-		if [ -n "$in_tree_defconfig" ]; then
-			bbnote "KBUILD_DEFCONFIG: ${KBUILD_DEFCONFIG}"
-		fi
-		bbnote "Fragments from SRC_URI: $sccs_from_src_uri"
-		bbnote "KERNEL_FEATURES: $KERNEL_FEATURES_FINAL"
-		bbnote "Final scc/cfg list: $sccs_defconfig $bsp_definition $sccs $KERNEL_FEATURES_FINAL"
-	fi
-
-	set -e
-}
-
-do_patch() {
-	set +e
-	cd ${S}
-
-	check_git_config
-	meta_dir=$(kgit --meta)
-	(cd ${meta_dir}; ln -sf patch.queue series)
-	if [ -f "${meta_dir}/series" ]; then
-		kgit_extra_args=""
-		if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
-		    kgit_extra_args="--commit-sha author"
-		fi
-		kgit-s2q --gen -v $kgit_extra_args --patches .kernel-meta/
-		if [ $? -ne 0 ]; then
-			bberror "Could not apply patches for ${KMACHINE}."
-			bbfatal_log "Patch failures can be resolved in the linux source directory ${S})"
-		fi
-	fi
-
-	if [ -f "${meta_dir}/merge.queue" ]; then
-		# we need to merge all these branches
-		for b in $(cat ${meta_dir}/merge.queue); do
-			git show-ref --verify --quiet refs/heads/${b}
-			if [ $? -eq 0 ]; then
-				bbnote "Merging branch ${b}"
-				git merge -q --no-ff -m "Merge branch ${b}" ${b}
-			else
-				bbfatal "branch ${b} does not exist, cannot merge"
-			fi
-		done
-	fi
-
-	set -e
-}
-
-do_kernel_checkout() {
-	set +e
-
-	source_dir=`echo ${S} | sed 's%/$%%'`
-	source_workdir="${WORKDIR}/git"
-	if [ -d "${WORKDIR}/git/" ]; then
-		# case: git repository
-		# if S is WORKDIR/git, then we shouldn't be moving or deleting the tree.
-		if [ "${source_dir}" != "${source_workdir}" ]; then
-			if [ -d "${source_workdir}/.git" ]; then
-				# regular git repository with .git
-				rm -rf ${S}
-				mv ${WORKDIR}/git ${S}
-			else
-				# create source for bare cloned git repository
-				git clone ${WORKDIR}/git ${S}
-				rm -rf ${WORKDIR}/git
-			fi
-		fi
-		cd ${S}
-
-		# convert any remote branches to local tracking ones
-		for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do
-			b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
-			git show-ref --quiet --verify -- "refs/heads/$b"
-			if [ $? -ne 0 ]; then
-				git branch $b $i > /dev/null
-			fi
-		done
-
-		# Create a working tree copy of the kernel by checking out a branch
-		machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
-
-		# checkout and clobber any unimportant files
-		git checkout -f ${machine_branch}
-	else
-		# case: we have no git repository at all. 
-		# To support low bandwidth options for building the kernel, we'll just 
-		# convert the tree to a git repo and let the rest of the process work unchanged
-		
-		# if ${S} hasn't been set to the proper subdirectory a default of "linux" is 
-		# used, but we can't initialize that empty directory. So check it and throw a
-		# clear error
-
-	        cd ${S}
-		if [ ! -f "Makefile" ]; then
-			bberror "S is not set to the linux source directory. Check "
-			bbfatal "the recipe and set S to the proper extracted subdirectory"
-		fi
-		rm -f .gitignore
-		git init
-		check_git_config
-		git add .
-		git commit -q -m "baseline commit: creating repo for ${PN}-${PV}"
-		git clean -d -f
-	fi
-
-	set -e
-}
-do_kernel_checkout[dirs] = "${S} ${WORKDIR}"
-
-addtask kernel_checkout before do_kernel_metadata after do_symlink_kernsrc
-addtask kernel_metadata after do_validate_branches do_unpack before do_patch
-do_kernel_metadata[depends] = "kern-tools-native:do_populate_sysroot"
-do_kernel_metadata[file-checksums] = " ${@get_dirs_with_fragments(d)}"
-do_validate_branches[depends] = "kern-tools-native:do_populate_sysroot"
-
-do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}binutils:do_populate_sysroot"
-do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}gcc:do_populate_sysroot"
-do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
-do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
-do_kernel_configme[dirs] += "${S} ${B}"
-do_kernel_configme() {
-	do_kernel_metadata config
-
-	# translate the kconfig_mode into something that merge_config.sh
-	# understands
-	case ${KCONFIG_MODE} in
-		*allnoconfig)
-			config_flags="-n"
-			;;
-		*alldefconfig)
-			config_flags=""
-			;;
-		*)
-			if [ -f ${WORKDIR}/defconfig ]; then
-				config_flags="-n"
-			fi
-			;;
-	esac
-
-	cd ${S}
-
-	meta_dir=$(kgit --meta)
-	configs="$(scc --configs -o ${meta_dir})"
-	if [ $? -ne 0 ]; then
-		bberror "${configs}"
-		bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)"
-	fi
-
-	CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1
-	if [ $? -ne 0 -o ! -f ${B}/.config ]; then
-		bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}"
-		if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then
-			bbfatal_log "`cat ${meta_dir}/cfg/merge_config_build.log`"
-		else
-			bbfatal_log "Details can be found at: ${S}/${meta_dir}/cfg/merge_config_build.log"
-		fi
-	fi
-
-	if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then
-		echo "# Global settings from linux recipe" >> ${B}/.config
-		echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
-	fi
-}
-
-addtask kernel_configme before do_configure after do_patch
-addtask config_analysis
-
-do_config_analysis[depends] = "virtual/kernel:do_configure"
-do_config_analysis[depends] += "kern-tools-native:do_populate_sysroot"
-
-CONFIG_AUDIT_FILE ?= "${WORKDIR}/config-audit.txt"
-CONFIG_ANALYSIS_FILE ?= "${WORKDIR}/config-analysis.txt"
-
-python do_config_analysis() {
-    import re, string, sys, subprocess
-
-    s = d.getVar('S')
-
-    env = os.environ.copy()
-    env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/")
-    env['LD'] = d.getVar('KERNEL_LD')
-    env['CC'] = d.getVar('KERNEL_CC')
-    env['ARCH'] = d.getVar('ARCH')
-    env['srctree'] = s
-
-    # read specific symbols from the kernel recipe or from local.conf
-    # i.e.: CONFIG_ANALYSIS:pn-linux-yocto-dev = 'NF_CONNTRACK LOCALVERSION'
-    config = d.getVar( 'CONFIG_ANALYSIS' )
-    if not config:
-       config = [ "" ]
-    else:
-       config = config.split()
-
-    for c in config:
-        for action in ["analysis","audit"]:
-            if action == "analysis":
-                try:
-                    analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--blame', c], cwd=s, env=env ).decode('utf-8')
-                except subprocess.CalledProcessError as e:
-                    bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
-                outfile = d.getVar( 'CONFIG_ANALYSIS_FILE' )
-
-            if action == "audit":
-                try:
-                    analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--summary', '--extended', '--sanity', c], cwd=s, env=env ).decode('utf-8')
-                except subprocess.CalledProcessError as e:
-                    bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
-                outfile = d.getVar( 'CONFIG_AUDIT_FILE' )
-
-            if c:
-                outdir = os.path.dirname( outfile )
-                outname = os.path.basename( outfile )
-                outfile = outdir + '/'+ c + '-' + outname
-
-            if config and os.path.isfile(outfile):
-                os.remove(outfile)
-
-            with open(outfile, 'w+') as f:
-                f.write( analysis )
-
-            bb.warn( "Configuration {} executed, see: {} for details".format(action,outfile ))
-            if c:
-                bb.warn( analysis )
-}
-
-python do_kernel_configcheck() {
-    import re, string, sys, subprocess
-
-    s = d.getVar('S')
-
-    # if KMETA isn't set globally by a recipe using this routine, use kgit to
-    # locate or create the meta directory. Otherwise, kconf_check is not
-    # passed a valid meta-series for processing
-    kmeta = d.getVar("KMETA")
-    if not kmeta or not os.path.exists('{}/{}'.format(s,kmeta)):
-        kmeta = subprocess.check_output(['kgit', '--meta'], cwd=d.getVar('S')).decode('utf-8').rstrip()
-
-    env = os.environ.copy()
-    env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/")
-    env['LD'] = d.getVar('KERNEL_LD')
-    env['CC'] = d.getVar('KERNEL_CC')
-    env['ARCH'] = d.getVar('ARCH')
-    env['srctree'] = s
-
-    try:
-        configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        bb.fatal( "Cannot gather config fragments for audit: %s" % e.output.decode("utf-8") )
-
-    config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0)
-    bsp_check_visibility = int(d.getVar("KCONF_BSP_AUDIT_LEVEL") or 0)
-    kmeta_audit_werror = d.getVar("KMETA_AUDIT_WERROR") or ""
-    warnings_detected = False
-
-    # if config check visibility is "1", that's the lowest level of audit. So
-    # we add the --classify option to the run, since classification will
-    # streamline the output to only report options that could be boot issues,
-    # or are otherwise required for proper operation.
-    extra_params = ""
-    if config_check_visibility == 1:
-       extra_params = "--classify"
-
-    # category #1: mismatches
-    try:
-        analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--mismatches', extra_params], cwd=s, env=env ).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
-    if analysis:
-        outfile = "{}/{}/cfg/mismatch.txt".format( s, kmeta )
-        if os.path.isfile(outfile):
-           os.remove(outfile)
-        with open(outfile, 'w+') as f:
-            f.write( analysis )
-
-        if config_check_visibility and os.stat(outfile).st_size > 0:
-            with open (outfile, "r") as myfile:
-                results = myfile.read()
-                bb.warn( "[kernel config]: specified values did not make it into the kernel's final configuration:\n\n%s" % results)
-                warnings_detected = True
-
-    # category #2: invalid fragment elements
-    extra_params = ""
-    if bsp_check_visibility > 1:
-        extra_params = "--strict"
-    try:
-        analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--invalid', extra_params], cwd=s, env=env ).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
-    if analysis:
-        outfile = "{}/{}/cfg/invalid.txt".format(s,kmeta)
-        if os.path.isfile(outfile):
-           os.remove(outfile)
-        with open(outfile, 'w+') as f:
-            f.write( analysis )
-
-        if bsp_check_visibility and os.stat(outfile).st_size > 0:
-            with open (outfile, "r") as myfile:
-                results = myfile.read()
-                bb.warn( "[kernel config]: This BSP contains fragments with warnings:\n\n%s" % results)
-                warnings_detected = True
-
-    # category #3: redefined options (this is pretty verbose and is debug only)
-    try:
-        analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--sanity'], cwd=s, env=env ).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
-    if analysis:
-        outfile = "{}/{}/cfg/redefinition.txt".format(s,kmeta)
-        if os.path.isfile(outfile):
-           os.remove(outfile)
-        with open(outfile, 'w+') as f:
-            f.write( analysis )
-
-        # if the audit level is greater than two, we report if a fragment has overriden
-        # a value from a base fragment. This is really only used for new kernel introduction
-        if bsp_check_visibility > 2 and os.stat(outfile).st_size > 0:
-            with open (outfile, "r") as myfile:
-                results = myfile.read()
-                bb.warn( "[kernel config]: This BSP has configuration options defined in more than one config, with differing values:\n\n%s" % results)
-                warnings_detected = True
-
-    if warnings_detected and kmeta_audit_werror:
-        bb.fatal( "configuration warnings detected, werror is set, promoting to fatal" )
-}
-
-# Ensure that the branches (BSP and meta) are on the locations specified by
-# their SRCREV values. If they are NOT on the right commits, the branches
-# are corrected to the proper commit.
-do_validate_branches() {
-	set +e
-	cd ${S}
-
-	machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
-	machine_srcrev="${SRCREV_machine}"
-
-	# if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to
-	# check and we can exit early
-	if [ "${machine_srcrev}" = "AUTOINC" ]; then
-	    linux_yocto_dev='${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-yocto-dev", "1", "", d)}'
-	    if [ -n "$linux_yocto_dev" ]; then
-		git checkout -q -f ${machine_branch}
-		ver=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//)
-		patchlevel=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
-		sublevel=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
-		kver="$ver.$patchlevel"
-		bbnote "dev kernel: performing version -> branch -> SRCREV validation"
-		bbnote "dev kernel: recipe version ${LINUX_VERSION}, src version: $kver"
-		echo "${LINUX_VERSION}" | grep -q $kver
-		if [ $? -ne 0 ]; then
-		    version="$(echo ${LINUX_VERSION} | sed 's/\+.*$//g')"
-		    versioned_branch="v$version/$machine_branch"
-
-		    machine_branch=$versioned_branch
-		    force_srcrev="$(git rev-parse $machine_branch 2> /dev/null)"
-		    if [ $? -ne 0 ]; then
-			bbfatal "kernel version mismatch detected, and no valid branch $machine_branch detected"
-		    fi
-
-		    bbnote "dev kernel: adjusting branch to $machine_branch, srcrev to: $force_srcrev"
-		fi
-	    else
-		bbnote "SRCREV validation is not required for AUTOREV"
-	    fi
-	elif [ "${machine_srcrev}" = "" ]; then
-		if [ "${SRCREV}" != "AUTOINC" ] && [ "${SRCREV}" != "INVALID" ]; then
-		       # SRCREV_machine_<MACHINE> was not set. This means that a custom recipe
-		       # that doesn't use the SRCREV_FORMAT "machine_meta" is being built. In
-		       # this case, we need to reset to the give SRCREV before heading to patching
-		       bbnote "custom recipe is being built, forcing SRCREV to ${SRCREV}"
-		       force_srcrev="${SRCREV}"
-		fi
-	else
-		git cat-file -t ${machine_srcrev} > /dev/null
-		if [ $? -ne 0 ]; then
-			bberror "${machine_srcrev} is not a valid commit ID."
-			bbfatal_log "The kernel source tree may be out of sync"
-		fi
-		force_srcrev=${machine_srcrev}
-	fi
-
-	git checkout -q -f ${machine_branch}
-	if [ -n "${force_srcrev}" ]; then
-		# see if the branch we are about to patch has been properly reset to the defined
-		# SRCREV .. if not, we reset it.
-		branch_head=`git rev-parse HEAD`
-		if [ "${force_srcrev}" != "${branch_head}" ]; then
-			current_branch=`git rev-parse --abbrev-ref HEAD`
-			git branch "$current_branch-orig"
-			git reset --hard ${force_srcrev}
-			# We've checked out HEAD, make sure we cleanup kgit-s2q fence post check
-			# so the patches are applied as expected otherwise no patching
-			# would be done in some corner cases.
-			kgit-s2q --clean
-		fi
-	fi
-
-	set -e
-}
-
-OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
-KBUILD_OUTPUT = "${B}"
-
-python () {
-    # If diffconfig is available, ensure it runs after kernel_configme
-    if 'do_diffconfig' in d:
-        bb.build.addtask('do_diffconfig', None, 'do_kernel_configme', d)
-
-    externalsrc = d.getVar('EXTERNALSRC')
-    if externalsrc:
-        # If we deltask do_patch, do_kernel_configme is left without
-        # dependencies and runs too early
-        d.setVarFlag('do_kernel_configme', 'deps', (d.getVarFlag('do_kernel_configme', 'deps', False) or []) + ['do_unpack'])
-}
-
-# extra tasks
-addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
-addtask validate_branches before do_patch after do_kernel_checkout
-addtask kernel_configcheck after do_configure before do_compile
diff --git a/poky/meta/classes/kernel.bbclass b/poky/meta/classes/kernel.bbclass
deleted file mode 100644
index 61b3e8c..0000000
--- a/poky/meta/classes/kernel.bbclass
+++ /dev/null
@@ -1,815 +0,0 @@
-inherit linux-kernel-base kernel-module-split
-
-COMPATIBLE_HOST = ".*-linux"
-
-KERNEL_PACKAGE_NAME ??= "kernel"
-KERNEL_DEPLOYSUBDIR ??= "${@ "" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel") else d.getVar("KERNEL_PACKAGE_NAME") }"
-
-PROVIDES += "virtual/kernel"
-DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native bison-native"
-DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lzo", "lzop-native", "", d)}"
-DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lz4", "lz4-native", "", d)}"
-DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.zst", "zstd-native", "", d)}"
-PACKAGE_WRITE_DEPS += "depmodwrapper-cross"
-
-do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot gzip-native:do_populate_sysroot"
-do_clean[depends] += "make-mod-scripts:do_clean"
-
-CVE_PRODUCT ?= "linux_kernel"
-
-S = "${STAGING_KERNEL_DIR}"
-B = "${WORKDIR}/build"
-KBUILD_OUTPUT = "${B}"
-OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
-
-# we include gcc above, we dont need virtual/libc
-INHIBIT_DEFAULT_DEPS = "1"
-
-KERNEL_IMAGETYPE ?= "zImage"
-INITRAMFS_IMAGE ?= ""
-INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}"
-INITRAMFS_TASK ?= ""
-INITRAMFS_IMAGE_BUNDLE ?= ""
-INITRAMFS_DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR_IMAGE}"
-INITRAMFS_MULTICONFIG ?= ""
-
-# KERNEL_VERSION is extracted from source code. It is evaluated as
-# None for the first parsing, since the code has not been fetched.
-# After the code is fetched, it will be evaluated as real version
-# number and cause kernel to be rebuilt. To avoid this, make
-# KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on
-# LINUX_VERSION which is a constant.
-KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION') or ""}"
-KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
-KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
-KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
-
-python __anonymous () {
-    pn = d.getVar("PN")
-    kpn = d.getVar("KERNEL_PACKAGE_NAME")
-
-    # XXX Remove this after bug 11905 is resolved
-    #  FILES:${KERNEL_PACKAGE_NAME}-dev doesn't expand correctly
-    if kpn == pn:
-        bb.warn("Some packages (E.g. *-dev) might be missing due to "
-                "bug 11905 (variable KERNEL_PACKAGE_NAME == PN)")
-
-    # The default kernel recipe builds in a shared location defined by
-    # bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
-    # Set these variables to directories under ${WORKDIR} in alternate
-    # kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
-    # may build in parallel with the default kernel without clobbering.
-    if kpn != "kernel":
-        workdir = d.getVar("WORKDIR")
-        sourceDir = os.path.join(workdir, 'kernel-source')
-        artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
-        d.setVar("STAGING_KERNEL_DIR", sourceDir)
-        d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
-
-    # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
-    type = d.getVar('KERNEL_IMAGETYPE') or ""
-    alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
-    types = d.getVar('KERNEL_IMAGETYPES') or ""
-    if type not in types.split():
-        types = (type + ' ' + types).strip()
-    if alttype not in types.split():
-        types = (alttype + ' ' + types).strip()
-    d.setVar('KERNEL_IMAGETYPES', types)
-
-    # KERNEL_IMAGETYPES may contain a mixture of image types supported directly
-    # by the kernel build system and types which are created by post-processing
-    # the output of the kernel build system (e.g. compressing vmlinux ->
-    # vmlinux.gz in kernel_do_transform_kernel()).
-    # KERNEL_IMAGETYPE_FOR_MAKE should contain only image types supported
-    # directly by the kernel build system.
-    if not d.getVar('KERNEL_IMAGETYPE_FOR_MAKE'):
-        typeformake = set()
-        for type in types.split():
-            if type == 'vmlinux.gz':
-                type = 'vmlinux'
-            typeformake.add(type)
-
-        d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', ' '.join(sorted(typeformake)))
-
-    kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
-    imagedest = d.getVar('KERNEL_IMAGEDEST')
-
-    for type in types.split():
-        if bb.data.inherits_class('nopackages', d):
-            continue
-        typelower = type.lower()
-        d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
-        d.setVar('FILES:' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
-        d.appendVar('RDEPENDS:%s-image' % kname, ' %s-image-%s (= ${EXTENDPKGV})' % (kname, typelower))
-        splitmods = d.getVar("KERNEL_SPLIT_MODULES")
-        if splitmods != '1':
-            d.appendVar('RDEPENDS:%s-image' % kname, ' %s-modules (= ${EXTENDPKGV})' % kname)
-            d.appendVar('RDEPENDS:%s-image-%s' % (kname, typelower), ' %s-modules-${KERNEL_VERSION_PKG_NAME} (= ${EXTENDPKGV})' % kname)
-            d.setVar('PKG:%s-modules' % kname, '%s-modules-${KERNEL_VERSION_PKG_NAME}' % kname)
-            d.appendVar('RPROVIDES:%s-modules' % kname, '%s-modules-${KERNEL_VERSION_PKG_NAME}' % kname)
-
-        d.setVar('PKG:%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
-        d.setVar('ALLOW_EMPTY:%s-image-%s' % (kname, typelower), '1')
-        d.prependVar('pkg_postinst:%s-image-%s' % (kname,typelower), """set +e
-if [ -n "$D" ]; then
-    ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
-else
-    ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
-        install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s
-    fi
-fi
-set -e
-""" % (type, type, type, type, type, type, type))
-        d.setVar('pkg_postrm:%s-image-%s' % (kname,typelower), """set +e
-if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then
-    rm -f ${KERNEL_IMAGEDEST}/%s  > /dev/null 2>&1
-fi
-set -e
-""" % (type, type, type))
-
-
-    image = d.getVar('INITRAMFS_IMAGE')
-    # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,
-    # the do_bundle_initramfs does nothing, but the INITRAMFS_IMAGE is built
-    # standalone for use by wic and other tools.
-    if image:
-        if d.getVar('INITRAMFS_MULTICONFIG'):
-            d.appendVarFlag('do_bundle_initramfs', 'mcdepends', ' mc::${INITRAMFS_MULTICONFIG}:${INITRAMFS_IMAGE}:do_image_complete')
-        else:
-            d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
-    if image and bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')):
-        bb.build.addtask('do_transform_bundled_initramfs', 'do_deploy', 'do_bundle_initramfs', d)
-
-    # NOTE: setting INITRAMFS_TASK is for backward compatibility
-    #       The preferred method is to set INITRAMFS_IMAGE, because
-    #       this INITRAMFS_TASK has circular dependency problems
-    #       if the initramfs requires kernel modules
-    image_task = d.getVar('INITRAMFS_TASK')
-    if image_task:
-        d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
-}
-
-# Here we pull in all various kernel image types which we support.
-#
-# In case you're wondering why kernel.bbclass inherits the other image
-# types instead of the other way around, the reason for that is to
-# maintain compatibility with various currently existing meta-layers.
-# By pulling in the various kernel image types here, we retain the
-# original behavior of kernel.bbclass, so no meta-layers should get
-# broken.
-#
-# KERNEL_CLASSES by default pulls in kernel-uimage.bbclass, since this
-# used to be the default behavior when only uImage was supported. This
-# variable can be appended by users who implement support for new kernel
-# image types.
-
-KERNEL_CLASSES ?= " kernel-uimage "
-inherit ${KERNEL_CLASSES}
-
-# Old style kernels may set ${S} = ${WORKDIR}/git for example
-# We need to move these over to STAGING_KERNEL_DIR. We can't just
-# create the symlink in advance as the git fetcher can't cope with
-# the symlink.
-do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
-do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
-python do_symlink_kernsrc () {
-    s = d.getVar("S")
-    if s[-1] == '/':
-        # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail
-        s=s[:-1]
-    kernsrc = d.getVar("STAGING_KERNEL_DIR")
-    if s != kernsrc:
-        bb.utils.mkdirhier(kernsrc)
-        bb.utils.remove(kernsrc, recurse=True)
-        if d.getVar("EXTERNALSRC"):
-            # With EXTERNALSRC S will not be wiped so we can symlink to it
-            os.symlink(s, kernsrc)
-        else:
-            import shutil
-            shutil.move(s, kernsrc)
-            os.symlink(kernsrc, s)
-}
-# do_patch is normally ordered before do_configure, but
-# externalsrc.bbclass deletes do_patch, breaking the dependency of
-# do_configure on do_symlink_kernsrc.
-addtask symlink_kernsrc before do_patch do_configure after do_unpack
-
-inherit kernel-arch deploy
-
-PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
-PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
-PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
-
-export OS = "${TARGET_OS}"
-export CROSS_COMPILE = "${TARGET_PREFIX}"
-export KBUILD_BUILD_VERSION = "1"
-export KBUILD_BUILD_USER ?= "oe-user"
-export KBUILD_BUILD_HOST ?= "oe-host"
-
-KERNEL_RELEASE ?= "${KERNEL_VERSION}"
-
-# The directory where built kernel lies in the kernel tree
-KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
-KERNEL_IMAGEDEST ?= "boot"
-
-#
-# configuration
-#
-export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE") or "ttyS0"}"
-
-KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}"
-
-# kernels are generally machine specific
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-# U-Boot support
-UBOOT_ENTRYPOINT ?= "20008000"
-UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
-
-# Some Linux kernel configurations need additional parameters on the command line
-KERNEL_EXTRA_ARGS ?= ""
-
-EXTRA_OEMAKE = " HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
-EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}" PAHOLE=false"
-
-KERNEL_ALT_IMAGETYPE ??= ""
-
-copy_initramfs() {
-	echo "Copying initramfs into ./usr ..."
-	# In case the directory is not created yet from the first pass compile:
-	mkdir -p ${B}/usr
-	# Find and use the first initramfs image archive type we find
-	rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
-	for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst; do
-		if [ -e "${INITRAMFS_DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then
-			cp ${INITRAMFS_DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/.
-			case $img in
-			*gz)
-				echo "gzip decompressing image"
-				gunzip -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
-				break
-				;;
-			*lz4)
-				echo "lz4 decompressing image"
-				lz4 -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
-				break
-				;;
-			*lzo)
-				echo "lzo decompressing image"
-				lzop -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
-				break
-				;;
-			*lzma)
-				echo "lzma decompressing image"
-				lzma -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
-				break
-				;;
-			*xz)
-				echo "xz decompressing image"
-				xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
-				break
-				;;
-			*zst)
-				echo "zst decompressing image"
-				zstd -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
-				break
-				;;
-			esac
-			break
-		fi
-	done
-	# Verify that the above loop found a initramfs, fail otherwise
-	[ -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio ] && echo "Finished copy of initramfs into ./usr" || die "Could not find any ${INITRAMFS_DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio{.gz|.lz4|.lzo|.lzma|.xz|.zst) for bundling; INITRAMFS_IMAGE_NAME might be wrong."
-}
-
-do_bundle_initramfs () {
-	if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
-		echo "Creating a kernel image with a bundled initramfs..."
-		copy_initramfs
-		# Backing up kernel image relies on its type(regular file or symbolic link)
-		tmp_path=""
-		for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
-			if [ -h ${KERNEL_OUTPUT_DIR}/$imageType ] ; then
-				linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$imageType`
-				realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$imageType`
-				mv -f $realpath $realpath.bak
-				tmp_path=$tmp_path" "$imageType"#"$linkpath"#"$realpath
-			elif [ -f ${KERNEL_OUTPUT_DIR}/$imageType ]; then
-				mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.bak
-				tmp_path=$tmp_path" "$imageType"##"
-			fi
-		done
-		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
-		kernel_do_compile
-		# Restoring kernel image
-		for tp in $tmp_path ; do
-			imageType=`echo $tp|cut -d "#" -f 1`
-			linkpath=`echo $tp|cut -d "#" -f 2`
-			realpath=`echo $tp|cut -d "#" -f 3`
-			if [ -n "$realpath" ]; then
-				mv -f $realpath $realpath.initramfs
-				mv -f $realpath.bak $realpath
-				ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$imageType.initramfs
-			else
-				mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.initramfs
-				mv -f ${KERNEL_OUTPUT_DIR}/$imageType.bak ${KERNEL_OUTPUT_DIR}/$imageType
-			fi
-		done
-	fi
-}
-do_bundle_initramfs[dirs] = "${B}"
-
-kernel_do_transform_bundled_initramfs() {
-        # vmlinux.gz is not built by kernel
-	if (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux\.gz"); then
-		gzip -9cn < ${KERNEL_OUTPUT_DIR}/vmlinux.initramfs > ${KERNEL_OUTPUT_DIR}/vmlinux.gz.initramfs
-        fi
-}
-do_transform_bundled_initramfs[dirs] = "${B}"
-
-python do_devshell:prepend () {
-    os.environ["LDFLAGS"] = ''
-}
-
-addtask bundle_initramfs after do_install before do_deploy
-
-KERNEL_DEBUG_TIMESTAMPS ??= "0"
-
-kernel_do_compile() {
-	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
-
-	# setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-	export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig"
-	export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig"
-	export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR"
-	export PKG_CONFIG_SYSROOT_DIR=""
-
-	if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
-		# kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
-		# be set....
-		if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then
-			# The source directory is not necessarily a git repository, so we
-			# specify the git-dir to ensure that git does not query a
-			# repository in any parent directory.
-			SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"`
-		fi
-
-		ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH`
-		export KBUILD_BUILD_TIMESTAMP="$ts"
-		export KCONFIG_NOTIMESTAMP=1
-		bbnote "KBUILD_BUILD_TIMESTAMP: $ts"
-	fi
-	# The $use_alternate_initrd is only set from
-	# do_bundle_initramfs() This variable is specifically for the
-	# case where we are making a second pass at the kernel
-	# compilation and we want to force the kernel build to use a
-	# different initramfs image.  The way to do that in the kernel
-	# is to specify:
-	# make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio
-	if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then
-		# The old style way of copying an prebuilt image and building it
-		# is turned on via INTIRAMFS_TASK != ""
-		copy_initramfs
-		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
-	fi
-	for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
-		oe_runmake ${typeformake} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
-	done
-}
-
-kernel_do_transform_kernel() {
-	# vmlinux.gz is not built by kernel
-	if (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux\.gz"); then
-		mkdir -p "${KERNEL_OUTPUT_DIR}"
-		gzip -9cn < ${B}/vmlinux > "${KERNEL_OUTPUT_DIR}/vmlinux.gz"
-	fi
-}
-do_transform_kernel[dirs] = "${B}"
-addtask transform_kernel after do_compile before do_install
-
-do_compile_kernelmodules() {
-	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
-	if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
-		# kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
-		# be set....
-		if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then
-			# The source directory is not necessarily a git repository, so we
-			# specify the git-dir to ensure that git does not query a
-			# repository in any parent directory.
-			SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"`
-		fi
-
-		ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH`
-		export KBUILD_BUILD_TIMESTAMP="$ts"
-		export KCONFIG_NOTIMESTAMP=1
-		bbnote "KBUILD_BUILD_TIMESTAMP: $ts"
-	fi
-	if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
-		oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
-
-		# Module.symvers gets updated during the 
-		# building of the kernel modules. We need to
-		# update this in the shared workdir since some
-		# external kernel modules has a dependency on
-		# other kernel modules and will look at this
-		# file to do symbol lookups
-		cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/
-		# 5.10+ kernels have module.lds that we need to copy for external module builds
-		if [ -e "${B}/scripts/module.lds" ]; then
-			install -Dm 0644 ${B}/scripts/module.lds ${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
-		fi
-	else
-		bbnote "no modules to compile"
-	fi
-}
-addtask compile_kernelmodules after do_compile before do_strip
-
-kernel_do_install() {
-	#
-	# First install the modules
-	#
-	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
-	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
-		oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
-		rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
-		rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
-		# If the kernel/ directory is empty remove it to prevent QA issues
-		rmdir --ignore-fail-on-non-empty "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel"
-	else
-		bbnote "no modules to install"
-	fi
-
-	#
-	# Install various kernel output (zImage, map file, config, module support files)
-	#
-	install -d ${D}/${KERNEL_IMAGEDEST}
-
-	#
-	# When including an initramfs bundle inside a FIT image, the fitImage is created after the install task
-	# by do_assemble_fitimage_initramfs.
-	# This happens after the generation of the initramfs bundle (done by do_bundle_initramfs).
-	# So, at the level of the install task we should not try to install the fitImage. fitImage is still not
-	# generated yet.
-	# After the generation of the fitImage, the deploy task copies the fitImage from the build directory to
-	# the deploy folder.
-	#
-
-	for imageType in ${KERNEL_IMAGETYPES} ; do
-		if [ $imageType != "fitImage" ] || [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ] ; then
-			install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType ${D}/${KERNEL_IMAGEDEST}/$imageType-${KERNEL_VERSION}
-		fi
-	done
-
-	install -m 0644 System.map ${D}/${KERNEL_IMAGEDEST}/System.map-${KERNEL_VERSION}
-	install -m 0644 .config ${D}/${KERNEL_IMAGEDEST}/config-${KERNEL_VERSION}
-	install -m 0644 vmlinux ${D}/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION}
-	[ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
-	install -d ${D}${sysconfdir}/modules-load.d
-	install -d ${D}${sysconfdir}/modprobe.d
-}
-
-# Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile
-do_kernel_version_sanity_check() {
-	if [ "x${KERNEL_VERSION_SANITY_SKIP}" = "x1" ]; then
-		exit 0
-	fi
-
-	# The Makefile determines the kernel version shown at runtime
-	# Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile
-	VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//)
-	PATCHLEVEL=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
-	SUBLEVEL=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
-	EXTRAVERSION=$(grep "^EXTRAVERSION =" ${S}/Makefile | sed s/.*=\ *//)
-
-	# Build a string for regex and a plain version string
-	reg="^${VERSION}\.${PATCHLEVEL}"
-	vers="${VERSION}.${PATCHLEVEL}"
-	if [ -n "${SUBLEVEL}" ]; then
-		# Ignoring a SUBLEVEL of zero is fine
-		if [ "${SUBLEVEL}" = "0" ]; then
-			reg="${reg}(\.${SUBLEVEL})?"
-		else
-			reg="${reg}\.${SUBLEVEL}"
-			vers="${vers}.${SUBLEVEL}"
-		fi
-	fi
-	vers="${vers}${EXTRAVERSION}"
-	reg="${reg}${EXTRAVERSION}"
-
-	if [ -z `echo ${PV} | grep -E "${reg}"` ]; then
-		bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source or set KERNEL_VERSION_SANITY_SKIP=\"1\" in your recipe."
-	fi
-	exit 0
-}
-
-addtask shared_workdir after do_compile before do_compile_kernelmodules
-addtask shared_workdir_setscene
-
-do_shared_workdir_setscene () {
-	exit 1
-}
-
-emit_depmod_pkgdata() {
-	# Stash data for depmod
-	install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
-	echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
-	cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
-}
-
-PACKAGEFUNCS += "emit_depmod_pkgdata"
-
-do_shared_workdir[cleandirs] += " ${STAGING_KERNEL_BUILDDIR}"
-do_shared_workdir () {
-	cd ${B}
-
-	kerneldir=${STAGING_KERNEL_BUILDDIR}
-	install -d $kerneldir
-
-	#
-	# Store the kernel version in sysroots for module-base.bbclass
-	#
-
-	echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
-
-	# Copy files required for module builds
-	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
-	[ -e Module.symvers ] && cp Module.symvers $kerneldir/
-	cp .config $kerneldir/
-	mkdir -p $kerneldir/include/config
-	cp include/config/kernel.release $kerneldir/include/config/kernel.release
-	if [ -e certs/signing_key.x509 ]; then
-		# The signing_key.* files are stored in the certs/ dir in
-		# newer Linux kernels
-		mkdir -p $kerneldir/certs
-		cp certs/signing_key.* $kerneldir/certs/
-	elif [ -e signing_key.priv ]; then
-		cp signing_key.* $kerneldir/
-	fi
-
-	# We can also copy over all the generated files and avoid special cases
-	# like version.h, but we've opted to keep this small until file creep starts
-	# to happen
-	if [ -e include/linux/version.h ]; then
-		mkdir -p $kerneldir/include/linux
-		cp include/linux/version.h $kerneldir/include/linux/version.h
-	fi
-
-	# As of Linux kernel version 3.0.1, the clean target removes
-	# arch/powerpc/lib/crtsavres.o which is present in
-	# KBUILD_LDFLAGS_MODULE, making it required to build external modules.
-	if [ ${ARCH} = "powerpc" ]; then
-		if [ -e arch/powerpc/lib/crtsavres.o ]; then
-			mkdir -p $kerneldir/arch/powerpc/lib/
-			cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
-		fi
-	fi
-
-	if [ -d include/generated ]; then
-		mkdir -p $kerneldir/include/generated/
-		cp -fR include/generated/* $kerneldir/include/generated/
-	fi
-
-	if [ -d arch/${ARCH}/include/generated ]; then
-		mkdir -p $kerneldir/arch/${ARCH}/include/generated/
-		cp -fR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/
-	fi
-
-	if (grep -q -i -e '^CONFIG_UNWINDER_ORC=y$' $kerneldir/.config); then
-		# With CONFIG_UNWINDER_ORC (the default in 4.14), objtool is required for
-		# out-of-tree modules to be able to generate object files.
-		if [ -x tools/objtool/objtool ]; then
-			mkdir -p ${kerneldir}/tools/objtool
-			cp tools/objtool/objtool ${kerneldir}/tools/objtool/
-		fi
-	fi
-}
-
-# We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware
-sysroot_stage_all () {
-	:
-}
-
-KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} CC="${KERNEL_CC}" LD="${KERNEL_LD}" O=${B} olddefconfig || oe_runmake -C ${S} O=${B} CC="${KERNEL_CC}" LD="${KERNEL_LD}" oldnoconfig"
-
-python check_oldest_kernel() {
-    oldest_kernel = d.getVar('OLDEST_KERNEL')
-    kernel_version = d.getVar('KERNEL_VERSION')
-    tclibc = d.getVar('TCLIBC')
-    if tclibc == 'glibc':
-        kernel_version = kernel_version.split('-', 1)[0]
-        if oldest_kernel and kernel_version:
-            if bb.utils.vercmp_string(kernel_version, oldest_kernel) < 0:
-                bb.warn('%s: OLDEST_KERNEL is "%s" but the version of the kernel you are building is "%s" - therefore %s as built may not be compatible with this kernel. Either set OLDEST_KERNEL to an older version, or build a newer kernel.' % (d.getVar('PN'), oldest_kernel, kernel_version, tclibc))
-}
-
-check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION"
-do_configure[prefuncs] += "check_oldest_kernel"
-
-kernel_do_configure() {
-	# fixes extra + in /lib/modules/2.6.37+
-	# $ scripts/setlocalversion . => +
-	# $ make kernelversion => 2.6.37
-	# $ make kernelrelease => 2.6.37+
-	touch ${B}/.scmversion ${S}/.scmversion
-
-	if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
-		mv "${S}/.config" "${B}/.config"
-	fi
-
-	# Copy defconfig to .config if .config does not exist. This allows
-	# recipes to manage the .config themselves in do_configure:prepend().
-	if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
-		cp "${WORKDIR}/defconfig" "${B}/.config"
-	fi
-
-	${KERNEL_CONFIG_COMMAND}
-}
-
-do_savedefconfig() {
-	bbplain "Saving defconfig to:\n${B}/defconfig"
-	oe_runmake -C ${B} LD='${KERNEL_LD}' savedefconfig
-}
-do_savedefconfig[nostamp] = "1"
-addtask savedefconfig after do_configure
-
-inherit cml1
-
-KCONFIG_CONFIG_COMMAND:append = " PAHOLE=false LD='${KERNEL_LD}' HOSTLDFLAGS='${BUILD_LDFLAGS}'"
-
-EXPORT_FUNCTIONS do_compile do_transform_kernel do_transform_bundled_initramfs do_install do_configure
-
-# kernel-base becomes kernel-${KERNEL_VERSION}
-# kernel-image becomes kernel-image-${KERNEL_VERSION}
-PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules ${KERNEL_PACKAGE_NAME}-dbg"
-FILES:${PN} = ""
-FILES:${KERNEL_PACKAGE_NAME}-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo"
-FILES:${KERNEL_PACKAGE_NAME}-image = ""
-FILES:${KERNEL_PACKAGE_NAME}-dev = "/${KERNEL_IMAGEDEST}/System.map* /${KERNEL_IMAGEDEST}/Module.symvers* /${KERNEL_IMAGEDEST}/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
-FILES:${KERNEL_PACKAGE_NAME}-vmlinux = "/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION_NAME}"
-FILES:${KERNEL_PACKAGE_NAME}-modules = ""
-FILES:${KERNEL_PACKAGE_NAME}-dbg = "/usr/lib/debug /usr/src/debug"
-RDEPENDS:${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base (= ${EXTENDPKGV})"
-# Allow machines to override this dependency if kernel image files are
-# not wanted in images as standard
-RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image (= ${EXTENDPKGV})"
-PKG:${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
-RDEPENDS:${KERNEL_PACKAGE_NAME}-image += "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
-PKG:${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
-RPROVIDES:${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME} = "1"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-base = "1"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-image = "1"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-modules = "1"
-DESCRIPTION:${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
-
-pkg_postinst:${KERNEL_PACKAGE_NAME}-base () {
-	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
-		mkdir -p $D/lib/modules/${KERNEL_VERSION}
-	fi
-	if [ -n "$D" ]; then
-		depmodwrapper -a -b $D ${KERNEL_VERSION}
-	else
-		depmod -a ${KERNEL_VERSION}
-	fi
-}
-
-PACKAGESPLITFUNCS:prepend = "split_kernel_packages "
-
-python split_kernel_packages () {
-    do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex=r'^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
-}
-
-# Many scripts want to look in arch/$arch/boot for the bootable
-# image. This poses a problem for vmlinux and vmlinuz based
-# booting. This task arranges to have vmlinux and vmlinuz appear
-# in the normalized directory location.
-do_kernel_link_images() {
-	if [ ! -d "${B}/arch/${ARCH}/boot" ]; then
-		mkdir ${B}/arch/${ARCH}/boot
-	fi
-	cd ${B}/arch/${ARCH}/boot
-	ln -sf ../../../vmlinux
-	if [ -f ../../../vmlinuz ]; then
-		ln -sf ../../../vmlinuz
-	fi
-	if [ -f ../../../vmlinuz.bin ]; then
-		ln -sf ../../../vmlinuz.bin
-	fi
-	if [ -f ../../../vmlinux.64 ]; then
-		ln -sf ../../../vmlinux.64
-	fi
-}
-addtask kernel_link_images after do_compile before do_strip
-
-python do_strip() {
-    import shutil
-
-    strip = d.getVar('STRIP')
-    extra_sections = d.getVar('KERNEL_IMAGE_STRIP_EXTRA_SECTIONS')
-    kernel_image = d.getVar('B') + "/" + d.getVar('KERNEL_OUTPUT_DIR') + "/vmlinux"
-
-    if (extra_sections and kernel_image.find(d.getVar('KERNEL_IMAGEDEST') + '/vmlinux') != -1):
-        kernel_image_stripped = kernel_image + ".stripped"
-        shutil.copy2(kernel_image, kernel_image_stripped)
-        oe.package.runstrip((kernel_image_stripped, 8, strip, extra_sections))
-        bb.debug(1, "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections: " + \
-            extra_sections)
-}
-do_strip[dirs] = "${B}"
-
-addtask strip before do_sizecheck after do_kernel_link_images
-
-# Support checking the kernel size since some kernels need to reside in partitions
-# with a fixed length or there is a limit in transferring the kernel to memory.
-# If more than one image type is enabled, warn on any that don't fit but only fail
-# if none fit.
-do_sizecheck() {
-	if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
-		invalid=`echo ${KERNEL_IMAGE_MAXSIZE} | sed 's/[0-9]//g'`
-		if [ -n "$invalid" ]; then
-			die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integer (The unit is Kbytes)"
-		fi
-		at_least_one_fits=
-		for imageType in ${KERNEL_IMAGETYPES} ; do
-			size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$imageType | awk '{print $1}'`
-			if [ $size -gt ${KERNEL_IMAGE_MAXSIZE} ]; then
-				bbwarn "This kernel $imageType (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device."
-			else
-				at_least_one_fits=y
-			fi
-		done
-		if [ -z "$at_least_one_fits" ]; then
-			die "All kernel images are too big for your device. Please reduce the size of the kernel by making more of it modular."
-		fi
-	fi
-}
-do_sizecheck[dirs] = "${B}"
-
-addtask sizecheck before do_install after do_strip
-
-inherit kernel-artifact-names
-
-kernel_do_deploy() {
-	deployDir="${DEPLOYDIR}"
-	if [ -n "${KERNEL_DEPLOYSUBDIR}" ]; then
-		deployDir="${DEPLOYDIR}/${KERNEL_DEPLOYSUBDIR}"
-		mkdir "$deployDir"
-	fi
-
-	for imageType in ${KERNEL_IMAGETYPES} ; do
-		baseName=$imageType-${KERNEL_IMAGE_NAME}
-
-		if [ -s ${KERNEL_OUTPUT_DIR}/$imageType.stripped ] ; then
-			install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType.stripped $deployDir/$baseName${KERNEL_IMAGE_BIN_EXT}
-		else
-			install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType $deployDir/$baseName${KERNEL_IMAGE_BIN_EXT}
-		fi
-		if [ -n "${KERNEL_IMAGE_LINK_NAME}" ] ; then
-			ln -sf $baseName${KERNEL_IMAGE_BIN_EXT} $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
-		fi
-		if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then
-			ln -sf $baseName${KERNEL_IMAGE_BIN_EXT} $deployDir/$imageType
-		fi
-	done
-
-	if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
-		mkdir -p ${D}${root_prefix}/lib
-		if [ -n "${SOURCE_DATE_EPOCH}" ]; then
-			TAR_ARGS="--sort=name --clamp-mtime --mtime=@${SOURCE_DATE_EPOCH}"
-		else
-			TAR_ARGS=""
-		fi
-		TAR_ARGS="$TAR_ARGS --owner=0 --group=0"
-		tar $TAR_ARGS -cv -C ${D}${root_prefix} lib | gzip -9n > $deployDir/modules-${MODULE_TARBALL_NAME}.tgz
-
-		if [ -n "${MODULE_TARBALL_LINK_NAME}" ] ; then
-			ln -sf modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz
-		fi
-	fi
-
-	if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
-		for imageType in ${KERNEL_IMAGETYPES} ; do
-			if [ "$imageType" = "fitImage" ] ; then
-				continue
-			fi
-			initramfsBaseName=$imageType-${INITRAMFS_NAME}
-			install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType.initramfs $deployDir/$initramfsBaseName${KERNEL_IMAGE_BIN_EXT}
-			if [ -n "${INITRAMFS_LINK_NAME}" ] ; then
-				ln -sf $initramfsBaseName${KERNEL_IMAGE_BIN_EXT} $deployDir/$imageType-${INITRAMFS_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
-			fi
-		done
-	fi
-}
-
-# We deploy to filenames that include PKGV and PKGR, read the saved data to
-# ensure we get the right values for both
-do_deploy[prefuncs] += "read_subpackage_metadata"
-
-addtask deploy after do_populate_sysroot do_packagedata
-
-EXPORT_FUNCTIONS do_deploy
-
-# Add using Device Tree support
-inherit kernel-devicetree
diff --git a/poky/meta/classes/kernelsrc.bbclass b/poky/meta/classes/kernelsrc.bbclass
deleted file mode 100644
index a951ba3..0000000
--- a/poky/meta/classes/kernelsrc.bbclass
+++ /dev/null
@@ -1,10 +0,0 @@
-S = "${STAGING_KERNEL_DIR}"
-deltask do_fetch
-deltask do_unpack
-do_patch[depends] += "virtual/kernel:do_shared_workdir"
-do_patch[noexec] = "1"
-do_package[depends] += "virtual/kernel:do_populate_sysroot"
-KERNEL_VERSION = "${@get_kernelversion_file("${STAGING_KERNEL_BUILDDIR}")}"
-
-inherit linux-kernel-base
-
diff --git a/poky/meta/classes/lib_package.bbclass b/poky/meta/classes/lib_package.bbclass
deleted file mode 100644
index 8849f59..0000000
--- a/poky/meta/classes/lib_package.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# ${PN}-bin is defined in bitbake.conf
-#
-# We need to allow the other packages to be greedy with what they
-# want out of /usr/bin and /usr/sbin before ${PN}-bin gets greedy.
-# 
-PACKAGE_BEFORE_PN = "${PN}-bin"
diff --git a/poky/meta/classes/libc-package.bbclass b/poky/meta/classes/libc-package.bbclass
deleted file mode 100644
index 13ef8cd..0000000
--- a/poky/meta/classes/libc-package.bbclass
+++ /dev/null
@@ -1,384 +0,0 @@
-#
-# This class knows how to package up [e]glibc. Its shared since prebuild binary toolchains
-# may need packaging and its pointless to duplicate this code.
-#
-# Caller should set GLIBC_INTERNAL_USE_BINARY_LOCALE to one of:
-#  "compile" - Use QEMU to generate the binary locale files
-#  "precompiled" - The binary locale files are pregenerated and already present
-#  "ondevice" - The device will build the locale files upon first boot through the postinst
-
-GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice"
-
-GLIBC_SPLIT_LC_PACKAGES ?= "0"
-
-python __anonymous () {
-    enabled = d.getVar("ENABLE_BINARY_LOCALE_GENERATION")
-
-    pn = d.getVar("PN")
-    if pn.endswith("-initial"):
-        enabled = False
-
-    if enabled and int(enabled):
-        import re
-
-        target_arch = d.getVar("TARGET_ARCH")
-        binary_arches = d.getVar("BINARY_LOCALE_ARCHES") or ""
-        use_cross_localedef = d.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF") or ""
-
-        for regexp in binary_arches.split(" "):
-            r = re.compile(regexp)
-
-            if r.match(target_arch):
-                depends = d.getVar("DEPENDS")
-                if use_cross_localedef == "1" :
-                    depends = "%s cross-localedef-native" % depends
-                else:
-                    depends = "%s qemu-native" % depends
-                d.setVar("DEPENDS", depends)
-                d.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile")
-                break
-}
-
-# try to fix disable charsets/locales/locale-code compile fail
-PACKAGE_NO_GCONV ?= "0"
-
-OVERRIDES:append = ":${TARGET_ARCH}-${TARGET_OS}"
-
-locale_base_postinst_ontarget() {
-localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s %s
-}
-
-locale_base_postrm() {
-#!/bin/sh
-localedef --delete-from-archive --inputfile=${datadir}/locales/%s --charmap=%s %s
-}
-
-LOCALETREESRC ?= "${PKGD}"
-
-do_prep_locale_tree() {
-	treedir=${WORKDIR}/locale-tree
-	rm -rf $treedir
-	mkdir -p $treedir/${base_bindir} $treedir/${base_libdir} $treedir/${datadir} $treedir/${localedir}
-	tar -cf - -C ${LOCALETREESRC}${datadir} -p i18n | tar -xf - -C $treedir/${datadir}
-	# unzip to avoid parsing errors
-	for i in $treedir/${datadir}/i18n/charmaps/*gz; do 
-		gunzip $i
-	done
-	# The extract pattern "./l*.so*" is carefully selected so that it will
-	# match ld*.so and lib*.so*, but not any files in the gconv directory
-	# (if it exists). This makes sure we only unpack the files we need.
-	# This is important in case usrmerge is set in DISTRO_FEATURES, which
-	# means ${base_libdir} == ${libdir}.
-	tar -cf - -C ${LOCALETREESRC}${base_libdir} -p . | tar -xf - -C $treedir/${base_libdir} --wildcards './l*.so*'
-	if [ -f ${STAGING_LIBDIR_NATIVE}/libgcc_s.* ]; then
-		tar -cf - -C ${STAGING_LIBDIR_NATIVE} -p libgcc_s.* | tar -xf - -C $treedir/${base_libdir}
-	fi
-	install -m 0755 ${LOCALETREESRC}${bindir}/localedef $treedir/${base_bindir}
-}
-
-do_collect_bins_from_locale_tree() {
-	treedir=${WORKDIR}/locale-tree
-
-	parent=$(dirname ${localedir})
-	mkdir -p ${PKGD}/$parent
-	tar -cf - -C $treedir/$parent -p $(basename ${localedir}) | tar -xf - -C ${PKGD}$parent
-
-	# Finalize tree by chaning all duplicate files into hard links
-	cross-localedef-hardlink -c -v ${WORKDIR}/locale-tree
-}
-
-inherit qemu
-
-python package_do_split_gconvs () {
-    import re
-    if (d.getVar('PACKAGE_NO_GCONV') == '1'):
-        bb.note("package requested not splitting gconvs")
-        return
-
-    if not d.getVar('PACKAGES'):
-        return
-
-    mlprefix = d.getVar("MLPREFIX") or ""
-
-    bpn = d.getVar('BPN')
-    libdir = d.getVar('libdir')
-    if not libdir:
-        bb.error("libdir not defined")
-        return
-    datadir = d.getVar('datadir')
-    if not datadir:
-        bb.error("datadir not defined")
-        return
-
-    gconv_libdir = oe.path.join(libdir, "gconv")
-    charmap_dir = oe.path.join(datadir, "i18n", "charmaps")
-    locales_dir = oe.path.join(datadir, "i18n", "locales")
-    binary_locales_dir = d.getVar('localedir')
-
-    def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group):
-        deps = []
-        f = open(fn, "rb")
-        c_re = re.compile(r'^copy "(.*)"')
-        i_re = re.compile(r'^include "(\w+)".*')
-        for l in f.readlines():
-            l = l.decode("latin-1")
-            m = c_re.match(l) or i_re.match(l)
-            if m:
-                dp = legitimize_package_name('%s%s-gconv-%s' % (mlprefix, bpn, m.group(1)))
-                if not dp in deps:
-                    deps.append(dp)
-        f.close()
-        if deps != []:
-            d.setVar('RDEPENDS:%s' % pkg, " ".join(deps))
-        if bpn != 'glibc':
-            d.setVar('RPROVIDES:%s' % pkg, pkg.replace(bpn, 'glibc'))
-
-    do_split_packages(d, gconv_libdir, file_regex=r'^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \
-        description='gconv module for character set %s', hook=calc_gconv_deps, \
-        extra_depends=bpn+'-gconv')
-
-    def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group):
-        deps = []
-        f = open(fn, "rb")
-        c_re = re.compile(r'^copy "(.*)"')
-        i_re = re.compile(r'^include "(\w+)".*')
-        for l in f.readlines():
-            l = l.decode("latin-1")
-            m = c_re.match(l) or i_re.match(l)
-            if m:
-                dp = legitimize_package_name('%s%s-charmap-%s' % (mlprefix, bpn, m.group(1)))
-                if not dp in deps:
-                    deps.append(dp)
-        f.close()
-        if deps != []:
-            d.setVar('RDEPENDS:%s' % pkg, " ".join(deps))
-        if bpn != 'glibc':
-            d.setVar('RPROVIDES:%s' % pkg, pkg.replace(bpn, 'glibc'))
-
-    do_split_packages(d, charmap_dir, file_regex=r'^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \
-        description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='')
-
-    def calc_locale_deps(fn, pkg, file_regex, output_pattern, group):
-        deps = []
-        f = open(fn, "rb")
-        c_re = re.compile(r'^copy "(.*)"')
-        i_re = re.compile(r'^include "(\w+)".*')
-        for l in f.readlines():
-            l = l.decode("latin-1")
-            m = c_re.match(l) or i_re.match(l)
-            if m:
-                dp = legitimize_package_name(mlprefix+bpn+'-localedata-%s' % m.group(1))
-                if not dp in deps:
-                    deps.append(dp)
-        f.close()
-        if deps != []:
-            d.setVar('RDEPENDS:%s' % pkg, " ".join(deps))
-        if bpn != 'glibc':
-            d.setVar('RPROVIDES:%s' % pkg, pkg.replace(bpn, 'glibc'))
-
-    do_split_packages(d, locales_dir, file_regex=r'(.*)', output_pattern=bpn+'-localedata-%s', \
-        description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
-    d.setVar('PACKAGES', d.getVar('PACKAGES', False) + ' ' + d.getVar('MLPREFIX', False) + bpn + '-gconv')
-
-    use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE")
-
-    dot_re = re.compile(r"(.*)\.(.*)")
-
-    # Read in supported locales and associated encodings
-    supported = {}
-    with open(oe.path.join(d.getVar('WORKDIR'), "SUPPORTED")) as f:
-        for line in f.readlines():
-            try:
-                locale, charset = line.rstrip().split()
-            except ValueError:
-                continue
-            supported[locale] = charset
-
-    # GLIBC_GENERATE_LOCALES var specifies which locales to be generated. empty or "all" means all locales
-    to_generate = d.getVar('GLIBC_GENERATE_LOCALES')
-    if not to_generate or to_generate == 'all':
-        to_generate = sorted(supported.keys())
-    else:
-        to_generate = to_generate.split()
-        for locale in to_generate:
-            if locale not in supported:
-                if '.' in locale:
-                    charset = locale.split('.')[1]
-                else:
-                    charset = 'UTF-8'
-                    bb.warn("Unsupported locale '%s', assuming encoding '%s'" % (locale, charset))
-                supported[locale] = charset
-
-    def output_locale_source(name, pkgname, locale, encoding):
-        d.setVar('RDEPENDS:%s' % pkgname, '%slocaledef %s-localedata-%s %s-charmap-%s' % \
-        (mlprefix, mlprefix+bpn, legitimize_package_name(locale), mlprefix+bpn, legitimize_package_name(encoding)))
-        d.setVar('pkg_postinst_ontarget:%s' % pkgname, d.getVar('locale_base_postinst_ontarget') \
-        % (locale, encoding, locale))
-        d.setVar('pkg_postrm:%s' % pkgname, d.getVar('locale_base_postrm') % \
-        (locale, encoding, locale))
-
-    def output_locale_binary_rdepends(name, pkgname, locale, encoding):
-        dep = legitimize_package_name('%s-binary-localedata-%s' % (bpn, name))
-        lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES')
-        if lcsplit and int(lcsplit):
-            d.appendVar('PACKAGES', ' ' + dep)
-            d.setVar('ALLOW_EMPTY:%s' % dep, '1')
-        d.setVar('RDEPENDS:%s' % pkgname, mlprefix + dep)
-
-    commands = {}
-
-    def output_locale_binary(name, pkgname, locale, encoding):
-        treedir = oe.path.join(d.getVar("WORKDIR"), "locale-tree")
-        ldlibdir = oe.path.join(treedir, d.getVar("base_libdir"))
-        path = d.getVar("PATH")
-        i18npath = oe.path.join(treedir, datadir, "i18n")
-        gconvpath = oe.path.join(treedir, "iconvdata")
-        outputpath = oe.path.join(treedir, binary_locales_dir)
-
-        use_cross_localedef = d.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF") or "0"
-        if use_cross_localedef == "1":
-            target_arch = d.getVar('TARGET_ARCH')
-            locale_arch_options = { \
-                "arc":     " --uint32-align=4 --little-endian ", \
-                "arceb":   " --uint32-align=4 --big-endian ",    \
-                "arm":     " --uint32-align=4 --little-endian ", \
-                "armeb":   " --uint32-align=4 --big-endian ",    \
-                "aarch64": " --uint32-align=4 --little-endian ",    \
-                "aarch64_be": " --uint32-align=4 --big-endian ",    \
-                "sh4":     " --uint32-align=4 --big-endian ",    \
-                "powerpc": " --uint32-align=4 --big-endian ",    \
-                "powerpc64": " --uint32-align=4 --big-endian ",  \
-                "powerpc64le": " --uint32-align=4 --little-endian ",  \
-                "mips":    " --uint32-align=4 --big-endian ",    \
-                "mipsisa32r6":    " --uint32-align=4 --big-endian ",    \
-                "mips64":  " --uint32-align=4 --big-endian ",    \
-                "mipsisa64r6":  " --uint32-align=4 --big-endian ",    \
-                "mipsel":  " --uint32-align=4 --little-endian ", \
-                "mipsisa32r6el":  " --uint32-align=4 --little-endian ", \
-                "mips64el":" --uint32-align=4 --little-endian ", \
-                "mipsisa64r6el":" --uint32-align=4 --little-endian ", \
-                "riscv64": " --uint32-align=4 --little-endian ", \
-                "riscv32": " --uint32-align=4 --little-endian ", \
-                "i586":    " --uint32-align=4 --little-endian ", \
-                "i686":    " --uint32-align=4 --little-endian ", \
-                "x86_64":  " --uint32-align=4 --little-endian "  }
-
-            if target_arch in locale_arch_options:
-                localedef_opts = locale_arch_options[target_arch]
-            else:
-                bb.error("locale_arch_options not found for target_arch=" + target_arch)
-                bb.fatal("unknown arch:" + target_arch + " for locale_arch_options")
-
-            localedef_opts += " --force --no-hard-links --no-archive --prefix=%s \
-                --inputfile=%s/%s/i18n/locales/%s --charmap=%s %s/%s" \
-                % (treedir, treedir, datadir, locale, encoding, outputpath, name)
-
-            cmd = "PATH=\"%s\" I18NPATH=\"%s\" GCONV_PATH=\"%s\" cross-localedef %s" % \
-                (path, i18npath, gconvpath, localedef_opts)
-        else: # earlier slower qemu way 
-            qemu = qemu_target_binary(d) 
-            localedef_opts = "--force --no-hard-links --no-archive --prefix=%s \
-                --inputfile=%s/i18n/locales/%s --charmap=%s %s" \
-                % (treedir, datadir, locale, encoding, name)
-
-            qemu_options = d.getVar('QEMU_OPTIONS')
-
-            cmd = "PSEUDO_RELOADED=YES PATH=\"%s\" I18NPATH=\"%s\" %s -L %s \
-                -E LD_LIBRARY_PATH=%s %s %s${base_bindir}/localedef %s" % \
-                (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts)
-
-        commands["%s/%s" % (outputpath, name)] = cmd
-
-        bb.note("generating locale %s (%s)" % (locale, encoding))
-
-    def output_locale(name, locale, encoding):
-        pkgname = d.getVar('MLPREFIX', False) + 'locale-base-' + legitimize_package_name(name)
-        d.setVar('ALLOW_EMPTY:%s' % pkgname, '1')
-        d.setVar('PACKAGES', '%s %s' % (pkgname, d.getVar('PACKAGES')))
-        rprovides = ' %svirtual-locale-%s' % (mlprefix, legitimize_package_name(name))
-        m = re.match(r"(.*)_(.*)", name)
-        if m:
-            rprovides += ' %svirtual-locale-%s' % (mlprefix, m.group(1))
-        d.setVar('RPROVIDES:%s' % pkgname, rprovides)
-
-        if use_bin == "compile":
-            output_locale_binary_rdepends(name, pkgname, locale, encoding)
-            output_locale_binary(name, pkgname, locale, encoding)
-        elif use_bin == "precompiled":
-            output_locale_binary_rdepends(name, pkgname, locale, encoding)
-        else:
-            output_locale_source(name, pkgname, locale, encoding)
-
-    if use_bin == "compile":
-        bb.note("preparing tree for binary locale generation")
-        bb.build.exec_func("do_prep_locale_tree", d)
-
-    utf8_only = int(d.getVar('LOCALE_UTF8_ONLY') or 0)
-    utf8_is_default = int(d.getVar('LOCALE_UTF8_IS_DEFAULT') or 0)
-
-    encodings = {}
-    for locale in to_generate:
-        charset = supported[locale]
-        if utf8_only and charset != 'UTF-8':
-            continue
-
-        m = dot_re.match(locale)
-        if m:
-            base = m.group(1)
-        else:
-            base = locale
-
-        # Non-precompiled locales may be renamed so that the default
-        # (non-suffixed) encoding is always UTF-8, i.e., instead of en_US and
-        # en_US.UTF-8, we have en_US and en_US.ISO-8859-1. This implicitly
-        # contradicts SUPPORTED.
-        if use_bin == "precompiled" or not utf8_is_default:
-            output_locale(locale, base, charset)
-        else:
-            if charset == 'UTF-8':
-                output_locale(base, base, charset)
-            else:
-                output_locale('%s.%s' % (base, charset), base, charset)
-
-    def metapkg_hook(file, pkg, pattern, format, basename):
-        name = basename.split('/', 1)[0]
-        metapkg = legitimize_package_name('%s-binary-localedata-%s' % (mlprefix+bpn, name))
-        d.appendVar('RDEPENDS:%s' % metapkg, ' ' + pkg)
-
-    if use_bin == "compile":
-        makefile = oe.path.join(d.getVar("WORKDIR"), "locale-tree", "Makefile")
-        with open(makefile, "w") as m:
-            m.write("all: %s\n\n" % " ".join(commands.keys()))
-            total = len(commands)
-            for i, (maketarget, makerecipe) in enumerate(commands.items()):
-                m.write(maketarget + ":\n")
-                m.write("\t@echo 'Progress %d/%d'\n" % (i, total))
-                m.write("\t" + makerecipe + "\n\n")
-        d.setVar("EXTRA_OEMAKE", "-C %s ${PARALLEL_MAKE}" % (os.path.dirname(makefile)))
-        d.setVarFlag("oe_runmake", "progress", r"outof:Progress\s(\d+)/(\d+)")
-        bb.note("Executing binary locale generation makefile")
-        bb.build.exec_func("oe_runmake", d)
-        bb.note("collecting binary locales from locale tree")
-        bb.build.exec_func("do_collect_bins_from_locale_tree", d)
-
-    if use_bin in ('compile', 'precompiled'):
-        lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES')
-        if lcsplit and int(lcsplit):
-            do_split_packages(d, binary_locales_dir, file_regex=r'^(.*/LC_\w+)', \
-                output_pattern=bpn+'-binary-localedata-%s', \
-                description='binary locale definition for %s', recursive=True,
-                hook=metapkg_hook, extra_depends='', allow_dirs=True, match_path=True)
-        else:
-            do_split_packages(d, binary_locales_dir, file_regex=r'(.*)', \
-                output_pattern=bpn+'-binary-localedata-%s', \
-                description='binary locale definition for %s', extra_depends='', allow_dirs=True)
-    else:
-        bb.note("generation of binary locales disabled. this may break i18n!")
-
-}
-
-# We want to do this indirection so that we can safely 'return'
-# from the called function even though we're prepending
-python populate_packages:prepend () {
-    bb.build.exec_func('package_do_split_gconvs', d)
-}
diff --git a/poky/meta/classes/license.bbclass b/poky/meta/classes/license.bbclass
deleted file mode 100644
index 4ebfc4f..0000000
--- a/poky/meta/classes/license.bbclass
+++ /dev/null
@@ -1,420 +0,0 @@
-# Populates LICENSE_DIRECTORY as set in distro config with the license files as set by
-# LIC_FILES_CHKSUM.
-# TODO:
-# - There is a real issue revolving around license naming standards.
-
-LICENSE_DIRECTORY ??= "${DEPLOY_DIR}/licenses"
-LICSSTATEDIR = "${WORKDIR}/license-destdir/"
-
-# Create extra package with license texts and add it to RRECOMMENDS:${PN}
-LICENSE_CREATE_PACKAGE[type] = "boolean"
-LICENSE_CREATE_PACKAGE ??= "0"
-LICENSE_PACKAGE_SUFFIX ??= "-lic"
-LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/"
-
-addtask populate_lic after do_patch before do_build
-do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}"
-do_populate_lic[cleandirs] = "${LICSSTATEDIR}"
-
-python do_populate_lic() {
-    """
-    Populate LICENSE_DIRECTORY with licenses.
-    """
-    lic_files_paths = find_license_files(d)
-
-    # The base directory we wrangle licenses to
-    destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('PN'))
-    copy_license_files(lic_files_paths, destdir)
-    info = get_recipe_info(d)
-    with open(os.path.join(destdir, "recipeinfo"), "w") as f:
-        for key in sorted(info.keys()):
-            f.write("%s: %s\n" % (key, info[key]))
-    oe.qa.exit_if_errors(d)
-}
-
-PSEUDO_IGNORE_PATHS .= ",${@','.join(((d.getVar('COMMON_LICENSE_DIR') or '') + ' ' + (d.getVar('LICENSE_PATH') or '') + ' ' + d.getVar('COREBASE') + '/meta/COPYING').split())}"
-# it would be better to copy them in do_install:append, but find_license_filesa is python
-python perform_packagecopy:prepend () {
-    enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d)
-    if d.getVar('CLASSOVERRIDE') == 'class-target' and enabled:
-        lic_files_paths = find_license_files(d)
-
-        # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY
-        destdir = d.getVar('D') + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY'), d.getVar('PN'))
-        copy_license_files(lic_files_paths, destdir)
-        add_package_and_files(d)
-}
-perform_packagecopy[vardeps] += "LICENSE_CREATE_PACKAGE"
-
-def get_recipe_info(d):
-    info = {}
-    info["PV"] = d.getVar("PV")
-    info["PR"] = d.getVar("PR")
-    info["LICENSE"] = d.getVar("LICENSE")
-    return info
-
-def add_package_and_files(d):
-    packages = d.getVar('PACKAGES')
-    files = d.getVar('LICENSE_FILES_DIRECTORY')
-    pn = d.getVar('PN')
-    pn_lic = "%s%s" % (pn, d.getVar('LICENSE_PACKAGE_SUFFIX', False))
-    if pn_lic in packages.split():
-        bb.warn("%s package already existed in %s." % (pn_lic, pn))
-    else:
-        # first in PACKAGES to be sure that nothing else gets LICENSE_FILES_DIRECTORY
-        d.setVar('PACKAGES', "%s %s" % (pn_lic, packages))
-        d.setVar('FILES:' + pn_lic, files)
-
-def copy_license_files(lic_files_paths, destdir):
-    import shutil
-    import errno
-
-    bb.utils.mkdirhier(destdir)
-    for (basename, path, beginline, endline) in lic_files_paths:
-        try:
-            src = path
-            dst = os.path.join(destdir, basename)
-            if os.path.exists(dst):
-                os.remove(dst)
-            if os.path.islink(src):
-                src = os.path.realpath(src)
-            canlink = os.access(src, os.W_OK) and (os.stat(src).st_dev == os.stat(destdir).st_dev) and beginline is None and endline is None
-            if canlink:
-                try:
-                    os.link(src, dst)
-                except OSError as err:
-                    if err.errno == errno.EXDEV:
-                        # Copy license files if hardlink is not possible even if st_dev is the
-                        # same on source and destination (docker container with device-mapper?)
-                        canlink = False
-                    else:
-                        raise
-                # Only chown if we did hardlink and we're running under pseudo
-                if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
-                    os.chown(dst,0,0)
-            if not canlink:
-                begin_idx = max(0, int(beginline) - 1) if beginline is not None else None
-                end_idx = max(0, int(endline)) if endline is not None else None
-                if begin_idx is None and end_idx is None:
-                    shutil.copyfile(src, dst)
-                else:
-                    with open(src, 'rb') as src_f:
-                        with open(dst, 'wb') as dst_f:
-                            dst_f.write(b''.join(src_f.readlines()[begin_idx:end_idx]))
-
-        except Exception as e:
-            bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e))
-
-def find_license_files(d):
-    """
-    Creates list of files used in LIC_FILES_CHKSUM and generic LICENSE files.
-    """
-    import shutil
-    import oe.license
-    from collections import defaultdict, OrderedDict
-
-    # All the license files for the package
-    lic_files = d.getVar('LIC_FILES_CHKSUM') or ""
-    pn = d.getVar('PN')
-    # The license files are located in S/LIC_FILE_CHECKSUM.
-    srcdir = d.getVar('S')
-    # Directory we store the generic licenses as set in the distro configuration
-    generic_directory = d.getVar('COMMON_LICENSE_DIR')
-    # List of basename, path tuples
-    lic_files_paths = []
-    # hash for keep track generic lics mappings
-    non_generic_lics = {}
-    # Entries from LIC_FILES_CHKSUM
-    lic_chksums = {}
-    license_source_dirs = []
-    license_source_dirs.append(generic_directory)
-    try:
-        additional_lic_dirs = d.getVar('LICENSE_PATH').split()
-        for lic_dir in additional_lic_dirs:
-            license_source_dirs.append(lic_dir)
-    except:
-        pass
-
-    class FindVisitor(oe.license.LicenseVisitor):
-        def visit_Str(self, node):
-            #
-            # Until I figure out what to do with
-            # the two modifiers I support (or greater = +
-            # and "with exceptions" being *
-            # we'll just strip out the modifier and put
-            # the base license.
-            find_license(node.s.replace("+", "").replace("*", ""))
-            self.generic_visit(node)
-
-        def visit_Constant(self, node):
-            find_license(node.value.replace("+", "").replace("*", ""))
-            self.generic_visit(node)
-
-    def find_license(license_type):
-        try:
-            bb.utils.mkdirhier(gen_lic_dest)
-        except:
-            pass
-        spdx_generic = None
-        license_source = None
-        # If the generic does not exist we need to check to see if there is an SPDX mapping to it,
-        # unless NO_GENERIC_LICENSE is set.
-        for lic_dir in license_source_dirs:
-            if not os.path.isfile(os.path.join(lic_dir, license_type)):
-                if d.getVarFlag('SPDXLICENSEMAP', license_type) != None:
-                    # Great, there is an SPDXLICENSEMAP. We can copy!
-                    bb.debug(1, "We need to use a SPDXLICENSEMAP for %s" % (license_type))
-                    spdx_generic = d.getVarFlag('SPDXLICENSEMAP', license_type)
-                    license_source = lic_dir
-                    break
-            elif os.path.isfile(os.path.join(lic_dir, license_type)):
-                spdx_generic = license_type
-                license_source = lic_dir
-                break
-
-        non_generic_lic = d.getVarFlag('NO_GENERIC_LICENSE', license_type)
-        if spdx_generic and license_source:
-            # we really should copy to generic_ + spdx_generic, however, that ends up messing the manifest
-            # audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes)
-
-            lic_files_paths.append(("generic_" + license_type, os.path.join(license_source, spdx_generic),
-                                    None, None))
-
-            # The user may attempt to use NO_GENERIC_LICENSE for a generic license which doesn't make sense
-            # and should not be allowed, warn the user in this case.
-            if d.getVarFlag('NO_GENERIC_LICENSE', license_type):
-                oe.qa.handle_error("license-no-generic",
-                    "%s: %s is a generic license, please don't use NO_GENERIC_LICENSE for it." % (pn, license_type), d)
-
-        elif non_generic_lic and non_generic_lic in lic_chksums:
-            # if NO_GENERIC_LICENSE is set, we copy the license files from the fetched source
-            # of the package rather than the license_source_dirs.
-            lic_files_paths.append(("generic_" + license_type,
-                                    os.path.join(srcdir, non_generic_lic), None, None))
-            non_generic_lics[non_generic_lic] = license_type
-        else:
-            # Explicitly avoid the CLOSED license because this isn't generic
-            if license_type != 'CLOSED':
-                # And here is where we warn people that their licenses are lousy
-                oe.qa.handle_error("license-exists",
-                    "%s: No generic license file exists for: %s in any provider" % (pn, license_type), d)
-            pass
-
-    if not generic_directory:
-        bb.fatal("COMMON_LICENSE_DIR is unset. Please set this in your distro config")
-
-    for url in lic_files.split():
-        try:
-            (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
-            if method != "file" or not path:
-                raise bb.fetch.MalformedUrl()
-        except bb.fetch.MalformedUrl:
-            bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL:  %s" % (d.getVar('PF'), url))
-        # We want the license filename and path
-        chksum = parm.get('md5', None)
-        beginline = parm.get('beginline')
-        endline = parm.get('endline')
-        lic_chksums[path] = (chksum, beginline, endline)
-
-    v = FindVisitor()
-    try:
-        v.visit_string(d.getVar('LICENSE'))
-    except oe.license.InvalidLicense as exc:
-        bb.fatal('%s: %s' % (d.getVar('PF'), exc))
-    except SyntaxError:
-        oe.qa.handle_error("license-syntax",
-            "%s: Failed to parse it's LICENSE field." % (d.getVar('PF')), d)
-    # Add files from LIC_FILES_CHKSUM to list of license files
-    lic_chksum_paths = defaultdict(OrderedDict)
-    for path, data in sorted(lic_chksums.items()):
-        lic_chksum_paths[os.path.basename(path)][data] = (os.path.join(srcdir, path), data[1], data[2])
-    for basename, files in lic_chksum_paths.items():
-        if len(files) == 1:
-            # Don't copy again a LICENSE already handled as non-generic
-            if basename in non_generic_lics:
-                continue
-            data = list(files.values())[0]
-            lic_files_paths.append(tuple([basename] + list(data)))
-        else:
-            # If there are multiple different license files with identical
-            # basenames we rename them to <file>.0, <file>.1, ...
-            for i, data in enumerate(files.values()):
-                lic_files_paths.append(tuple(["%s.%d" % (basename, i)] + list(data)))
-
-    return lic_files_paths
-
-def return_spdx(d, license):
-    """
-    This function returns the spdx mapping of a license if it exists.
-     """
-    return d.getVarFlag('SPDXLICENSEMAP', license)
-
-def canonical_license(d, license):
-    """
-    Return the canonical (SPDX) form of the license if available (so GPLv3
-    becomes GPL-3.0-only) or the passed license if there is no canonical form.
-    """
-    return d.getVarFlag('SPDXLICENSEMAP', license) or license
-
-def expand_wildcard_licenses(d, wildcard_licenses):
-    """
-    There are some common wildcard values users may want to use. Support them
-    here.
-    """
-    licenses = set(wildcard_licenses)
-    mapping = {
-        "AGPL-3.0*" : ["AGPL-3.0-only", "AGPL-3.0-or-later"],
-        "GPL-3.0*" : ["GPL-3.0-only", "GPL-3.0-or-later"],
-        "LGPL-3.0*" : ["LGPL-3.0-only", "LGPL-3.0-or-later"],
-    }
-    for k in mapping:
-        if k in wildcard_licenses:
-            licenses.remove(k)
-            for item in mapping[k]:
-                licenses.add(item)
-
-    for l in licenses:
-        if l in oe.license.obsolete_license_list():
-            bb.fatal("Error, %s is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE" % l)
-        if "*" in l:
-            bb.fatal("Error, %s is an invalid license wildcard entry" % l)
-
-    return list(licenses)
-
-def incompatible_license_contains(license, truevalue, falsevalue, d):
-    license = canonical_license(d, license)
-    bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
-    bad_licenses = expand_wildcard_licenses(d, bad_licenses)
-    return truevalue if license in bad_licenses else falsevalue
-
-def incompatible_pkg_license(d, dont_want_licenses, license):
-    # Handles an "or" or two license sets provided by
-    # flattened_licenses(), pick one that works if possible.
-    def choose_lic_set(a, b):
-        return a if all(oe.license.license_ok(canonical_license(d, lic),
-                            dont_want_licenses) for lic in a) else b
-
-    try:
-        licenses = oe.license.flattened_licenses(license, choose_lic_set)
-    except oe.license.LicenseError as exc:
-        bb.fatal('%s: %s' % (d.getVar('P'), exc))
-
-    incompatible_lic = []
-    for l in licenses:
-        license = canonical_license(d, l)
-        if not oe.license.license_ok(license, dont_want_licenses):
-            incompatible_lic.append(license)
-
-    return sorted(incompatible_lic)
-
-def incompatible_license(d, dont_want_licenses, package=None):
-    """
-    This function checks if a recipe has only incompatible licenses. It also
-    take into consideration 'or' operand.  dont_want_licenses should be passed
-    as canonical (SPDX) names.
-    """
-    import oe.license
-    license = d.getVar("LICENSE:%s" % package) if package else None
-    if not license:
-        license = d.getVar('LICENSE')
-
-    return incompatible_pkg_license(d, dont_want_licenses, license)
-
-def check_license_flags(d):
-    """
-    This function checks if a recipe has any LICENSE_FLAGS that
-    aren't acceptable.
-
-    If it does, it returns the all LICENSE_FLAGS missing from the list
-    of acceptable license flags, or all of the LICENSE_FLAGS if there
-    is no list of acceptable flags.
-
-    If everything is is acceptable, it returns None.
-    """
-
-    def license_flag_matches(flag, acceptlist, pn):
-        """
-        Return True if flag matches something in acceptlist, None if not.
-
-        Before we test a flag against the acceptlist, we append _${PN}
-        to it.  We then try to match that string against the
-        acceptlist.  This covers the normal case, where we expect
-        LICENSE_FLAGS to be a simple string like 'commercial', which
-        the user typically matches exactly in the acceptlist by
-        explicitly appending the package name e.g 'commercial_foo'.
-        If we fail the match however, we then split the flag across
-        '_' and append each fragment and test until we either match or
-        run out of fragments.
-        """
-        flag_pn = ("%s_%s" % (flag, pn))
-        for candidate in acceptlist:
-            if flag_pn == candidate:
-                    return True
-
-        flag_cur = ""
-        flagments = flag_pn.split("_")
-        flagments.pop() # we've already tested the full string
-        for flagment in flagments:
-            if flag_cur:
-                flag_cur += "_"
-            flag_cur += flagment
-            for candidate in acceptlist:
-                if flag_cur == candidate:
-                    return True
-        return False
-
-    def all_license_flags_match(license_flags, acceptlist):
-        """ Return all unmatched flags, None if all flags match """
-        pn = d.getVar('PN')
-        split_acceptlist = acceptlist.split()
-        flags = []
-        for flag in license_flags.split():
-            if not license_flag_matches(flag, split_acceptlist, pn):
-                flags.append(flag)
-        return flags if flags else None
-
-    license_flags = d.getVar('LICENSE_FLAGS')
-    if license_flags:
-        acceptlist = d.getVar('LICENSE_FLAGS_ACCEPTED')
-        if not acceptlist:
-            return license_flags.split()
-        unmatched_flags = all_license_flags_match(license_flags, acceptlist)
-        if unmatched_flags:
-            return unmatched_flags
-    return None
-
-def check_license_format(d):
-    """
-    This function checks if LICENSE is well defined,
-        Validate operators in LICENSES.
-        No spaces are allowed between LICENSES.
-    """
-    pn = d.getVar('PN')
-    licenses = d.getVar('LICENSE')
-    from oe.license import license_operator, license_operator_chars, license_pattern
-
-    elements = list(filter(lambda x: x.strip(), license_operator.split(licenses)))
-    for pos, element in enumerate(elements):
-        if license_pattern.match(element):
-            if pos > 0 and license_pattern.match(elements[pos - 1]):
-                oe.qa.handle_error('license-format',
-                        '%s: LICENSE value "%s" has an invalid format - license names ' \
-                        'must be separated by the following characters to indicate ' \
-                        'the license selection: %s' %
-                        (pn, licenses, license_operator_chars), d)
-        elif not license_operator.match(element):
-            oe.qa.handle_error('license-format',
-                    '%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \
-                    'in the valid list of separators (%s)' %
-                    (pn, licenses, element, license_operator_chars), d)
-
-SSTATETASKS += "do_populate_lic"
-do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
-do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"
-
-IMAGE_CLASSES:append = " license_image"
-
-python do_populate_lic_setscene () {
-    sstate_setscene(d)
-}
-addtask do_populate_lic_setscene
diff --git a/poky/meta/classes/license_image.bbclass b/poky/meta/classes/license_image.bbclass
deleted file mode 100644
index 3213ea7..0000000
--- a/poky/meta/classes/license_image.bbclass
+++ /dev/null
@@ -1,289 +0,0 @@
-ROOTFS_LICENSE_DIR = "${IMAGE_ROOTFS}/usr/share/common-licenses"
-
-# This requires LICENSE_CREATE_PACKAGE=1 to work too
-COMPLEMENTARY_GLOB[lic-pkgs] = "*-lic"
-
-python() {
-    if not oe.data.typed_value('LICENSE_CREATE_PACKAGE', d):
-        features = set(oe.data.typed_value('IMAGE_FEATURES', d))
-        if 'lic-pkgs' in features:
-            bb.error("'lic-pkgs' in IMAGE_FEATURES but LICENSE_CREATE_PACKAGE not enabled to generate -lic packages")
-}
-
-python write_package_manifest() {
-    # Get list of installed packages
-    license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}')
-    bb.utils.mkdirhier(license_image_dir)
-    from oe.rootfs import image_list_installed_packages
-    from oe.utils import format_pkg_list
-
-    pkgs = image_list_installed_packages(d)
-    output = format_pkg_list(pkgs)
-    with open(os.path.join(license_image_dir, 'package.manifest'), "w+") as package_manifest:
-        package_manifest.write(output)
-}
-
-python license_create_manifest() {
-    import oe.packagedata
-    from oe.rootfs import image_list_installed_packages
-
-    build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS')
-    if build_images_from_feeds == "1":
-        return 0
-
-    pkg_dic = {}
-    for pkg in sorted(image_list_installed_packages(d)):
-        pkg_info = os.path.join(d.getVar('PKGDATA_DIR'),
-                                'runtime-reverse', pkg)
-        pkg_name = os.path.basename(os.readlink(pkg_info))
-
-        pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info)
-        if not "LICENSE" in pkg_dic[pkg_name].keys():
-            pkg_lic_name = "LICENSE:" + pkg_name
-            pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
-
-    rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'),
-                        d.getVar('IMAGE_NAME'), 'license.manifest')
-    write_license_files(d, rootfs_license_manifest, pkg_dic, rootfs=True)
-}
-
-def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
-    import re
-    import stat
-
-    bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split()
-    bad_licenses = expand_wildcard_licenses(d, bad_licenses)
-
-    exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split()
-    with open(license_manifest, "w") as license_file:
-        for pkg in sorted(pkg_dic):
-            remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions)
-            incompatible_licenses = incompatible_pkg_license(d, remaining_bad_licenses, pkg_dic[pkg]["LICENSE"])
-            if incompatible_licenses:
-                bb.fatal("Package %s cannot be installed into the image because it has incompatible license(s): %s" %(pkg, ' '.join(incompatible_licenses)))
-            else:
-                incompatible_licenses = incompatible_pkg_license(d, bad_licenses, pkg_dic[pkg]["LICENSE"])
-                if incompatible_licenses:
-                    oe.qa.handle_error('license-incompatible', "Including %s with incompatible license(s) %s into the image, because it has been allowed by exception list." %(pkg, ' '.join(incompatible_licenses)), d)
-            try:
-                (pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \
-                    oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"],
-                    remaining_bad_licenses, canonical_license, d)
-            except oe.license.LicenseError as exc:
-                bb.fatal('%s: %s' % (d.getVar('P'), exc))
-
-            if not "IMAGE_MANIFEST" in pkg_dic[pkg]:
-                # Rootfs manifest
-                license_file.write("PACKAGE NAME: %s\n" % pkg)
-                license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
-                license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
-                license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
-
-                # If the package doesn't contain any file, that is, its size is 0, the license
-                # isn't relevant as far as the final image is concerned. So doing license check
-                # doesn't make much sense, skip it.
-                if pkg_dic[pkg]["PKGSIZE:%s" % pkg] == "0":
-                    continue
-            else:
-                # Image manifest
-                license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
-                license_file.write("VERSION: %s\n" % pkg_dic[pkg]["PV"])
-                license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
-                license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
-
-            for lic in pkg_dic[pkg]["LICENSES"]:
-                lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
-                                        pkg_dic[pkg]["PN"], "generic_%s" % 
-                                        re.sub(r'\+', '', lic))
-                # add explicity avoid of CLOSED license because isn't generic
-                if lic == "CLOSED":
-                   continue
-
-                if not os.path.exists(lic_file):
-                    oe.qa.handle_error('license-file-missing',
-                                       "The license listed %s was not in the "\
-                                       "licenses collected for recipe %s"
-                                       % (lic, pkg_dic[pkg]["PN"]), d)
-    oe.qa.exit_if_errors(d)
-
-    # Two options here:
-    # - Just copy the manifest
-    # - Copy the manifest and the license directories
-    # With both options set we see a .5 M increase in core-image-minimal
-    copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST')
-    copy_lic_dirs = d.getVar('COPY_LIC_DIRS')
-    if rootfs and copy_lic_manifest == "1":
-        rootfs_license_dir = d.getVar('ROOTFS_LICENSE_DIR')
-        bb.utils.mkdirhier(rootfs_license_dir)
-        rootfs_license_manifest = os.path.join(rootfs_license_dir,
-                os.path.split(license_manifest)[1])
-        if not os.path.exists(rootfs_license_manifest):
-            oe.path.copyhardlink(license_manifest, rootfs_license_manifest)
-
-        if copy_lic_dirs == "1":
-            for pkg in sorted(pkg_dic):
-                pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg)
-                bb.utils.mkdirhier(pkg_rootfs_license_dir)
-                pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
-                                            pkg_dic[pkg]["PN"]) 
-
-                pkg_manifest_licenses = [canonical_license(d, lic) \
-                        for lic in pkg_dic[pkg]["LICENSES"]]
-
-                licenses = os.listdir(pkg_license_dir)
-                for lic in licenses:
-                    pkg_license = os.path.join(pkg_license_dir, lic)
-                    pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
-
-                    if re.match(r"^generic_.*$", lic):
-                        generic_lic = canonical_license(d,
-                                re.search(r"^generic_(.*)$", lic).group(1))
-
-                        # Do not copy generic license into package if isn't
-                        # declared into LICENSES of the package.
-                        if not re.sub(r'\+$', '', generic_lic) in \
-                                [re.sub(r'\+', '', lic) for lic in \
-                                 pkg_manifest_licenses]:
-                            continue
-
-                        if oe.license.license_ok(generic_lic,
-                                bad_licenses) == False:
-                            continue
-
-                        # Make sure we use only canonical name for the license file
-                        generic_lic_file = "generic_%s" % generic_lic
-                        rootfs_license = os.path.join(rootfs_license_dir, generic_lic_file)
-                        if not os.path.exists(rootfs_license):
-                            oe.path.copyhardlink(pkg_license, rootfs_license)
-
-                        if not os.path.exists(pkg_rootfs_license):
-                            os.symlink(os.path.join('..', generic_lic_file), pkg_rootfs_license)
-                    else:
-                        if (oe.license.license_ok(canonical_license(d,
-                                lic), bad_licenses) == False or
-                                os.path.exists(pkg_rootfs_license)):
-                            continue
-
-                        oe.path.copyhardlink(pkg_license, pkg_rootfs_license)
-            # Fixup file ownership and permissions
-            for walkroot, dirs, files in os.walk(rootfs_license_dir):
-                for f in files:
-                    p = os.path.join(walkroot, f)
-                    os.lchown(p, 0, 0)
-                    if not os.path.islink(p):
-                        os.chmod(p, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
-                for dir in dirs:
-                    p = os.path.join(walkroot, dir)
-                    os.lchown(p, 0, 0)
-                    os.chmod(p, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
-
-
-
-def license_deployed_manifest(d):
-    """
-    Write the license manifest for the deployed recipes.
-    The deployed recipes usually includes the bootloader
-    and extra files to boot the target.
-    """
-
-    dep_dic = {}
-    man_dic = {}
-    lic_dir = d.getVar("LICENSE_DIRECTORY")
-
-    dep_dic = get_deployed_dependencies(d)
-    for dep in dep_dic.keys():
-        man_dic[dep] = {}
-        # It is necessary to mark this will be used for image manifest
-        man_dic[dep]["IMAGE_MANIFEST"] = True
-        man_dic[dep]["PN"] = dep
-        man_dic[dep]["FILES"] = \
-            " ".join(get_deployed_files(dep_dic[dep]))
-        with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
-            for line in f.readlines():
-                key,val = line.split(": ", 1)
-                man_dic[dep][key] = val[:-1]
-
-    lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
-                                    d.getVar('IMAGE_NAME'))
-    bb.utils.mkdirhier(lic_manifest_dir)
-    image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest')
-    write_license_files(d, image_license_manifest, man_dic, rootfs=False)
-
-    link_name = d.getVar('IMAGE_LINK_NAME')
-    if link_name:
-        lic_manifest_symlink_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
-                                    link_name)
-        # remove old symlink
-        if os.path.islink(lic_manifest_symlink_dir):
-            os.unlink(lic_manifest_symlink_dir)
-
-        # create the image dir symlink
-        if lic_manifest_dir != lic_manifest_symlink_dir:
-            os.symlink(lic_manifest_dir, lic_manifest_symlink_dir)
-
-def get_deployed_dependencies(d):
-    """
-    Get all the deployed dependencies of an image
-    """
-
-    deploy = {}
-    # Get all the dependencies for the current task (rootfs).
-    taskdata = d.getVar("BB_TASKDEPDATA", False)
-    pn = d.getVar("PN", True)
-    depends = list(set([dep[0] for dep
-                    in list(taskdata.values())
-                    if not dep[0].endswith("-native") and not dep[0] == pn]))
-
-    # To verify what was deployed it checks the rootfs dependencies against
-    # the SSTATE_MANIFESTS for "deploy" task.
-    # The manifest file name contains the arch. Because we are not running
-    # in the recipe context it is necessary to check every arch used.
-    sstate_manifest_dir = d.getVar("SSTATE_MANIFESTS")
-    archs = list(set(d.getVar("SSTATE_ARCHS").split()))
-    for dep in depends:
-        for arch in archs:
-            sstate_manifest_file = os.path.join(sstate_manifest_dir,
-                    "manifest-%s-%s.deploy" % (arch, dep))
-            if os.path.exists(sstate_manifest_file):
-                deploy[dep] = sstate_manifest_file
-                break
-
-    return deploy
-get_deployed_dependencies[vardepsexclude] = "BB_TASKDEPDATA"
-
-def get_deployed_files(man_file):
-    """
-    Get the files deployed from the sstate manifest
-    """
-
-    dep_files = []
-    excluded_files = []
-    with open(man_file, "r") as manifest:
-        all_files = manifest.read()
-    for f in all_files.splitlines():
-        if ((not (os.path.islink(f) or os.path.isdir(f))) and
-                not os.path.basename(f) in excluded_files):
-            dep_files.append(os.path.basename(f))
-    return dep_files
-
-ROOTFS_POSTPROCESS_COMMAND:prepend = "write_package_manifest; license_create_manifest; "
-do_rootfs[recrdeptask] += "do_populate_lic"
-
-python do_populate_lic_deploy() {
-    license_deployed_manifest(d)
-    oe.qa.exit_if_errors(d)
-}
-
-addtask populate_lic_deploy before do_build after do_image_complete
-do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy"
-
-python license_qa_dead_symlink() {
-    import os
-
-    for root, dirs, files in os.walk(d.getVar('ROOTFS_LICENSE_DIR')):
-        for file in files:
-            full_path = root + "/" + file
-            if os.path.islink(full_path) and not os.path.exists(full_path):
-                bb.error("broken symlink: " + full_path)
-}
-IMAGE_QA_COMMANDS += "license_qa_dead_symlink"
diff --git a/poky/meta/classes/linux-dummy.bbclass b/poky/meta/classes/linux-dummy.bbclass
deleted file mode 100644
index 9a06a50..0000000
--- a/poky/meta/classes/linux-dummy.bbclass
+++ /dev/null
@@ -1,26 +0,0 @@
-
-python __anonymous () {
-    if d.getVar('PREFERRED_PROVIDER_virtual/kernel') == 'linux-dummy':
-        # copy part codes from kernel.bbclass
-        kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
-
-        # set an empty package of kernel-devicetree
-        d.appendVar('PACKAGES', ' %s-devicetree' % kname)
-        d.setVar('ALLOW_EMPTY:%s-devicetree' % kname, '1')
-
-        # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
-        type = d.getVar('KERNEL_IMAGETYPE') or ""
-        alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
-        types = d.getVar('KERNEL_IMAGETYPES') or ""
-        if type not in types.split():
-            types = (type + ' ' + types).strip()
-        if alttype not in types.split():
-            types = (alttype + ' ' + types).strip()
-
-        # set empty packages of kernel-image-*
-        for type in types.split():
-            typelower = type.lower()
-            d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
-            d.setVar('ALLOW_EMPTY:%s-image-%s' % (kname, typelower), '1')
-}
-
diff --git a/poky/meta/classes/linux-kernel-base.bbclass b/poky/meta/classes/linux-kernel-base.bbclass
deleted file mode 100644
index ba59222..0000000
--- a/poky/meta/classes/linux-kernel-base.bbclass
+++ /dev/null
@@ -1,41 +0,0 @@
-# parse kernel ABI version out of <linux/version.h>
-def get_kernelversion_headers(p):
-    import re
-
-    fn = p + '/include/linux/utsrelease.h'
-    if not os.path.isfile(fn):
-        # after 2.6.33-rc1
-        fn = p + '/include/generated/utsrelease.h'
-    if not os.path.isfile(fn):
-        fn = p + '/include/linux/version.h'
-
-    try:
-        f = open(fn, 'r')
-    except IOError:
-        return None
-
-    l = f.readlines()
-    f.close()
-    r = re.compile("#define UTS_RELEASE \"(.*)\"")
-    for s in l:
-        m = r.match(s)
-        if m:
-            return m.group(1)
-    return None
-
-
-def get_kernelversion_file(p):
-    fn = p + '/kernel-abiversion'
-
-    try:
-        with open(fn, 'r') as f:
-            return f.readlines()[0].strip()
-    except IOError:
-        return None
-
-def linux_module_packages(s, d):
-    suffix = ""
-    return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split()))
-
-# that's all
-
diff --git a/poky/meta/classes/linuxloader.bbclass b/poky/meta/classes/linuxloader.bbclass
deleted file mode 100644
index 4447c88..0000000
--- a/poky/meta/classes/linuxloader.bbclass
+++ /dev/null
@@ -1,76 +0,0 @@
-def get_musl_loader_arch(d):
-    import re
-    ldso_arch = "NotSupported"
-
-    targetarch = d.getVar("TARGET_ARCH")
-    if targetarch.startswith("microblaze"):
-        ldso_arch = "microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el', d)}"
-    elif targetarch.startswith("mips"):
-        ldso_arch = "mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
-    elif targetarch == "powerpc":
-        ldso_arch = "powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
-    elif targetarch.startswith("powerpc64"):
-        ldso_arch = "powerpc64${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'le', d)}"
-    elif targetarch == "x86_64":
-        ldso_arch = "x86_64"
-    elif re.search("i.86", targetarch):
-        ldso_arch = "i386"
-    elif targetarch.startswith("arm"):
-        ldso_arch = "arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}"
-    elif targetarch.startswith("aarch64"):
-        ldso_arch = "aarch64${ARMPKGSFX_ENDIAN_64}"
-    elif targetarch.startswith("riscv64"):
-        ldso_arch = "riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
-    elif targetarch.startswith("riscv32"):
-        ldso_arch = "riscv32${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
-    return ldso_arch
-
-def get_musl_loader(d):
-    import re
-    return "/lib/ld-musl-" + get_musl_loader_arch(d) + ".so.1"
-
-def get_glibc_loader(d):
-    import re
-
-    dynamic_loader = "NotSupported"
-    targetarch = d.getVar("TARGET_ARCH")
-    if targetarch in ["powerpc", "microblaze"]:
-        dynamic_loader = "${base_libdir}/ld.so.1"
-    elif targetarch in ["mipsisa32r6el", "mipsisa32r6", "mipsisa64r6el", "mipsisa64r6"]:
-        dynamic_loader = "${base_libdir}/ld-linux-mipsn8.so.1"
-    elif targetarch.startswith("mips"):
-        dynamic_loader = "${base_libdir}/ld.so.1"
-    elif targetarch == "powerpc64le":
-        dynamic_loader = "${base_libdir}/ld64.so.2"
-    elif targetarch == "powerpc64":
-        dynamic_loader = "${base_libdir}/ld64.so.1"
-    elif targetarch == "x86_64":
-        dynamic_loader = "${base_libdir}/ld-linux-x86-64.so.2"
-    elif re.search("i.86", targetarch):
-        dynamic_loader = "${base_libdir}/ld-linux.so.2"
-    elif targetarch == "arm":
-        dynamic_loader = "${base_libdir}/ld-linux${@['-armhf', ''][d.getVar('TARGET_FPU') == 'soft']}.so.3"
-    elif targetarch.startswith("aarch64"):
-        dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
-    elif targetarch.startswith("riscv64"):
-        dynamic_loader = "${base_libdir}/ld-linux-riscv64-lp64${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
-    elif targetarch.startswith("riscv32"):
-        dynamic_loader = "${base_libdir}/ld-linux-riscv32-ilp32${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
-    return dynamic_loader
-
-def get_linuxloader(d):
-    overrides = d.getVar("OVERRIDES").split(":")
-
-    if "libc-baremetal" in overrides:
-        return "NotSupported"
-
-    if "libc-musl" in overrides:
-        dynamic_loader = get_musl_loader(d)
-    else:
-        dynamic_loader = get_glibc_loader(d)
-    return dynamic_loader
-
-get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}"
-get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}"
-get_musl_loader_arch[vardepvalue] = "${@get_musl_loader_arch(d)}"
-get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}"
diff --git a/poky/meta/classes/live-vm-common.bbclass b/poky/meta/classes/live-vm-common.bbclass
deleted file mode 100644
index 74e7074..0000000
--- a/poky/meta/classes/live-vm-common.bbclass
+++ /dev/null
@@ -1,94 +0,0 @@
-# Some of the vars for vm and live image are conflicted, this function
-# is used for fixing the problem.
-def set_live_vm_vars(d, suffix):
-    vars = ['GRUB_CFG', 'SYSLINUX_CFG', 'ROOT', 'LABELS', 'INITRD']
-    for var in vars:
-        var_with_suffix = var + '_' + suffix
-        if d.getVar(var):
-            bb.warn('Found potential conflicted var %s, please use %s rather than %s' % \
-                (var, var_with_suffix, var))
-        elif d.getVar(var_with_suffix):
-            d.setVar(var, d.getVar(var_with_suffix))
-
-
-EFI = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
-EFI_PROVIDER ?= "grub-efi"
-EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
-
-MKDOSFS_EXTRAOPTS ??= "-S 512"
-
-# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
-# contain "efi". This way legacy is supported by default if neither is
-# specified, maintaining the original behavior.
-def pcbios(d):
-    pcbios = bb.utils.contains("MACHINE_FEATURES", "pcbios", "1", "0", d)
-    if pcbios == "0":
-        pcbios = bb.utils.contains("MACHINE_FEATURES", "efi", "0", "1", d)
-    return pcbios
-
-PCBIOS = "${@pcbios(d)}"
-PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS') == '1']}"
-
-# efi_populate_common DEST BOOTLOADER
-efi_populate_common() {
-        # DEST must be the root of the image so that EFIDIR is not
-        # nested under a top level directory.
-        DEST=$1
-
-        install -d ${DEST}${EFIDIR}
-
-        install -m 0644 ${DEPLOY_DIR_IMAGE}/$2-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE}
-        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-        printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
-}
-
-efi_iso_populate() {
-        iso_dir=$1
-        efi_populate $iso_dir
-        # Build a EFI directory to create efi.img
-        mkdir -p ${EFIIMGDIR}/${EFIDIR}
-        cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
-        cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
-
-        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-        printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${EFIIMGDIR}/startup.nsh
-
-        if [ -f "$iso_dir/initrd" ] ; then
-                cp $iso_dir/initrd ${EFIIMGDIR}
-        fi
-}
-
-efi_hddimg_populate() {
-	efi_populate $1
-}
-
-inherit ${EFI_CLASS}
-inherit ${PCBIOS_CLASS}
-
-populate_kernel() {
-	dest=$1
-	install -d $dest
-
-	# Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
-	bbnote "Trying to install ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} as $dest/${KERNEL_IMAGETYPE}"
-	if [ -e ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ]; then
-		install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} $dest/${KERNEL_IMAGETYPE}
-	else
-		bbwarn "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} doesn't exist"
-	fi
-
-	# initrd is made of concatenation of multiple filesystem images
-	if [ -n "${INITRD}" ]; then
-		rm -f $dest/initrd
-		for fs in ${INITRD}
-		do
-			if [ -s "$fs" ]; then
-				cat $fs >> $dest/initrd
-			else
-				bbfatal "$fs is invalid. initrd image creation failed."
-			fi
-		done
-		chmod 0644 $dest/initrd
-	fi
-}
-
diff --git a/poky/meta/classes/logging.bbclass b/poky/meta/classes/logging.bbclass
deleted file mode 100644
index a0c94e9..0000000
--- a/poky/meta/classes/logging.bbclass
+++ /dev/null
@@ -1,101 +0,0 @@
-# The following logging mechanisms are to be used in bash functions of recipes.
-# They are intended to map one to one in intention and output format with the
-# python recipe logging functions of a similar naming convention: bb.plain(),
-# bb.note(), etc.
-
-LOGFIFO = "${T}/fifo.${@os.getpid()}"
-
-# Print the output exactly as it is passed in. Typically used for output of
-# tasks that should be seen on the console. Use sparingly.
-# Output: logs console
-bbplain() {
-	if [ -p ${LOGFIFO} ] ; then
-		printf "%b\0" "bbplain $*" > ${LOGFIFO}
-	else
-		echo "$*"
-	fi
-}
-
-# Notify the user of a noteworthy condition. 
-# Output: logs
-bbnote() {
-	if [ -p ${LOGFIFO} ] ; then
-		printf "%b\0" "bbnote $*" > ${LOGFIFO}
-	else
-		echo "NOTE: $*"
-	fi
-}
-
-# Print a warning to the log. Warnings are non-fatal, and do not
-# indicate a build failure.
-# Output: logs console
-bbwarn() {
-	if [ -p ${LOGFIFO} ] ; then
-		printf "%b\0" "bbwarn $*" > ${LOGFIFO}
-	else
-		echo "WARNING: $*"
-	fi
-}
-
-# Print an error to the log. Errors are non-fatal in that the build can
-# continue, but they do indicate a build failure.
-# Output: logs console
-bberror() {
-	if [ -p ${LOGFIFO} ] ; then
-		printf "%b\0" "bberror $*" > ${LOGFIFO}
-	else
-		echo "ERROR: $*"
-	fi
-}
-
-# Print a fatal error to the log. Fatal errors indicate build failure
-# and halt the build, exiting with an error code.
-# Output: logs console
-bbfatal() {
-	if [ -p ${LOGFIFO} ] ; then
-		printf "%b\0" "bbfatal $*" > ${LOGFIFO}
-	else
-		echo "ERROR: $*"
-	fi
-	exit 1
-}
-
-# Like bbfatal, except prevents the suppression of the error log by
-# bitbake's UI.
-# Output: logs console
-bbfatal_log() {
-	if [ -p ${LOGFIFO} ] ; then
-		printf "%b\0" "bbfatal_log $*" > ${LOGFIFO}
-	else
-		echo "ERROR: $*"
-	fi
-	exit 1
-}
-
-# Print debug messages. These are appropriate for progress checkpoint
-# messages to the logs. Depending on the debug log level, they may also
-# go to the console.
-# Output: logs console
-# Usage: bbdebug 1 "first level debug message"
-#        bbdebug 2 "second level debug message"
-bbdebug() {
-	USAGE='Usage: bbdebug [123] "message"'
-	if [ $# -lt 2 ]; then
-		bbfatal "$USAGE"
-	fi
-	
-	# Strip off the debug level and ensure it is an integer
-	DBGLVL=$1; shift
-	NONDIGITS=$(echo "$DBGLVL" | tr -d "[:digit:]")
-	if [ "$NONDIGITS" ]; then
-		bbfatal "$USAGE"
-	fi
-
-	# All debug output is printed to the logs
-	if [ -p ${LOGFIFO} ] ; then
-		printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO}
-	else
-		echo "DEBUG: $*"
-	fi
-}
-
diff --git a/poky/meta/classes/manpages.bbclass b/poky/meta/classes/manpages.bbclass
deleted file mode 100644
index 5e09c77..0000000
--- a/poky/meta/classes/manpages.bbclass
+++ /dev/null
@@ -1,45 +0,0 @@
-# Inherit this class to enable or disable building and installation of manpages
-# depending on whether 'api-documentation' is in DISTRO_FEATURES. Such building
-# tends to pull in the entire XML stack and other tools, so it's not enabled
-# by default.
-PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
-
-inherit qemu
-
-# usually manual files are packaged to ${PN}-doc except man-pages
-MAN_PKG ?= "${PN}-doc"
-
-# only add man-db to RDEPENDS when manual files are built and installed
-RDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
-
-pkg_postinst:${MAN_PKG}:append () {
-	# only update manual page index caches when manual files are built and installed
-	if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
-		if test -n "$D"; then
-			if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
-				sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir}
-				chown -R root:root $D${mandir}
-
-				mkdir -p $D${localstatedir}/cache/man
-				cd $D${mandir}
-				find . -name index.db | while read index; do
-					mkdir -p $D${localstatedir}/cache/man/$(dirname ${index})
-					mv ${index} $D${localstatedir}/cache/man/${index}
-					chown man:man $D${localstatedir}/cache/man/${index}
-				done
-				cd -
-			else
-				$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
-			fi
-		else
-			mandb -q
-		fi
-	fi
-}
-
-pkg_postrm:${MAN_PKG}:append () {
-	# only update manual page index caches when manual files are built and installed
-	if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
-		mandb -q
-	fi
-}
diff --git a/poky/meta/classes/mcextend.bbclass b/poky/meta/classes/mcextend.bbclass
index 0f8f962..a489eeb 100644
--- a/poky/meta/classes/mcextend.bbclass
+++ b/poky/meta/classes/mcextend.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 python mcextend_virtclass_handler () {
     cls = e.data.getVar("BBEXTENDCURR")
     variant = e.data.getVar("BBEXTENDVARIANT")
diff --git a/poky/meta/classes/meson-routines.bbclass b/poky/meta/classes/meson-routines.bbclass
deleted file mode 100644
index be3aeed..0000000
--- a/poky/meta/classes/meson-routines.bbclass
+++ /dev/null
@@ -1,51 +0,0 @@
-inherit siteinfo
-
-def meson_array(var, d):
-    items = d.getVar(var).split()
-    return repr(items[0] if len(items) == 1 else items)
-
-# Map our ARCH values to what Meson expects:
-# http://mesonbuild.com/Reference-tables.html#cpu-families
-def meson_cpu_family(var, d):
-    import re
-    arch = d.getVar(var)
-    if arch == 'powerpc':
-        return 'ppc'
-    elif arch == 'powerpc64' or arch == 'powerpc64le':
-        return 'ppc64'
-    elif arch == 'armeb':
-        return 'arm'
-    elif arch == 'aarch64_be':
-        return 'aarch64'
-    elif arch == 'mipsel':
-        return 'mips'
-    elif arch == 'mips64el':
-        return 'mips64'
-    elif re.match(r"i[3-6]86", arch):
-        return "x86"
-    elif arch == "microblazeel":
-        return "microblaze"
-    else:
-        return arch
-
-# Map our OS values to what Meson expects:
-# https://mesonbuild.com/Reference-tables.html#operating-system-names
-def meson_operating_system(var, d):
-    os = d.getVar(var)
-    if "mingw" in os:
-        return "windows"
-    # avoid e.g 'linux-gnueabi'
-    elif "linux" in os:
-        return "linux"
-    else:
-        return os
-
-def meson_endian(prefix, d):
-    arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
-    sitedata = siteinfo_data_for_machine(arch, os, d)
-    if "endian-little" in sitedata:
-        return "little"
-    elif "endian-big" in sitedata:
-        return "big"
-    else:
-        bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
diff --git a/poky/meta/classes/meson.bbclass b/poky/meta/classes/meson.bbclass
deleted file mode 100644
index 546cd04..0000000
--- a/poky/meta/classes/meson.bbclass
+++ /dev/null
@@ -1,173 +0,0 @@
-inherit python3native meson-routines qemu
-
-DEPENDS:append = " meson-native ninja-native"
-
-EXEWRAPPER_ENABLED:class-native = "False"
-EXEWRAPPER_ENABLED:class-nativesdk = "False"
-EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}"
-DEPENDS:append = "${@' qemu-native' if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ''}"
-
-# As Meson enforces out-of-tree builds we can just use cleandirs
-B = "${WORKDIR}/build"
-do_configure[cleandirs] = "${B}"
-
-# Where the meson.build build configuration is
-MESON_SOURCEPATH = "${S}"
-
-def noprefix(var, d):
-    return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1)
-
-MESON_BUILDTYPE ?= "${@oe.utils.vartrue('DEBUG_BUILD', 'debug', 'plain', d)}"
-MESON_BUILDTYPE[vardeps] += "DEBUG_BUILD"
-MESONOPTS = " --prefix ${prefix} \
-              --buildtype ${MESON_BUILDTYPE} \
-              --bindir ${@noprefix('bindir', d)} \
-              --sbindir ${@noprefix('sbindir', d)} \
-              --datadir ${@noprefix('datadir', d)} \
-              --libdir ${@noprefix('libdir', d)} \
-              --libexecdir ${@noprefix('libexecdir', d)} \
-              --includedir ${@noprefix('includedir', d)} \
-              --mandir ${@noprefix('mandir', d)} \
-              --infodir ${@noprefix('infodir', d)} \
-              --sysconfdir ${sysconfdir} \
-              --localstatedir ${localstatedir} \
-              --sharedstatedir ${sharedstatedir} \
-              --wrap-mode nodownload \
-              --native-file ${WORKDIR}/meson.native"
-
-EXTRA_OEMESON:append = " ${PACKAGECONFIG_CONFARGS}"
-
-MESON_CROSS_FILE = ""
-MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross"
-MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"
-
-# Needed to set up qemu wrapper below
-export STAGING_DIR_HOST
-
-def rust_tool(d, target_var):
-    rustc = d.getVar('RUSTC')
-    if not rustc:
-        return ""
-    cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split()
-    return "rust = %s" % repr(cmd)
-
-addtask write_config before do_configure
-do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS"
-do_write_config() {
-    # This needs to be Py to split the args into single-element lists
-    cat >${WORKDIR}/meson.cross <<EOF
-[binaries]
-c = ${@meson_array('CC', d)}
-cpp = ${@meson_array('CXX', d)}
-cython = 'cython3'
-ar = ${@meson_array('AR', d)}
-nm = ${@meson_array('NM', d)}
-strip = ${@meson_array('STRIP', d)}
-readelf = ${@meson_array('READELF', d)}
-objcopy = ${@meson_array('OBJCOPY', d)}
-pkgconfig = 'pkg-config'
-llvm-config = 'llvm-config${LLVMVERSION}'
-cups-config = 'cups-config'
-g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper'
-g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper'
-${@rust_tool(d, "HOST_SYS")}
-${@"exe_wrapper = '${WORKDIR}/meson-qemuwrapper'" if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ""}
-
-[built-in options]
-c_args = ${@meson_array('CFLAGS', d)}
-c_link_args = ${@meson_array('LDFLAGS', d)}
-cpp_args = ${@meson_array('CXXFLAGS', d)}
-cpp_link_args = ${@meson_array('LDFLAGS', d)}
-
-[properties]
-needs_exe_wrapper = true
-
-[host_machine]
-system = '${@meson_operating_system('HOST_OS', d)}'
-cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
-cpu = '${HOST_ARCH}'
-endian = '${@meson_endian('HOST', d)}'
-
-[target_machine]
-system = '${@meson_operating_system('TARGET_OS', d)}'
-cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
-cpu = '${TARGET_ARCH}'
-endian = '${@meson_endian('TARGET', d)}'
-EOF
-
-    cat >${WORKDIR}/meson.native <<EOF
-[binaries]
-c = ${@meson_array('BUILD_CC', d)}
-cpp = ${@meson_array('BUILD_CXX', d)}
-cython = 'cython3'
-ar = ${@meson_array('BUILD_AR', d)}
-nm = ${@meson_array('BUILD_NM', d)}
-strip = ${@meson_array('BUILD_STRIP', d)}
-readelf = ${@meson_array('BUILD_READELF', d)}
-objcopy = ${@meson_array('BUILD_OBJCOPY', d)}
-pkgconfig = 'pkg-config-native'
-${@rust_tool(d, "BUILD_SYS")}
-
-[built-in options]
-c_args = ${@meson_array('BUILD_CFLAGS', d)}
-c_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
-cpp_args = ${@meson_array('BUILD_CXXFLAGS', d)}
-cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
-EOF
-}
-
-do_write_config:append:class-target() {
-    # Write out a qemu wrapper that will be used as exe_wrapper so that meson
-    # can run target helper binaries through that.
-    qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
-    cat > ${WORKDIR}/meson-qemuwrapper << EOF
-#!/bin/sh
-# Use a modules directory which doesn't exist so we don't load random things
-# which may then get deleted (or their dependencies) and potentially segfault
-export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
-
-# meson sets this wrongly (only to libs in build-dir), qemu_wrapper_cmdline() and GIR_EXTRA_LIBS_PATH take care of it properly
-unset LD_LIBRARY_PATH
-
-$qemu_binary "\$@"
-EOF
-    chmod +x ${WORKDIR}/meson-qemuwrapper
-}
-
-# Tell externalsrc that changes to this file require a reconfigure
-CONFIGURE_FILES = "meson.build"
-
-meson_do_configure() {
-    # Meson requires this to be 'bfd, 'lld' or 'gold' from 0.53 onwards
-    # https://github.com/mesonbuild/meson/commit/ef9aeb188ea2bc7353e59916c18901cde90fa2b3
-    unset LD
-
-    # Work around "Meson fails if /tmp is mounted with noexec #2972"
-    mkdir -p "${B}/meson-private/tmp"
-    export TMPDIR="${B}/meson-private/tmp"
-    bbnote Executing meson ${EXTRA_OEMESON}...
-    if ! meson ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON}; then
-        bbfatal_log meson failed
-    fi
-}
-
-python meson_do_qa_configure() {
-    import re
-    warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE)
-    with open(d.expand("${B}/meson-logs/meson-log.txt")) as logfile:
-        log = logfile.read()
-    for (prop, value) in warn_re.findall(log):
-        bb.warn("Meson cross property %s used without explicit assignment, defaulting to %s" % (prop, value))
-}
-do_configure[postfuncs] += "meson_do_qa_configure"
-
-do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
-meson_do_compile() {
-    ninja -v ${PARALLEL_MAKE}
-}
-
-meson_do_install() {
-    DESTDIR='${D}' ninja -v ${PARALLEL_MAKEINST} install
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/metadata_scm.bbclass b/poky/meta/classes/metadata_scm.bbclass
index f646b31..6842119 100644
--- a/poky/meta/classes/metadata_scm.bbclass
+++ b/poky/meta/classes/metadata_scm.bbclass
@@ -1,3 +1,8 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
 
 METADATA_BRANCH := "${@oe.buildcfg.detect_branch(d)}"
 METADATA_BRANCH[vardepvalue] = "${METADATA_BRANCH}"
diff --git a/poky/meta/classes/migrate_localcount.bbclass b/poky/meta/classes/migrate_localcount.bbclass
index 810a541..1d00c11 100644
--- a/poky/meta/classes/migrate_localcount.bbclass
+++ b/poky/meta/classes/migrate_localcount.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 PRSERV_DUMPDIR ??= "${LOG_DIR}/db"
 LOCALCOUNT_DUMPFILE ??= "${PRSERV_DUMPDIR}/prserv-localcount-exports.inc"
 
diff --git a/poky/meta/classes/mime-xdg.bbclass b/poky/meta/classes/mime-xdg.bbclass
deleted file mode 100644
index 271f48d..0000000
--- a/poky/meta/classes/mime-xdg.bbclass
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# This class creates mime <-> application associations based on entry 
-# 'MimeType' in *.desktop files
-#
-
-DEPENDS += "desktop-file-utils"
-PACKAGE_WRITE_DEPS += "desktop-file-utils-native"
-DESKTOPDIR = "${datadir}/applications"
-
-# There are recipes out there installing their .desktop files as absolute
-# symlinks. For us these are dangling and cannot be introspected for "MimeType"
-# easily. By addding package-names to MIME_XDG_PACKAGES, packager can force
-# proper update-desktop-database handling. Note that all introspection is
-# skipped for MIME_XDG_PACKAGES not empty
-MIME_XDG_PACKAGES ?= ""
-
-mime_xdg_postinst() {
-if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_desktop_database ${PKG} \
-		mlprefix=${MLPREFIX} \
-		desktop_dir=${DESKTOPDIR}
-else
-	update-desktop-database $D${DESKTOPDIR}
-fi
-}
-
-mime_xdg_postrm() {
-if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_desktop_database ${PKG} \
-		mlprefix=${MLPREFIX} \
-		desktop_dir=${DESKTOPDIR}
-else
-	update-desktop-database $D${DESKTOPDIR}
-fi
-}
-
-python populate_packages:append () {
-    packages = d.getVar('PACKAGES').split()
-    pkgdest =  d.getVar('PKGDEST')
-    desktop_base = d.getVar('DESKTOPDIR')
-    forced_mime_xdg_pkgs = (d.getVar('MIME_XDG_PACKAGES') or '').split()
-
-    for pkg in packages:
-        desktops_with_mime_found = pkg in forced_mime_xdg_pkgs
-        if d.getVar('MIME_XDG_PACKAGES') == '':
-            desktop_dir = '%s/%s%s' % (pkgdest, pkg, desktop_base)
-            if os.path.exists(desktop_dir):
-                for df in os.listdir(desktop_dir):
-                    if df.endswith('.desktop'):
-                        try:
-                            with open(desktop_dir + '/'+ df, 'r') as f:
-                                for line in f.read().split('\n'):
-                                    if 'MimeType' in line:
-                                        desktops_with_mime_found = True
-                                        break;
-                        except:
-                            bb.warn('Could not open %s. Set MIME_XDG_PACKAGES in recipe or add mime-xdg to INSANE_SKIP.' % desktop_dir + '/'+ df)
-                    if desktops_with_mime_found:
-                        break
-        if desktops_with_mime_found:
-            bb.note("adding mime-xdg postinst and postrm scripts to %s" % pkg)
-            postinst = d.getVar('pkg_postinst:%s' % pkg)
-            if not postinst:
-                postinst = '#!/bin/sh\n'
-            postinst += d.getVar('mime_xdg_postinst')
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-            postrm = d.getVar('pkg_postrm:%s' % pkg)
-            if not postrm:
-                postrm = '#!/bin/sh\n'
-            postrm += d.getVar('mime_xdg_postrm')
-            d.setVar('pkg_postrm:%s' % pkg, postrm)
-            bb.note("adding desktop-file-utils dependency to %s" % pkg)
-            d.appendVar('RDEPENDS:' + pkg, " " + d.getVar('MLPREFIX')+"desktop-file-utils")
-}
diff --git a/poky/meta/classes/mime.bbclass b/poky/meta/classes/mime.bbclass
deleted file mode 100644
index 8d176a8..0000000
--- a/poky/meta/classes/mime.bbclass
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# This class is used by recipes installing mime types
-#
-
-DEPENDS += "${@bb.utils.contains('BPN', 'shared-mime-info', '', 'shared-mime-info', d)}"
-PACKAGE_WRITE_DEPS += "shared-mime-info-native"
-MIMEDIR = "${datadir}/mime"
-
-mime_postinst() {
-if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
-		mlprefix=${MLPREFIX} \
-		mimedir=${MIMEDIR}
-else
-	echo "Updating MIME database... this may take a while."
-	update-mime-database $D${MIMEDIR}
-fi
-}
-
-mime_postrm() {
-if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
-		mlprefix=${MLPREFIX} \
-		mimedir=${MIMEDIR}
-else
-	echo "Updating MIME database... this may take a while."
-	# $D${MIMEDIR}/packages belong to package shared-mime-info-data,
-	# packages like libfm-mime depend on shared-mime-info-data.
-	# after shared-mime-info-data uninstalled, $D${MIMEDIR}/packages
-	# is removed, but update-mime-database need this dir to update
-	# database, workaround to create one and remove it later
-	if [ ! -d $D${MIMEDIR}/packages ]; then
-		mkdir -p $D${MIMEDIR}/packages
-		update-mime-database $D${MIMEDIR}
-		rmdir --ignore-fail-on-non-empty $D${MIMEDIR}/packages
-	else
-		update-mime-database $D${MIMEDIR}
-fi
-fi
-}
-
-python populate_packages:append () {
-    packages = d.getVar('PACKAGES').split()
-    pkgdest =  d.getVar('PKGDEST')
-    mimedir = d.getVar('MIMEDIR')
-
-    for pkg in packages:
-        mime_packages_dir = '%s/%s%s/packages' % (pkgdest, pkg, mimedir)
-        mimes_types_found = False
-        if os.path.exists(mime_packages_dir):
-            for f in os.listdir(mime_packages_dir):
-                if f.endswith('.xml'):
-                    mimes_types_found = True
-                    break
-        if mimes_types_found:
-            bb.note("adding mime postinst and postrm scripts to %s" % pkg)
-            postinst = d.getVar('pkg_postinst:%s' % pkg)
-            if not postinst:
-                postinst = '#!/bin/sh\n'
-            postinst += d.getVar('mime_postinst')
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-            postrm = d.getVar('pkg_postrm:%s' % pkg)
-            if not postrm:
-                postrm = '#!/bin/sh\n'
-            postrm += d.getVar('mime_postrm')
-            d.setVar('pkg_postrm:%s' % pkg, postrm)
-            if pkg != 'shared-mime-info-data':
-                bb.note("adding shared-mime-info-data dependency to %s" % pkg)
-                d.appendVar('RDEPENDS:' + pkg, " " + d.getVar('MLPREFIX')+"shared-mime-info-data")
-}
diff --git a/poky/meta/classes/mirrors.bbclass b/poky/meta/classes/mirrors.bbclass
deleted file mode 100644
index ffdccff..0000000
--- a/poky/meta/classes/mirrors.bbclass
+++ /dev/null
@@ -1,89 +0,0 @@
-MIRRORS += "\
-${DEBIAN_MIRROR}	http://snapshot.debian.org/archive/debian/20180310T215105Z/pool \
-${DEBIAN_MIRROR}	http://snapshot.debian.org/archive/debian-archive/20120328T092752Z/debian/pool \
-${DEBIAN_MIRROR}	http://snapshot.debian.org/archive/debian-archive/20110127T084257Z/debian/pool \
-${DEBIAN_MIRROR}	http://snapshot.debian.org/archive/debian-archive/20090802T004153Z/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.de.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.au.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.cl.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.hr.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.fi.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.hk.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.hu.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.ie.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.it.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.jp.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.no.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.pl.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.ro.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.si.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.es.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.se.debian.org/debian/pool \
-${DEBIAN_MIRROR}	http://ftp.tr.debian.org/debian/pool \
-${GNU_MIRROR}	https://mirrors.kernel.org/gnu \
-${KERNELORG_MIRROR}	http://www.kernel.org/pub \
-${GNUPG_MIRROR}	ftp://ftp.gnupg.org/gcrypt \
-${GNUPG_MIRROR}	ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt \
-${GNUPG_MIRROR}	ftp://mirrors.dotsrc.org/gcrypt \
-ftp://dante.ctan.org/tex-archive ftp://ftp.fu-berlin.de/tex/CTAN \
-ftp://dante.ctan.org/tex-archive http://sunsite.sut.ac.jp/pub/archives/ctan/ \
-ftp://dante.ctan.org/tex-archive http://ctan.unsw.edu.au/ \
-ftp://ftp.gnutls.org/gcrypt/gnutls ${GNUPG_MIRROR}/gnutls \
-http://ftp.info-zip.org/pub/infozip/src/ ftp://sunsite.icm.edu.pl/pub/unix/archiving/info-zip/src/ \
-http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/ http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/ \
-${APACHE_MIRROR}  http://www.us.apache.org/dist \
-${APACHE_MIRROR}  http://archive.apache.org/dist \
-http://downloads.sourceforge.net/watchdog/ http://fossies.org/linux/misc/ \
-${SAVANNAH_GNU_MIRROR} http://download-mirror.savannah.gnu.org/releases \
-${SAVANNAH_NONGNU_MIRROR} http://download-mirror.savannah.nongnu.org/releases \
-ftp://sourceware.org/pub http://mirrors.kernel.org/sourceware \
-ftp://sourceware.org/pub http://gd.tuwien.ac.at/gnu/sourceware \
-ftp://sourceware.org/pub http://ftp.gwdg.de/pub/linux/sources.redhat.com/sourceware \
-cvs://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \
-svn://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \
-git://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \
-gitsm://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \
-hg://.*/.*      http://downloads.yoctoproject.org/mirror/sources/ \
-bzr://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \
-p4://.*/.*      http://downloads.yoctoproject.org/mirror/sources/ \
-osc://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \
-https?://.*/.*  http://downloads.yoctoproject.org/mirror/sources/ \
-ftp://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \
-npm://.*/?.*    http://downloads.yoctoproject.org/mirror/sources/ \
-cvs://.*/.*     http://sources.openembedded.org/ \
-svn://.*/.*     http://sources.openembedded.org/ \
-git://.*/.*     http://sources.openembedded.org/ \
-gitsm://.*/.*   http://sources.openembedded.org/ \
-hg://.*/.*      http://sources.openembedded.org/ \
-bzr://.*/.*     http://sources.openembedded.org/ \
-p4://.*/.*      http://sources.openembedded.org/ \
-osc://.*/.*     http://sources.openembedded.org/ \
-https?://.*/.*  http://sources.openembedded.org/ \
-ftp://.*/.*     http://sources.openembedded.org/ \
-npm://.*/?.*    http://sources.openembedded.org/ \
-${CPAN_MIRROR}  http://cpan.metacpan.org/ \
-${CPAN_MIRROR}  http://search.cpan.org/CPAN/ \
-https?://downloads.yoctoproject.org/releases/uninative/ https://mirrors.kernel.org/yocto/uninative/ \
-https?://downloads.yoctoproject.org/mirror/sources/ https://mirrors.kernel.org/yocto-sources/ \
-"
-
-# Use MIRRORS to provide git repo fallbacks using the https protocol, for cases
-# where git native protocol fetches may fail due to local firewall rules, etc.
-
-MIRRORS += "\
-git://salsa.debian.org/.*     git://salsa.debian.org/PATH;protocol=https \
-git://git.gnome.org/.*        git://gitlab.gnome.org/GNOME/PATH;protocol=https \
-git://.*/.*                   git://HOST/PATH;protocol=https \
-git://.*/.*                   git://HOST/git/PATH;protocol=https \
-"
-
-# Switch glibc and binutils recipes to use shallow clones as they're large and this
-# improves user experience whilst allowing the flexibility of git urls in the recipes
-BB_GIT_SHALLOW:pn-binutils = "1"
-BB_GIT_SHALLOW:pn-binutils-cross-${TARGET_ARCH} = "1"
-BB_GIT_SHALLOW:pn-binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} = "1"
-BB_GIT_SHALLOW:pn-binutils-cross-testsuite = "1"
-BB_GIT_SHALLOW:pn-binutils-crosssdk-${SDK_SYS} = "1"
-BB_GIT_SHALLOW:pn-glibc = "1"
-PREMIRRORS += "git://sourceware.org/git/glibc.git https://downloads.yoctoproject.org/mirror/sources/ \
-              git://sourceware.org/git/binutils-gdb.git https://downloads.yoctoproject.org/mirror/sources/"
diff --git a/poky/meta/classes/module-base.bbclass b/poky/meta/classes/module-base.bbclass
deleted file mode 100644
index 27bd69f..0000000
--- a/poky/meta/classes/module-base.bbclass
+++ /dev/null
@@ -1,21 +0,0 @@
-inherit kernel-arch
-
-# We do the dependency this way because the output is not preserved
-# in sstate, so we must force do_compile to run (once).
-do_configure[depends] += "make-mod-scripts:do_compile"
-
-export OS = "${TARGET_OS}"
-export CROSS_COMPILE = "${TARGET_PREFIX}"
-
-# This points to the build artefacts from the main kernel build
-# such as .config and System.map
-# Confusingly it is not the module build output (which is ${B}) but
-# we didn't pick the name.
-export KBUILD_OUTPUT = "${STAGING_KERNEL_BUILDDIR}"
-
-export KERNEL_VERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
-KERNEL_OBJECT_SUFFIX = ".ko"
-
-# kernel modules are generally machine specific
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
diff --git a/poky/meta/classes/module.bbclass b/poky/meta/classes/module.bbclass
deleted file mode 100644
index a09ec3e..0000000
--- a/poky/meta/classes/module.bbclass
+++ /dev/null
@@ -1,74 +0,0 @@
-inherit module-base kernel-module-split pkgconfig
-
-EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
-
-MODULES_INSTALL_TARGET ?= "modules_install"
-MODULES_MODULE_SYMVERS_LOCATION ?= ""
-
-python __anonymous () {
-    depends = d.getVar('DEPENDS')
-    extra_symbols = []
-    for dep in depends.split():
-        if dep.startswith("kernel-module-"):
-            extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
-    d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
-}
-
-python do_devshell:prepend () {
-    os.environ['CFLAGS'] = ''
-    os.environ['CPPFLAGS'] = ''
-    os.environ['CXXFLAGS'] = ''
-    os.environ['LDFLAGS'] = ''
-
-    os.environ['KERNEL_PATH'] = d.getVar('STAGING_KERNEL_DIR')
-    os.environ['KERNEL_SRC'] = d.getVar('STAGING_KERNEL_DIR')
-    os.environ['KERNEL_VERSION'] = d.getVar('KERNEL_VERSION')
-    os.environ['CC'] = d.getVar('KERNEL_CC')
-    os.environ['LD'] = d.getVar('KERNEL_LD')
-    os.environ['AR'] = d.getVar('KERNEL_AR')
-    os.environ['O'] = d.getVar('STAGING_KERNEL_BUILDDIR')
-    kbuild_extra_symbols = d.getVar('KBUILD_EXTRA_SYMBOLS')
-    if kbuild_extra_symbols:
-        os.environ['KBUILD_EXTRA_SYMBOLS'] = kbuild_extra_symbols
-    else:
-        os.environ['KBUILD_EXTRA_SYMBOLS'] = ''
-}
-
-module_do_compile() {
-	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
-	oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
-		   KERNEL_VERSION=${KERNEL_VERSION}    \
-		   CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
-		   AR="${KERNEL_AR}" \
-	           O=${STAGING_KERNEL_BUILDDIR} \
-		   KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
-		   ${MAKE_TARGETS}
-}
-
-module_do_install() {
-	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
-	oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \
-	           INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \
-	           CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
-	           O=${STAGING_KERNEL_BUILDDIR} \
-	           ${MODULES_INSTALL_TARGET}
-
-	if [ ! -e "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers" ] ; then
-		bbwarn "Module.symvers not found in ${B}/${MODULES_MODULE_SYMVERS_LOCATION}"
-		bbwarn "Please consider setting MODULES_MODULE_SYMVERS_LOCATION to a"
-		bbwarn "directory below B to get correct inter-module dependencies"
-	else
-		install -Dm0644 "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers ${D}${includedir}/${BPN}/Module.symvers
-		# Module.symvers contains absolute path to the build directory.
-		# While it doesn't actually seem to matter which path is specified,
-		# clear them out to avoid confusion
-		sed -e 's:${B}/::g' -i ${D}${includedir}/${BPN}/Module.symvers
-	fi
-}
-
-EXPORT_FUNCTIONS do_compile do_install
-
-# add all splitted modules to PN RDEPENDS, PN can be empty now
-KERNEL_MODULES_META_PACKAGE = "${PN}"
-FILES:${PN} = ""
-ALLOW_EMPTY:${PN} = "1"
diff --git a/poky/meta/classes/multilib.bbclass b/poky/meta/classes/multilib.bbclass
index 5859ca8..10a4ef9 100644
--- a/poky/meta/classes/multilib.bbclass
+++ b/poky/meta/classes/multilib.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 python multilib_virtclass_handler () {
     cls = e.data.getVar("BBEXTENDCURR")
     variant = e.data.getVar("BBEXTENDVARIANT")
diff --git a/poky/meta/classes/multilib_global.bbclass b/poky/meta/classes/multilib_global.bbclass
index e06307d..dcd89b2 100644
--- a/poky/meta/classes/multilib_global.bbclass
+++ b/poky/meta/classes/multilib_global.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 def preferred_ml_updates(d):
     # If any of PREFERRED_PROVIDER, PREFERRED_RPROVIDER, REQUIRED_VERSION
     # or PREFERRED_VERSION are set, we need to mirror these variables in
diff --git a/poky/meta/classes/multilib_header.bbclass b/poky/meta/classes/multilib_header.bbclass
deleted file mode 100644
index efbc24f..0000000
--- a/poky/meta/classes/multilib_header.bbclass
+++ /dev/null
@@ -1,52 +0,0 @@
-inherit siteinfo
-
-# If applicable on the architecture, this routine will rename the header and
-# add a unique identifier to the name for the ABI/bitsize that is being used.
-# A wrapper will be generated for the architecture that knows how to call
-# all of the ABI variants for that given architecture.
-#
-oe_multilib_header() {
-
-	case ${HOST_OS} in
-	*-musl*)
-		return
-		;;
-	*)
-	esac
-        # For MIPS: "n32" is a special case, which needs to be
-        # distinct from both 64-bit and 32-bit.
-        case ${TARGET_ARCH} in
-        mips*)  case "${MIPSPKGSFX_ABI}" in
-                "-n32")
-                       ident=n32   
-                       ;;
-                *)     
-                       ident=${SITEINFO_BITS}
-                       ;;
-                esac
-                ;;
-        *)      ident=${SITEINFO_BITS}
-        esac
-	for each_header in "$@" ; do
-	   if [ ! -f "${D}/${includedir}/$each_header" ]; then
-	      bberror "oe_multilib_header: Unable to find header $each_header."
-	      continue
-	   fi
-	   stem=$(echo $each_header | sed 's#\.h$##')
-	   # if mips64/n32 set ident to n32
-	   mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h
-
-	   sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header
-	done
-}
-
-# Dependencies on arch variables like MIPSPKGSFX_ABI can be problematic.
-# We don't need multilib headers for native builds so brute force things.
-oe_multilib_header:class-native () {
-	return
-}
-
-# Nor do we need multilib headers for nativesdk builds.
-oe_multilib_header:class-nativesdk () {
-	return
-}
diff --git a/poky/meta/classes/multilib_script.bbclass b/poky/meta/classes/multilib_script.bbclass
deleted file mode 100644
index 4159734..0000000
--- a/poky/meta/classes/multilib_script.bbclass
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g.
-# MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2"
-# to indicate which script files to process from which packages.
-#
-
-inherit update-alternatives
-
-MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
-
-PACKAGE_PREPROCESS_FUNCS += "multilibscript_rename"
-
-multilibscript_rename() {
-	:
-}
-
-python () {
-    # Do nothing if multilib isn't being used
-    if not d.getVar("MULTILIB_VARIANTS"):
-        return
-    # Do nothing for native/cross
-    if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d):
-        return
-
-    for entry in (d.getVar("MULTILIB_SCRIPTS", False) or "").split():
-        pkg, script = entry.split(":")
-        epkg = d.expand(pkg)
-        scriptname = os.path.basename(script)
-        d.appendVar("ALTERNATIVE:" + epkg, " " + scriptname + " ")
-        d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, script)
-        d.setVarFlag("ALTERNATIVE_TARGET", scriptname, script + "-${MULTILIB_SUFFIX}")
-        d.appendVar("multilibscript_rename",  "\n	mv ${PKGD}" + script + " ${PKGD}" + script + "-${MULTILIB_SUFFIX}")
-        d.appendVar("FILES:" + epkg, " " + script + "-${MULTILIB_SUFFIX}")
-}
diff --git a/poky/meta/classes/native.bbclass b/poky/meta/classes/native.bbclass
deleted file mode 100644
index 5a273cd..0000000
--- a/poky/meta/classes/native.bbclass
+++ /dev/null
@@ -1,230 +0,0 @@
-# We want native packages to be relocatable
-inherit relocatable
-
-# Native packages are built indirectly via dependency,
-# no need for them to be a direct target of 'world'
-EXCLUDE_FROM_WORLD = "1"
-
-PACKAGE_ARCH = "${BUILD_ARCH}"
-
-# used by cmake class
-OECMAKE_RPATH = "${libdir}"
-OECMAKE_RPATH:class-native = "${libdir}"
-
-TARGET_ARCH = "${BUILD_ARCH}"
-TARGET_OS = "${BUILD_OS}"
-TARGET_VENDOR = "${BUILD_VENDOR}"
-TARGET_PREFIX = "${BUILD_PREFIX}"
-TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
-TARGET_LD_ARCH = "${BUILD_LD_ARCH}"
-TARGET_AS_ARCH = "${BUILD_AS_ARCH}"
-TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}"
-TARGET_CFLAGS = "${BUILD_CFLAGS}"
-TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}"
-TARGET_LDFLAGS = "${BUILD_LDFLAGS}"
-TARGET_FPU = ""
-TUNE_FEATURES = ""
-ABIEXTENSION = ""
-
-HOST_ARCH = "${BUILD_ARCH}"
-HOST_OS = "${BUILD_OS}"
-HOST_VENDOR = "${BUILD_VENDOR}"
-HOST_PREFIX = "${BUILD_PREFIX}"
-HOST_CC_ARCH = "${BUILD_CC_ARCH}"
-HOST_LD_ARCH = "${BUILD_LD_ARCH}"
-HOST_AS_ARCH = "${BUILD_AS_ARCH}"
-
-CPPFLAGS = "${BUILD_CPPFLAGS}"
-CFLAGS = "${BUILD_CFLAGS}"
-CXXFLAGS = "${BUILD_CXXFLAGS}"
-LDFLAGS = "${BUILD_LDFLAGS}"
-
-STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}"
-STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}"
-
-# native pkg doesn't need the TOOLCHAIN_OPTIONS.
-TOOLCHAIN_OPTIONS = ""
-
-# Don't build ptest natively
-PTEST_ENABLED = "0"
-
-# Don't use site files for native builds
-export CONFIG_SITE = "${COREBASE}/meta/site/native"
-
-# set the compiler as well. It could have been set to something else
-export CC = "${BUILD_CC}"
-export CXX = "${BUILD_CXX}"
-export FC = "${BUILD_FC}"
-export CPP = "${BUILD_CPP}"
-export LD = "${BUILD_LD}"
-export CCLD = "${BUILD_CCLD}"
-export AR = "${BUILD_AR}"
-export AS = "${BUILD_AS}"
-export RANLIB = "${BUILD_RANLIB}"
-export STRIP = "${BUILD_STRIP}"
-export NM = "${BUILD_NM}"
-
-# Path prefixes
-base_prefix = "${STAGING_DIR_NATIVE}"
-prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-
-bindir = "${STAGING_BINDIR_NATIVE}"
-sbindir = "${STAGING_SBINDIR_NATIVE}"
-base_libdir = "${STAGING_LIBDIR_NATIVE}"
-libdir = "${STAGING_LIBDIR_NATIVE}"
-includedir = "${STAGING_INCDIR_NATIVE}"
-sysconfdir = "${STAGING_ETCDIR_NATIVE}"
-datadir = "${STAGING_DATADIR_NATIVE}"
-
-baselib = "lib"
-
-export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
-
-NATIVE_PACKAGE_PATH_SUFFIX ?= ""
-bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-sbindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-base_libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-
-do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
-do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
-
-# Since we actually install these into situ there is no staging prefix
-STAGING_DIR_HOST = ""
-STAGING_DIR_TARGET = ""
-PKG_CONFIG_DIR = "${libdir}/pkgconfig"
-
-EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
-PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
-PKG_CONFIG_SYSROOT_DIR = ""
-PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1"
-PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
-
-# we dont want libc-*libc to kick in for native recipes
-LIBCOVERRIDE = ""
-CLASSOVERRIDE = "class-native"
-MACHINEOVERRIDES = ""
-MACHINE_FEATURES = ""
-
-PATH:prepend = "${COREBASE}/scripts/native-intercept:"
-
-# This class encodes staging paths into its scripts data so can only be
-# reused if we manipulate the paths.
-SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
-
-# No strip sysroot when DEBUG_BUILD is enabled
-INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}"
-
-python native_virtclass_handler () {
-    pn = e.data.getVar("PN")
-    if not pn.endswith("-native"):
-        return
-    bpn = e.data.getVar("BPN")
-
-    # Set features here to prevent appends and distro features backfill
-    # from modifying native distro features
-    features = set(d.getVar("DISTRO_FEATURES_NATIVE").split())
-    filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split())
-    d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
-
-    classextend = e.data.getVar('BBCLASSEXTEND') or ""
-    if "native" not in classextend:
-        return
-
-    def map_dependencies(varname, d, suffix = "", selfref=True):
-        if suffix:
-            varname = varname + ":" + suffix
-        deps = d.getVar(varname)
-        if not deps:
-            return
-        deps = bb.utils.explode_deps(deps)
-        newdeps = []
-        for dep in deps:
-            if dep == pn:
-                if not selfref:
-                    continue
-                newdeps.append(dep)
-            elif "-cross-" in dep:
-                newdeps.append(dep.replace("-cross", "-native"))
-            elif not dep.endswith("-native"):
-                # Replace ${PN} with ${BPN} in the dependency to make sure
-                # dependencies on, e.g., ${PN}-foo become ${BPN}-foo-native
-                # rather than ${BPN}-native-foo-native.
-                newdeps.append(dep.replace(pn, bpn) + "-native")
-            else:
-                newdeps.append(dep)
-        d.setVar(varname, " ".join(newdeps), parsing=True)
-
-    map_dependencies("DEPENDS", e.data, selfref=False)
-    for pkg in e.data.getVar("PACKAGES", False).split():
-        map_dependencies("RDEPENDS", e.data, pkg)
-        map_dependencies("RRECOMMENDS", e.data, pkg)
-        map_dependencies("RSUGGESTS", e.data, pkg)
-        map_dependencies("RPROVIDES", e.data, pkg)
-        map_dependencies("RREPLACES", e.data, pkg)
-    map_dependencies("PACKAGES", e.data)
-
-    provides = e.data.getVar("PROVIDES")
-    nprovides = []
-    for prov in provides.split():
-        if prov.find(pn) != -1:
-            nprovides.append(prov)
-        elif not prov.endswith("-native"):
-            nprovides.append(prov + "-native")
-        else:
-            nprovides.append(prov)
-    e.data.setVar("PROVIDES", ' '.join(nprovides))
-
-
-}
-
-addhandler native_virtclass_handler
-native_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
-
-python do_addto_recipe_sysroot () {
-    bb.build.exec_func("extend_recipe_sysroot", d)
-}
-addtask addto_recipe_sysroot after do_populate_sysroot
-do_addto_recipe_sysroot[deptask] = "do_populate_sysroot"
-
-inherit nopackages
-
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "no"
-
-RECIPERDEPTASK = "do_populate_sysroot"
-do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}"
-
-#
-# Native task outputs are directly run on the target (host) system after being
-# built. Even if the output of this recipe doesn't change, a change in one of
-# its dependencies may cause a change in the output it generates (e.g. rpm
-# output depends on the output of its dependent zstd library).
-#
-# This can cause poor interactions with hash equivalence, since this recipes
-# output-changing dependency is "hidden" and downstream task only see that this
-# recipe has the same outhash and therefore is equivalent. This can result in
-# different output in different cases.
-#
-# To resolve this, unhide the output-changing dependency by adding its unihash
-# to this tasks outhash calculation. Unfortunately, don't know specifically
-# know which dependencies are output-changing, so we have to add all of them.
-#
-python native_add_do_populate_sysroot_deps () {
-    current_task = "do_" + d.getVar("BB_CURRENTTASK")
-    if current_task != "do_populate_sysroot":
-        return
-
-    taskdepdata = d.getVar("BB_TASKDEPDATA", False)
-    pn = d.getVar("PN")
-    deps = {
-        dep[0]:dep[6] for dep in taskdepdata.values() if
-            dep[1] == current_task and dep[0] != pn
-    }
-
-    d.setVar("HASHEQUIV_EXTRA_SIGDATA", "\n".join("%s: %s" % (k, deps[k]) for k in sorted(deps.keys())))
-}
-SSTATECREATEFUNCS += "native_add_do_populate_sysroot_deps"
diff --git a/poky/meta/classes/nativesdk.bbclass b/poky/meta/classes/nativesdk.bbclass
deleted file mode 100644
index f8e9607..0000000
--- a/poky/meta/classes/nativesdk.bbclass
+++ /dev/null
@@ -1,117 +0,0 @@
-# SDK packages are built either explicitly by the user,
-# or indirectly via dependency.  No need to be in 'world'.
-EXCLUDE_FROM_WORLD = "1"
-
-STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}"
-
-# libc for the SDK can be different to that of the target
-NATIVESDKLIBC ?= "libc-glibc"
-LIBCOVERRIDE = ":${NATIVESDKLIBC}"
-CLASSOVERRIDE = "class-nativesdk"
-MACHINEOVERRIDES = ""
-MACHINE_FEATURES = ""
-
-MULTILIBS = ""
-
-# we need consistent staging dir whether or not multilib is enabled
-STAGING_DIR_HOST = "${WORKDIR}/recipe-sysroot"
-STAGING_DIR_TARGET = "${WORKDIR}/recipe-sysroot"
-RECIPE_SYSROOT = "${WORKDIR}/recipe-sysroot"
-
-#
-# Update PACKAGE_ARCH and PACKAGE_ARCHS
-#
-PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}"
-PACKAGE_ARCHS = "${SDK_PACKAGE_ARCHS}"
-
-#
-# We need chrpath >= 0.14 to ensure we can deal with 32 and 64 bit
-# binaries
-#
-DEPENDS:append = " chrpath-replacement-native"
-EXTRANATIVEPATH += "chrpath-native"
-
-PKGDATA_DIR = "${PKGDATA_DIR_SDK}"
-
-HOST_ARCH = "${SDK_ARCH}"
-HOST_VENDOR = "${SDK_VENDOR}"
-HOST_OS = "${SDK_OS}"
-HOST_PREFIX = "${SDK_PREFIX}"
-HOST_CC_ARCH = "${SDK_CC_ARCH}"
-HOST_LD_ARCH = "${SDK_LD_ARCH}"
-HOST_AS_ARCH = "${SDK_AS_ARCH}"
-#HOST_SYS = "${HOST_ARCH}${TARGET_VENDOR}-${HOST_OS}"
-
-TARGET_ARCH = "${SDK_ARCH}"
-TARGET_VENDOR = "${SDK_VENDOR}"
-TARGET_OS = "${SDK_OS}"
-TARGET_PREFIX = "${SDK_PREFIX}"
-TARGET_CC_ARCH = "${SDK_CC_ARCH}"
-TARGET_LD_ARCH = "${SDK_LD_ARCH}"
-TARGET_AS_ARCH = "${SDK_AS_ARCH}"
-TARGET_CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
-TARGET_CFLAGS = "${BUILDSDK_CFLAGS}"
-TARGET_CXXFLAGS = "${BUILDSDK_CXXFLAGS}"
-TARGET_LDFLAGS = "${BUILDSDK_LDFLAGS}"
-TARGET_FPU = ""
-EXTRA_OECONF_GCC_FLOAT = ""
-
-CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
-CFLAGS = "${BUILDSDK_CFLAGS}"
-CXXFLAGS = "${BUILDSDK_CXXFLAGS}"
-LDFLAGS = "${BUILDSDK_LDFLAGS}"
-
-# Change to place files in SDKPATH
-base_prefix = "${SDKPATHNATIVE}"
-prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-baselib = "lib"
-sbindir = "${bindir}"
-
-export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
-
-python nativesdk_virtclass_handler () {
-    pn = e.data.getVar("PN")
-    if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")):
-        return
-
-    # Set features here to prevent appends and distro features backfill
-    # from modifying nativesdk distro features
-    features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split())
-    filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split())
-    d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
-
-    e.data.setVar("MLPREFIX", "nativesdk-")
-    e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN").replace("-nativesdk", "").replace("nativesdk-", ""))
-}
-
-python () {
-    pn = d.getVar("PN")
-    if not pn.startswith("nativesdk-"):
-        return
-
-    import oe.classextend
-
-    clsextend = oe.classextend.NativesdkClassExtender("nativesdk", d)
-    clsextend.rename_packages()
-    clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split())
-
-    clsextend.map_depends_variable("DEPENDS")
-    clsextend.map_packagevars()
-    clsextend.map_variable("PROVIDES")
-    clsextend.map_regexp_variable("PACKAGES_DYNAMIC")
-    d.setVar("LIBCEXTENSION", "")
-    d.setVar("ABIEXTENSION", "")
-}
-
-addhandler nativesdk_virtclass_handler
-nativesdk_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
-
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "${SDKUSE_NLS}"
-
-OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}"
-
-PATH:prepend = "${COREBASE}/scripts/nativesdk-intercept:"
diff --git a/poky/meta/classes/nopackages.bbclass b/poky/meta/classes/nopackages.bbclass
deleted file mode 100644
index 7a4f632..0000000
--- a/poky/meta/classes/nopackages.bbclass
+++ /dev/null
@@ -1,13 +0,0 @@
-deltask do_package
-deltask do_package_write_rpm
-deltask do_package_write_ipk
-deltask do_package_write_deb
-deltask do_package_write_tar
-deltask do_package_qa
-deltask do_packagedata
-deltask do_package_setscene
-deltask do_package_write_rpm_setscene
-deltask do_package_write_ipk_setscene
-deltask do_package_write_deb_setscene
-deltask do_package_qa_setscene
-deltask do_packagedata_setscene
diff --git a/poky/meta/classes/npm.bbclass b/poky/meta/classes/npm.bbclass
deleted file mode 100644
index deea53c..0000000
--- a/poky/meta/classes/npm.bbclass
+++ /dev/null
@@ -1,340 +0,0 @@
-# Copyright (C) 2020 Savoir-Faire Linux
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# This bbclass builds and installs an npm package to the target. The package
-# sources files should be fetched in the calling recipe by using the SRC_URI
-# variable. The ${S} variable should be updated depending of your fetcher.
-#
-# Usage:
-#  SRC_URI = "..."
-#  inherit npm
-#
-# Optional variables:
-#  NPM_ARCH:
-#       Override the auto generated npm architecture.
-#
-#  NPM_INSTALL_DEV:
-#       Set to 1 to also install devDependencies.
-
-inherit python3native
-
-DEPENDS:prepend = "nodejs-native nodejs-oe-cache-native "
-RDEPENDS:${PN}:append:class-target = " nodejs"
-
-EXTRA_OENPM = ""
-
-NPM_INSTALL_DEV ?= "0"
-
-NPM_NODEDIR ?= "${RECIPE_SYSROOT_NATIVE}${prefix_native}"
-
-def npm_target_arch_map(target_arch):
-    """Maps arch names to npm arch names"""
-    import re
-    if re.match("p(pc|owerpc)(|64)", target_arch):
-        return "ppc"
-    elif re.match("i.86$", target_arch):
-        return "ia32"
-    elif re.match("x86_64$", target_arch):
-        return "x64"
-    elif re.match("arm64$", target_arch):
-        return "arm"
-    return target_arch
-
-NPM_ARCH ?= "${@npm_target_arch_map(d.getVar("TARGET_ARCH"))}"
-
-NPM_PACKAGE = "${WORKDIR}/npm-package"
-NPM_CACHE = "${WORKDIR}/npm-cache"
-NPM_BUILD = "${WORKDIR}/npm-build"
-NPM_REGISTRY = "${WORKDIR}/npm-registry"
-
-def npm_global_configs(d):
-    """Get the npm global configuration"""
-    configs = []
-    # Ensure no network access is done
-    configs.append(("offline", "true"))
-    configs.append(("proxy", "http://invalid"))
-    configs.append(("funds", False))
-    configs.append(("audit", False))
-    # Configure the cache directory
-    configs.append(("cache", d.getVar("NPM_CACHE")))
-    return configs
-
-## 'npm pack' runs 'prepare' and 'prepack' scripts. Support for
-## 'ignore-scripts' which prevents this behavior has been removed
-## from nodejs 16.  Use simple 'tar' instead of.
-def npm_pack(env, srcdir, workdir):
-    """Emulate 'npm pack' on a specified directory"""
-    import subprocess
-    import os
-    import json
-
-    src = os.path.join(srcdir, 'package.json')
-    with open(src) as f:
-        j = json.load(f)
-
-    # base does not really matter and is for documentation purposes
-    # only.  But the 'version' part must exist because other parts of
-    # the bbclass rely on it.
-    base = j['name'].split('/')[-1]
-    tarball = os.path.join(workdir, "%s-%s.tgz" % (base, j['version']));
-
-    # TODO: real 'npm pack' does not include directories while 'tar'
-    # does.  But this does not seem to matter...
-    subprocess.run(['tar', 'czf', tarball,
-                    '--exclude', './node-modules',
-                    '--exclude-vcs',
-                    '--transform', 's,^\./,package/,',
-                    '--mtime', '1985-10-26T08:15:00.000Z',
-                    '.'],
-                   check = True, cwd = srcdir)
-
-    return (tarball, j)
-
-python npm_do_configure() {
-    """
-    Step one: configure the npm cache and the main npm package
-
-    Every dependencies have been fetched and patched in the source directory.
-    They have to be packed (this remove unneeded files) and added to the npm
-    cache to be available for the next step.
-
-    The main package and its associated manifest file and shrinkwrap file have
-    to be configured to take into account these cached dependencies.
-    """
-    import base64
-    import copy
-    import json
-    import re
-    import shlex
-    import stat
-    import tempfile
-    from bb.fetch2.npm import NpmEnvironment
-    from bb.fetch2.npm import npm_unpack
-    from bb.fetch2.npmsw import foreach_dependencies
-    from bb.progress import OutOfProgressHandler
-    from oe.npm_registry import NpmRegistry
-
-    bb.utils.remove(d.getVar("NPM_CACHE"), recurse=True)
-    bb.utils.remove(d.getVar("NPM_PACKAGE"), recurse=True)
-
-    env = NpmEnvironment(d, configs=npm_global_configs(d))
-    registry = NpmRegistry(d.getVar('NPM_REGISTRY'), d.getVar('NPM_CACHE'))
-
-    def _npm_cache_add(tarball, pkg):
-        """Add tarball to local registry and register it in the
-           cache"""
-        registry.add_pkg(tarball, pkg)
-
-    def _npm_integrity(tarball):
-        """Return the npm integrity of a specified tarball"""
-        sha512 = bb.utils.sha512_file(tarball)
-        return "sha512-" + base64.b64encode(bytes.fromhex(sha512)).decode()
-
-    def _npmsw_dependency_dict(orig, deptree):
-        """
-        Return the sub dictionary in the 'orig' dictionary corresponding to the
-        'deptree' dependency tree. This function follows the shrinkwrap file
-        format.
-        """
-        ptr = orig
-        for dep in deptree:
-            if "dependencies" not in ptr:
-                ptr["dependencies"] = {}
-            ptr = ptr["dependencies"]
-            if dep not in ptr:
-                ptr[dep] = {}
-            ptr = ptr[dep]
-        return ptr
-
-    # Manage the manifest file and shrinkwrap files
-    orig_manifest_file = d.expand("${S}/package.json")
-    orig_shrinkwrap_file = d.expand("${S}/npm-shrinkwrap.json")
-    cached_manifest_file = d.expand("${NPM_PACKAGE}/package.json")
-    cached_shrinkwrap_file = d.expand("${NPM_PACKAGE}/npm-shrinkwrap.json")
-
-    with open(orig_manifest_file, "r") as f:
-        orig_manifest = json.load(f)
-
-    cached_manifest = copy.deepcopy(orig_manifest)
-    cached_manifest.pop("dependencies", None)
-    cached_manifest.pop("devDependencies", None)
-
-    has_shrinkwrap_file = True
-
-    try:
-        with open(orig_shrinkwrap_file, "r") as f:
-            orig_shrinkwrap = json.load(f)
-    except IOError:
-        has_shrinkwrap_file = False
-
-    if has_shrinkwrap_file:
-       cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap)
-       cached_shrinkwrap.pop("dependencies", None)
-
-    # Manage the dependencies
-    progress = OutOfProgressHandler(d, r"^(\d+)/(\d+)$")
-    progress_total = 1 # also count the main package
-    progress_done = 0
-
-    def _count_dependency(name, params, deptree):
-        nonlocal progress_total
-        progress_total += 1
-
-    def _cache_dependency(name, params, deptree):
-        destsubdirs = [os.path.join("node_modules", dep) for dep in deptree]
-        destsuffix = os.path.join(*destsubdirs)
-        with tempfile.TemporaryDirectory() as tmpdir:
-            # Add the dependency to the npm cache
-            destdir = os.path.join(d.getVar("S"), destsuffix)
-            (tarball, pkg) = npm_pack(env, destdir, tmpdir)
-            _npm_cache_add(tarball, pkg)
-            # Add its signature to the cached shrinkwrap
-            dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
-            dep["version"] = pkg['version']
-            dep["integrity"] = _npm_integrity(tarball)
-            if params.get("dev", False):
-                dep["dev"] = True
-            # Display progress
-            nonlocal progress_done
-            progress_done += 1
-            progress.write("%d/%d" % (progress_done, progress_total))
-
-    dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False)
-
-    if has_shrinkwrap_file:
-        foreach_dependencies(orig_shrinkwrap, _count_dependency, dev)
-        foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev)
-
-    # Configure the main package
-    with tempfile.TemporaryDirectory() as tmpdir:
-        (tarball, _) = npm_pack(env, d.getVar("S"), tmpdir)
-        npm_unpack(tarball, d.getVar("NPM_PACKAGE"), d)
-
-    # Configure the cached manifest file and cached shrinkwrap file
-    def _update_manifest(depkey):
-        for name in orig_manifest.get(depkey, {}):
-            version = cached_shrinkwrap["dependencies"][name]["version"]
-            if depkey not in cached_manifest:
-                cached_manifest[depkey] = {}
-            cached_manifest[depkey][name] = version
-
-    if has_shrinkwrap_file:
-        _update_manifest("dependencies")
-
-    if dev:
-        if has_shrinkwrap_file:
-            _update_manifest("devDependencies")
-
-    os.chmod(cached_manifest_file, os.stat(cached_manifest_file).st_mode | stat.S_IWUSR)
-    with open(cached_manifest_file, "w") as f:
-        json.dump(cached_manifest, f, indent=2)
-
-    if has_shrinkwrap_file:
-        with open(cached_shrinkwrap_file, "w") as f:
-            json.dump(cached_shrinkwrap, f, indent=2)
-}
-
-python npm_do_compile() {
-    """
-    Step two: install the npm package
-
-    Use the configured main package and the cached dependencies to run the
-    installation process. The installation is done in a directory which is
-    not the destination directory yet.
-
-    A combination of 'npm pack' and 'npm install' is used to ensure that the
-    installed files are actual copies instead of symbolic links (which is the
-    default npm behavior).
-    """
-    import shlex
-    import tempfile
-    from bb.fetch2.npm import NpmEnvironment
-
-    bb.utils.remove(d.getVar("NPM_BUILD"), recurse=True)
-
-    with tempfile.TemporaryDirectory() as tmpdir:
-        args = []
-        configs = npm_global_configs(d)
-
-        if bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False):
-            configs.append(("also", "development"))
-        else:
-            configs.append(("only", "production"))
-
-        # Report as many logs as possible for debugging purpose
-        configs.append(("loglevel", "silly"))
-
-        # Configure the installation to be done globally in the build directory
-        configs.append(("global", "true"))
-        configs.append(("prefix", d.getVar("NPM_BUILD")))
-
-        # Add node-gyp configuration
-        configs.append(("arch", d.getVar("NPM_ARCH")))
-        configs.append(("release", "true"))
-        configs.append(("nodedir", d.getVar("NPM_NODEDIR")))
-        configs.append(("python", d.getVar("PYTHON")))
-
-        env = NpmEnvironment(d, configs)
-
-        # Add node-pre-gyp configuration
-        args.append(("target_arch", d.getVar("NPM_ARCH")))
-        args.append(("build-from-source", "true"))
-
-        # Pack and install the main package
-        (tarball, _) = npm_pack(env, d.getVar("NPM_PACKAGE"), tmpdir)
-        cmd = "npm install %s %s" % (shlex.quote(tarball), d.getVar("EXTRA_OENPM"))
-        env.run(cmd, args=args)
-}
-
-npm_do_install() {
-    # Step three: final install
-    #
-    # The previous installation have to be filtered to remove some extra files.
-
-    rm -rf ${D}
-
-    # Copy the entire lib and bin directories
-    install -d ${D}/${nonarch_libdir}
-    cp --no-preserve=ownership --recursive ${NPM_BUILD}/lib/. ${D}/${nonarch_libdir}
-
-    if [ -d "${NPM_BUILD}/bin" ]
-    then
-        install -d ${D}/${bindir}
-        cp --no-preserve=ownership --recursive ${NPM_BUILD}/bin/. ${D}/${bindir}
-    fi
-
-    # If the package (or its dependencies) uses node-gyp to build native addons,
-    # object files, static libraries or other temporary files can be hidden in
-    # the lib directory. To reduce the package size and to avoid QA issues
-    # (staticdev with static library files) these files must be removed.
-    local GYP_REGEX=".*/build/Release/[^/]*.node"
-
-    # Remove any node-gyp directory in ${D} to remove temporary build files
-    for GYP_D_FILE in $(find ${D} -regex "${GYP_REGEX}")
-    do
-        local GYP_D_DIR=${GYP_D_FILE%/Release/*}
-
-        rm --recursive --force ${GYP_D_DIR}
-    done
-
-    # Copy only the node-gyp release files
-    for GYP_B_FILE in $(find ${NPM_BUILD} -regex "${GYP_REGEX}")
-    do
-        local GYP_D_FILE=${D}/${prefix}/${GYP_B_FILE#${NPM_BUILD}}
-
-        install -d ${GYP_D_FILE%/*}
-        install -m 755 ${GYP_B_FILE} ${GYP_D_FILE}
-    done
-
-    # Remove the shrinkwrap file which does not need to be packed
-    rm -f ${D}/${nonarch_libdir}/node_modules/*/npm-shrinkwrap.json
-    rm -f ${D}/${nonarch_libdir}/node_modules/@*/*/npm-shrinkwrap.json
-}
-
-FILES:${PN} += " \
-    ${bindir} \
-    ${nonarch_libdir} \
-"
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/oelint.bbclass b/poky/meta/classes/oelint.bbclass
index 2589d34..458a25e 100644
--- a/poky/meta/classes/oelint.bbclass
+++ b/poky/meta/classes/oelint.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 addtask lint before do_build
 do_lint[nostamp] = "1"
 python do_lint() {
diff --git a/poky/meta/classes/overlayfs-etc.bbclass b/poky/meta/classes/overlayfs-etc.bbclass
index 91afee6..d0bc3ec 100644
--- a/poky/meta/classes/overlayfs-etc.bbclass
+++ b/poky/meta/classes/overlayfs-etc.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Class for setting up /etc in overlayfs
 #
 # In order to have /etc directory in overlayfs a special handling at early boot stage is required
diff --git a/poky/meta/classes/overlayfs.bbclass b/poky/meta/classes/overlayfs.bbclass
index f7069ed..bdc6dd9 100644
--- a/poky/meta/classes/overlayfs.bbclass
+++ b/poky/meta/classes/overlayfs.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Class for generation of overlayfs mount units
 #
 # It's often desired in Embedded System design to have a read-only rootfs.
diff --git a/poky/meta/classes/own-mirrors.bbclass b/poky/meta/classes/own-mirrors.bbclass
index ef97274..2f24ff1 100644
--- a/poky/meta/classes/own-mirrors.bbclass
+++ b/poky/meta/classes/own-mirrors.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 PREMIRRORS:prepend = " \
 cvs://.*/.*     ${SOURCE_MIRROR_URL} \
 svn://.*/.*     ${SOURCE_MIRROR_URL} \
diff --git a/poky/meta/classes/package.bbclass b/poky/meta/classes/package.bbclass
deleted file mode 100644
index 97e97d2..0000000
--- a/poky/meta/classes/package.bbclass
+++ /dev/null
@@ -1,2552 +0,0 @@
-#
-# Packaging process
-#
-# Executive summary: This class iterates over the functions listed in PACKAGEFUNCS
-# Taking D and splitting it up into the packages listed in PACKAGES, placing the
-# resulting output in PKGDEST.
-#
-# There are the following default steps but PACKAGEFUNCS can be extended:
-#
-# a) package_convert_pr_autoinc - convert AUTOINC in PKGV to ${PRSERV_PV_AUTOINC}
-#
-# b) perform_packagecopy - Copy D into PKGD
-#
-# c) package_do_split_locales - Split out the locale files, updates FILES and PACKAGES
-#
-# d) split_and_strip_files - split the files into runtime and debug and strip them.
-#    Debug files include debug info split, and associated sources that end up in -dbg packages
-#
-# e) fixup_perms - Fix up permissions in the package before we split it.
-#
-# f) populate_packages - Split the files in PKGD into separate packages in PKGDEST/<pkgname>
-#    Also triggers the binary stripping code to put files in -dbg packages.
-#
-# g) package_do_filedeps - Collect perfile run-time dependency metadata
-#    The data is stores in FILER{PROVIDES,DEPENDS}_file_pkg variables with
-#    a list of affected files in FILER{PROVIDES,DEPENDS}FLIST_pkg
-#
-# h) package_do_shlibs - Look at the shared libraries generated and autotmatically add any
-#    dependencies found. Also stores the package name so anyone else using this library
-#    knows which package to depend on.
-#
-# i) package_do_pkgconfig - Keep track of which packages need and provide which .pc files
-#
-# j) read_shlibdeps - Reads the stored shlibs information into the metadata
-#
-# k) package_depchains - Adds automatic dependencies to -dbg and -dev packages
-#
-# l) emit_pkgdata - saves the packaging data into PKGDATA_DIR for use in later
-#    packaging steps
-
-inherit packagedata
-inherit chrpath
-inherit package_pkgdata
-inherit insane
-
-PKGD    = "${WORKDIR}/package"
-PKGDEST = "${WORKDIR}/packages-split"
-
-LOCALE_SECTION ?= ''
-
-ALL_MULTILIB_PACKAGE_ARCHS = "${@all_multilib_tune_values(d, 'PACKAGE_ARCHS')}"
-
-# rpm is used for the per-file dependency identification
-# dwarfsrcfiles is used to determine the list of debug source files
-PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native"
-
-
-# If your postinstall can execute at rootfs creation time rather than on
-# target but depends on a native/cross tool in order to execute, you need to
-# list that tool in PACKAGE_WRITE_DEPS. Target package dependencies belong
-# in the package dependencies as normal, this is just for native/cross support
-# tools at rootfs build time.
-PACKAGE_WRITE_DEPS ??= ""
-
-def legitimize_package_name(s):
-    """
-    Make sure package names are legitimate strings
-    """
-    import re
-
-    def fixutf(m):
-        cp = m.group(1)
-        if cp:
-            return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape')
-
-    # Handle unicode codepoints encoded as <U0123>, as in glibc locale files.
-    s = re.sub(r'<U([0-9A-Fa-f]{1,4})>', fixutf, s)
-
-    # Remaining package name validity fixes
-    return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
-
-def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None, allow_links=False, summary=None):
-    """
-    Used in .bb files to split up dynamically generated subpackages of a
-    given package, usually plugins or modules.
-
-    Arguments:
-    root           -- the path in which to search
-    file_regex     -- regular expression to match searched files. Use
-                      parentheses () to mark the part of this expression
-                      that should be used to derive the module name (to be
-                      substituted where %s is used in other function
-                      arguments as noted below)
-    output_pattern -- pattern to use for the package names. Must include %s.
-    description    -- description to set for each package. Must include %s.
-    postinst       -- postinstall script to use for all packages (as a
-                      string)
-    recursive      -- True to perform a recursive search - default False
-    hook           -- a hook function to be called for every match. The
-                      function will be called with the following arguments
-                      (in the order listed):
-                        f: full path to the file/directory match
-                        pkg: the package name
-                        file_regex: as above
-                        output_pattern: as above
-                        modulename: the module name derived using file_regex
-    extra_depends  -- extra runtime dependencies (RDEPENDS) to be set for
-                      all packages. The default value of None causes a
-                      dependency on the main package (${PN}) - if you do
-                      not want this, pass '' for this parameter.
-    aux_files_pattern -- extra item(s) to be added to FILES for each
-                      package. Can be a single string item or a list of
-                      strings for multiple items.  Must include %s.
-    postrm         -- postrm script to use for all packages (as a string)
-    allow_dirs     -- True allow directories to be matched - default False
-    prepend        -- if True, prepend created packages to PACKAGES instead
-                      of the default False which appends them
-    match_path     -- match file_regex on the whole relative path to the
-                      root rather than just the file name
-    aux_files_pattern_verbatim -- extra item(s) to be added to FILES for
-                      each package, using the actual derived module name
-                      rather than converting it to something legal for a
-                      package name. Can be a single string item or a list
-                      of strings for multiple items. Must include %s.
-    allow_links    -- True to allow symlinks to be matched - default False
-    summary        -- Summary to set for each package. Must include %s;
-                      defaults to description if not set.
-
-    """
-
-    dvar = d.getVar('PKGD')
-    root = d.expand(root)
-    output_pattern = d.expand(output_pattern)
-    extra_depends = d.expand(extra_depends)
-
-    # If the root directory doesn't exist, don't error out later but silently do
-    # no splitting.
-    if not os.path.exists(dvar + root):
-        return []
-
-    ml = d.getVar("MLPREFIX")
-    if ml:
-        if not output_pattern.startswith(ml):
-            output_pattern = ml + output_pattern
-
-        newdeps = []
-        for dep in (extra_depends or "").split():
-            if dep.startswith(ml):
-                newdeps.append(dep)
-            else:
-                newdeps.append(ml + dep)
-        if newdeps:
-            extra_depends = " ".join(newdeps)
-
-
-    packages = d.getVar('PACKAGES').split()
-    split_packages = set()
-
-    if postinst:
-        postinst = '#!/bin/sh\n' + postinst + '\n'
-    if postrm:
-        postrm = '#!/bin/sh\n' + postrm + '\n'
-    if not recursive:
-        objs = os.listdir(dvar + root)
-    else:
-        objs = []
-        for walkroot, dirs, files in os.walk(dvar + root):
-            for file in files:
-                relpath = os.path.join(walkroot, file).replace(dvar + root + '/', '', 1)
-                if relpath:
-                    objs.append(relpath)
-
-    if extra_depends == None:
-        extra_depends = d.getVar("PN")
-
-    if not summary:
-        summary = description
-
-    for o in sorted(objs):
-        import re, stat
-        if match_path:
-            m = re.match(file_regex, o)
-        else:
-            m = re.match(file_regex, os.path.basename(o))
-
-        if not m:
-            continue
-        f = os.path.join(dvar + root, o)
-        mode = os.lstat(f).st_mode
-        if not (stat.S_ISREG(mode) or (allow_links and stat.S_ISLNK(mode)) or (allow_dirs and stat.S_ISDIR(mode))):
-            continue
-        on = legitimize_package_name(m.group(1))
-        pkg = output_pattern % on
-        split_packages.add(pkg)
-        if not pkg in packages:
-            if prepend:
-                packages = [pkg] + packages
-            else:
-                packages.append(pkg)
-        oldfiles = d.getVar('FILES:' + pkg)
-        newfile = os.path.join(root, o)
-        # These names will be passed through glob() so if the filename actually
-        # contains * or ? (rare, but possible) we need to handle that specially
-        newfile = newfile.replace('*', '[*]')
-        newfile = newfile.replace('?', '[?]')
-        if not oldfiles:
-            the_files = [newfile]
-            if aux_files_pattern:
-                if type(aux_files_pattern) is list:
-                    for fp in aux_files_pattern:
-                        the_files.append(fp % on)
-                else:
-                    the_files.append(aux_files_pattern % on)
-            if aux_files_pattern_verbatim:
-                if type(aux_files_pattern_verbatim) is list:
-                    for fp in aux_files_pattern_verbatim:
-                        the_files.append(fp % m.group(1))
-                else:
-                    the_files.append(aux_files_pattern_verbatim % m.group(1))
-            d.setVar('FILES:' + pkg, " ".join(the_files))
-        else:
-            d.setVar('FILES:' + pkg, oldfiles + " " + newfile)
-        if extra_depends != '':
-            d.appendVar('RDEPENDS:' + pkg, ' ' + extra_depends)
-        if not d.getVar('DESCRIPTION:' + pkg):
-            d.setVar('DESCRIPTION:' + pkg, description % on)
-        if not d.getVar('SUMMARY:' + pkg):
-            d.setVar('SUMMARY:' + pkg, summary % on)
-        if postinst:
-            d.setVar('pkg_postinst:' + pkg, postinst)
-        if postrm:
-            d.setVar('pkg_postrm:' + pkg, postrm)
-        if callable(hook):
-            hook(f, pkg, file_regex, output_pattern, m.group(1))
-
-    d.setVar('PACKAGES', ' '.join(packages))
-    return list(split_packages)
-
-PACKAGE_DEPENDS += "file-native"
-
-python () {
-    if d.getVar('PACKAGES') != '':
-        deps = ""
-        for dep in (d.getVar('PACKAGE_DEPENDS') or "").split():
-            deps += " %s:do_populate_sysroot" % dep
-        if d.getVar('PACKAGE_MINIDEBUGINFO') == '1':
-            deps += ' xz-native:do_populate_sysroot'
-        d.appendVarFlag('do_package', 'depends', deps)
-
-        # shlibs requires any DEPENDS to have already packaged for the *.list files
-        d.appendVarFlag('do_package', 'deptask', " do_packagedata")
-}
-
-# Get a list of files from file vars by searching files under current working directory
-# The list contains symlinks, directories and normal files.
-def files_from_filevars(filevars):
-    import os,glob
-    cpath = oe.cachedpath.CachedPath()
-    files = []
-    for f in filevars:
-        if os.path.isabs(f):
-            f = '.' + f
-        if not f.startswith("./"):
-            f = './' + f
-        globbed = glob.glob(f)
-        if globbed:
-            if [ f ] != globbed:
-                files += globbed
-                continue
-        files.append(f)
-
-    symlink_paths = []
-    for ind, f in enumerate(files):
-        # Handle directory symlinks. Truncate path to the lowest level symlink
-        parent = ''
-        for dirname in f.split('/')[:-1]:
-            parent = os.path.join(parent, dirname)
-            if dirname == '.':
-                continue
-            if cpath.islink(parent):
-                bb.warn("FILES contains file '%s' which resides under a "
-                        "directory symlink. Please fix the recipe and use the "
-                        "real path for the file." % f[1:])
-                symlink_paths.append(f)
-                files[ind] = parent
-                f = parent
-                break
-
-        if not cpath.islink(f):
-            if cpath.isdir(f):
-                newfiles = [ os.path.join(f,x) for x in os.listdir(f) ]
-                if newfiles:
-                    files += newfiles
-
-    return files, symlink_paths
-
-# Called in package_<rpm,ipk,deb>.bbclass to get the correct list of configuration files
-def get_conffiles(pkg, d):
-    pkgdest = d.getVar('PKGDEST')
-    root = os.path.join(pkgdest, pkg)
-    cwd = os.getcwd()
-    os.chdir(root)
-
-    conffiles = d.getVar('CONFFILES:%s' % pkg);
-    if conffiles == None:
-        conffiles = d.getVar('CONFFILES')
-    if conffiles == None:
-        conffiles = ""
-    conffiles = conffiles.split()
-    conf_orig_list = files_from_filevars(conffiles)[0]
-
-    # Remove links and directories from conf_orig_list to get conf_list which only contains normal files
-    conf_list = []
-    for f in conf_orig_list:
-        if os.path.isdir(f):
-            continue
-        if os.path.islink(f):
-            continue
-        if not os.path.exists(f):
-            continue
-        conf_list.append(f)
-
-    # Remove the leading './'
-    for i in range(0, len(conf_list)):
-        conf_list[i] = conf_list[i][1:]
-
-    os.chdir(cwd)
-    return conf_list
-
-def checkbuildpath(file, d):
-    tmpdir = d.getVar('TMPDIR')
-    with open(file) as f:
-        file_content = f.read()
-        if tmpdir in file_content:
-            return True
-
-    return False
-
-def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
-    debugfiles = {}
-
-    for line in dwarfsrcfiles_output.splitlines():
-        if line.startswith("\t"):
-            debugfiles[os.path.normpath(line.split()[0])] = ""
-
-    return debugfiles.keys()
-
-def source_info(file, d, fatal=True):
-    import subprocess
-
-    cmd = ["dwarfsrcfiles", file]
-    try:
-        output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)
-        retval = 0
-    except subprocess.CalledProcessError as exc:
-        output = exc.output
-        retval = exc.returncode
-
-    # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure
-    if retval != 0 and retval != 255:
-        msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "")
-        if fatal:
-            bb.fatal(msg)
-        bb.note(msg)
-
-    debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
-
-    return list(debugsources)
-
-def splitdebuginfo(file, dvar, dv, d):
-    # Function to split a single file into two components, one is the stripped
-    # target system binary, the other contains any debugging information. The
-    # two files are linked to reference each other.
-    #
-    # return a mapping of files:debugsources
-
-    import stat
-    import subprocess
-
-    src = file[len(dvar):]
-    dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"]
-    debugfile = dvar + dest
-    sources = []
-
-    if file.endswith(".ko") and file.find("/lib/modules/") != -1:
-        if oe.package.is_kernel_module_signed(file):
-            bb.debug(1, "Skip strip on signed module %s" % file)
-            return (file, sources)
-
-    # Split the file...
-    bb.utils.mkdirhier(os.path.dirname(debugfile))
-    #bb.note("Split %s -> %s" % (file, debugfile))
-    # Only store off the hard link reference if we successfully split!
-
-    dvar = d.getVar('PKGD')
-    objcopy = d.getVar("OBJCOPY")
-
-    newmode = None
-    if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
-        origmode = os.stat(file)[stat.ST_MODE]
-        newmode = origmode | stat.S_IWRITE | stat.S_IREAD
-        os.chmod(file, newmode)
-
-    # We need to extract the debug src information here...
-    if dv["srcdir"]:
-        sources = source_info(file, d)
-
-    bb.utils.mkdirhier(os.path.dirname(debugfile))
-
-    subprocess.check_output([objcopy, '--only-keep-debug', file, debugfile], stderr=subprocess.STDOUT)
-
-    # Set the debuglink to have the view of the file path on the target
-    subprocess.check_output([objcopy, '--add-gnu-debuglink', debugfile, file], stderr=subprocess.STDOUT)
-
-    if newmode:
-        os.chmod(file, origmode)
-
-    return (file, sources)
-
-def splitstaticdebuginfo(file, dvar, dv, d):
-    # Unlike the function above, there is no way to split a static library
-    # two components.  So to get similar results we will copy the unmodified
-    # static library (containing the debug symbols) into a new directory.
-    # We will then strip (preserving symbols) the static library in the
-    # typical location.
-    #
-    # return a mapping of files:debugsources
-
-    import stat
-
-    src = file[len(dvar):]
-    dest = dv["staticlibdir"] + os.path.dirname(src) + dv["staticdir"] + "/" + os.path.basename(src) + dv["staticappend"]
-    debugfile = dvar + dest
-    sources = []
-
-    # Copy the file...
-    bb.utils.mkdirhier(os.path.dirname(debugfile))
-    #bb.note("Copy %s -> %s" % (file, debugfile))
-
-    dvar = d.getVar('PKGD')
-
-    newmode = None
-    if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
-        origmode = os.stat(file)[stat.ST_MODE]
-        newmode = origmode | stat.S_IWRITE | stat.S_IREAD
-        os.chmod(file, newmode)
-
-    # We need to extract the debug src information here...
-    if dv["srcdir"]:
-        sources = source_info(file, d)
-
-    bb.utils.mkdirhier(os.path.dirname(debugfile))
-
-    # Copy the unmodified item to the debug directory
-    shutil.copy2(file, debugfile)
-
-    if newmode:
-        os.chmod(file, origmode)
-
-    return (file, sources)
-
-def inject_minidebuginfo(file, dvar, dv, d):
-    # Extract just the symbols from debuginfo into minidebuginfo,
-    # compress it with xz and inject it back into the binary in a .gnu_debugdata section.
-    # https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html
-
-    import subprocess
-
-    readelf = d.getVar('READELF')
-    nm = d.getVar('NM')
-    objcopy = d.getVar('OBJCOPY')
-
-    minidebuginfodir = d.expand('${WORKDIR}/minidebuginfo')
-
-    src = file[len(dvar):]
-    dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"]
-    debugfile = dvar + dest
-    minidebugfile = minidebuginfodir + src + '.minidebug'
-    bb.utils.mkdirhier(os.path.dirname(minidebugfile))
-
-    # If we didn't produce debuginfo for any reason, we can't produce minidebuginfo either
-    # so skip it.
-    if not os.path.exists(debugfile):
-        bb.debug(1, 'ELF file {} has no debuginfo, skipping minidebuginfo injection'.format(file))
-        return
-
-    # Find non-allocated PROGBITS, NOTE, and NOBITS sections in the debuginfo.
-    # We will exclude all of these from minidebuginfo to save space.
-    remove_section_names = []
-    for line in subprocess.check_output([readelf, '-W', '-S', debugfile], universal_newlines=True).splitlines():
-        fields = line.split()
-        if len(fields) < 8:
-            continue
-        name = fields[0]
-        type = fields[1]
-        flags = fields[7]
-        # .debug_ sections will be removed by objcopy -S so no need to explicitly remove them
-        if name.startswith('.debug_'):
-            continue
-        if 'A' not in flags and type in ['PROGBITS', 'NOTE', 'NOBITS']:
-            remove_section_names.append(name)
-
-    # List dynamic symbols in the binary. We can exclude these from minidebuginfo
-    # because they are always present in the binary.
-    dynsyms = set()
-    for line in subprocess.check_output([nm, '-D', file, '--format=posix', '--defined-only'], universal_newlines=True).splitlines():
-        dynsyms.add(line.split()[0])
-
-    # Find all function symbols from debuginfo which aren't in the dynamic symbols table.
-    # These are the ones we want to keep in minidebuginfo.
-    keep_symbols_file = minidebugfile + '.symlist'
-    found_any_symbols = False
-    with open(keep_symbols_file, 'w') as f:
-        for line in subprocess.check_output([nm, debugfile, '--format=sysv', '--defined-only'], universal_newlines=True).splitlines():
-            fields = line.split('|')
-            if len(fields) < 7:
-                continue
-            name = fields[0].strip()
-            type = fields[3].strip()
-            if type == 'FUNC' and name not in dynsyms:
-                f.write('{}\n'.format(name))
-                found_any_symbols = True
-
-    if not found_any_symbols:
-        bb.debug(1, 'ELF file {} contains no symbols, skipping minidebuginfo injection'.format(file))
-        return
-
-    bb.utils.remove(minidebugfile)
-    bb.utils.remove(minidebugfile + '.xz')
-
-    subprocess.check_call([objcopy, '-S'] +
-                          ['--remove-section={}'.format(s) for s in remove_section_names] +
-                          ['--keep-symbols={}'.format(keep_symbols_file), debugfile, minidebugfile])
-
-    subprocess.check_call(['xz', '--keep', minidebugfile])
-
-    subprocess.check_call([objcopy, '--add-section', '.gnu_debugdata={}.xz'.format(minidebugfile), file])
-
-def copydebugsources(debugsrcdir, sources, d):
-    # The debug src information written out to sourcefile is further processed
-    # and copied to the destination here.
-
-    import stat
-    import subprocess
-
-    if debugsrcdir and sources:
-        sourcefile = d.expand("${WORKDIR}/debugsources.list")
-        bb.utils.remove(sourcefile)
-
-        # filenames are null-separated - this is an artefact of the previous use
-        # of rpm's debugedit, which was writing them out that way, and the code elsewhere
-        # is still assuming that.
-        debuglistoutput = '\0'.join(sources) + '\0'
-        with open(sourcefile, 'a') as sf:
-           sf.write(debuglistoutput)
-
-        dvar = d.getVar('PKGD')
-        strip = d.getVar("STRIP")
-        objcopy = d.getVar("OBJCOPY")
-        workdir = d.getVar("WORKDIR")
-        sdir = d.getVar("S")
-        sparentdir = os.path.dirname(os.path.dirname(sdir))
-        sbasedir = os.path.basename(os.path.dirname(sdir)) + "/" + os.path.basename(sdir)
-        workparentdir = os.path.dirname(os.path.dirname(workdir))
-        workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)
-
-        # If S isnt based on WORKDIR we can infer our sources are located elsewhere,
-        # e.g. using externalsrc; use S as base for our dirs
-        if workdir in sdir or 'work-shared' in sdir:
-            basedir = workbasedir
-            parentdir = workparentdir
-        else:
-            basedir = sbasedir
-            parentdir = sparentdir
-
-        # If build path exists in sourcefile, it means toolchain did not use
-        # -fdebug-prefix-map to compile
-        if checkbuildpath(sourcefile, d):
-            localsrc_prefix = parentdir + "/"
-        else:
-            localsrc_prefix = "/usr/src/debug/"
-
-        nosuchdir = []
-        basepath = dvar
-        for p in debugsrcdir.split("/"):
-            basepath = basepath + "/" + p
-            if not cpath.exists(basepath):
-                nosuchdir.append(basepath)
-        bb.utils.mkdirhier(basepath)
-        cpath.updatecache(basepath)
-
-        # Ignore files from the recipe sysroots (target and native)
-        processdebugsrc =  "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((<internal>|<built-in>)$|/.*recipe-sysroot.*/)' | "
-        # We need to ignore files that are not actually ours
-        # we do this by only paying attention to items from this package
-        processdebugsrc += "fgrep -zw '%s' | "
-        # Remove prefix in the source paths
-        processdebugsrc += "sed 's#%s##g' | "
-        processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
-
-        cmd = processdebugsrc % (sourcefile, basedir, localsrc_prefix, parentdir, dvar, debugsrcdir)
-        try:
-            subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-        except subprocess.CalledProcessError:
-            # Can "fail" if internal headers/transient sources are attempted
-            pass
-
-        # cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced.
-        # Work around this by manually finding and copying any symbolic links that made it through.
-        cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s')" % \
-                (dvar, debugsrcdir, dvar, debugsrcdir, parentdir, dvar, debugsrcdir)
-        subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
-
-        # debugsources.list may be polluted from the host if we used externalsrc,
-        # cpio uses copy-pass and may have just created a directory structure
-        # matching the one from the host, if thats the case move those files to
-        # debugsrcdir to avoid host contamination.
-        # Empty dir structure will be deleted in the next step.
-
-        # Same check as above for externalsrc
-        if workdir not in sdir:
-            if os.path.exists(dvar + debugsrcdir + sdir):
-                cmd = "mv %s%s%s/* %s%s" % (dvar, debugsrcdir, sdir, dvar,debugsrcdir)
-                subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
-        # The copy by cpio may have resulted in some empty directories!  Remove these
-        cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir)
-        subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
-        # Also remove debugsrcdir if its empty
-        for p in nosuchdir[::-1]:
-            if os.path.exists(p) and not os.listdir(p):
-                os.rmdir(p)
-
-#
-# Package data handling routines
-#
-
-def get_package_mapping (pkg, basepkg, d, depversions=None):
-    import oe.packagedata
-
-    data = oe.packagedata.read_subpkgdata(pkg, d)
-    key = "PKG:%s" % pkg
-
-    if key in data:
-        if bb.data.inherits_class('allarch', d) and bb.data.inherits_class('packagegroup', d) and pkg != data[key]:
-            bb.error("An allarch packagegroup shouldn't depend on packages which are dynamically renamed (%s to %s)" % (pkg, data[key]))
-        # Have to avoid undoing the write_extra_pkgs(global_variants...)
-        if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \
-            and data[key] == basepkg:
-            return pkg
-        if depversions == []:
-            # Avoid returning a mapping if the renamed package rprovides its original name
-            rprovkey = "RPROVIDES:%s" % pkg
-            if rprovkey in data:
-                if pkg in bb.utils.explode_dep_versions2(data[rprovkey]):
-                    bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg))
-                    return pkg
-        # Do map to rewritten package name
-        return data[key]
-
-    return pkg
-
-def get_package_additional_metadata (pkg_type, d):
-    base_key = "PACKAGE_ADD_METADATA"
-    for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key):
-        if d.getVar(key, False) is None:
-            continue
-        d.setVarFlag(key, "type", "list")
-        if d.getVarFlag(key, "separator") is None:
-            d.setVarFlag(key, "separator", "\\n")
-        metadata_fields = [field.strip() for field in oe.data.typed_value(key, d)]
-        return "\n".join(metadata_fields).strip()
-
-def runtime_mapping_rename (varname, pkg, d):
-    #bb.note("%s before: %s" % (varname, d.getVar(varname)))
-
-    new_depends = {}
-    deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "")
-    for depend, depversions in deps.items():
-        new_depend = get_package_mapping(depend, pkg, d, depversions)
-        if depend != new_depend:
-            bb.note("package name mapping done: %s -> %s" % (depend, new_depend))
-        new_depends[new_depend] = deps[depend]
-
-    d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False))
-
-    #bb.note("%s after: %s" % (varname, d.getVar(varname)))
-
-#
-# Used by do_packagedata (and possibly other routines post do_package)
-#
-
-PRSERV_ACTIVE = "${@bool(d.getVar("PRSERV_HOST"))}"
-PRSERV_ACTIVE[vardepvalue] = "${PRSERV_ACTIVE}"
-package_get_auto_pr[vardepsexclude] = "BB_TASKDEPDATA"
-package_get_auto_pr[vardeps] += "PRSERV_ACTIVE"
-python package_get_auto_pr() {
-    import oe.prservice
-
-    def get_do_package_hash(pn):
-        if d.getVar("BB_RUNTASK") != "do_package":
-            taskdepdata = d.getVar("BB_TASKDEPDATA", False)
-            for dep in taskdepdata:
-                if taskdepdata[dep][1] == "do_package" and taskdepdata[dep][0] == pn:
-                    return taskdepdata[dep][6]
-        return None
-
-    # Support per recipe PRSERV_HOST
-    pn = d.getVar('PN')
-    host = d.getVar("PRSERV_HOST_" + pn)
-    if not (host is None):
-        d.setVar("PRSERV_HOST", host)
-
-    pkgv = d.getVar("PKGV")
-
-    # PR Server not active, handle AUTOINC
-    if not d.getVar('PRSERV_HOST'):
-        d.setVar("PRSERV_PV_AUTOINC", "0")
-        return
-
-    auto_pr = None
-    pv = d.getVar("PV")
-    version = d.getVar("PRAUTOINX")
-    pkgarch = d.getVar("PACKAGE_ARCH")
-    checksum = get_do_package_hash(pn)
-
-    # If do_package isn't in the dependencies, we can't get the checksum...
-    if not checksum:
-        bb.warn('Task %s requested do_package unihash, but it was not available.' % d.getVar('BB_RUNTASK'))
-        #taskdepdata = d.getVar("BB_TASKDEPDATA", False)
-        #for dep in taskdepdata:
-        #    bb.warn('%s:%s = %s' % (taskdepdata[dep][0], taskdepdata[dep][1], taskdepdata[dep][6]))
-        return
-
-    if d.getVar('PRSERV_LOCKDOWN'):
-        auto_pr = d.getVar('PRAUTO_' + version + '_' + pkgarch) or d.getVar('PRAUTO_' + version) or None
-        if auto_pr is None:
-            bb.fatal("Can NOT get PRAUTO from lockdown exported file")
-        d.setVar('PRAUTO',str(auto_pr))
-        return
-
-    try:
-        conn = oe.prservice.prserv_make_conn(d)
-        if conn is not None:
-            if "AUTOINC" in pkgv:
-                srcpv = bb.fetch2.get_srcrev(d)
-                base_ver = "AUTOINC-%s" % version[:version.find(srcpv)]
-                value = conn.getPR(base_ver, pkgarch, srcpv)
-                d.setVar("PRSERV_PV_AUTOINC", str(value))
-
-            auto_pr = conn.getPR(version, pkgarch, checksum)
-            conn.close()
-    except Exception as e:
-        bb.fatal("Can NOT get PRAUTO, exception %s" %  str(e))
-    if auto_pr is None:
-        bb.fatal("Can NOT get PRAUTO from remote PR service")
-    d.setVar('PRAUTO',str(auto_pr))
-}
-
-#
-# Package functions suitable for inclusion in PACKAGEFUNCS
-#
-
-python package_convert_pr_autoinc() {
-    pkgv = d.getVar("PKGV")
-
-    # Adjust pkgv as necessary...
-    if 'AUTOINC' in pkgv:
-        d.setVar("PKGV", pkgv.replace("AUTOINC", "${PRSERV_PV_AUTOINC}"))
-
-    # Change PRSERV_PV_AUTOINC and EXTENDPRAUTO usage to special values
-    d.setVar('PRSERV_PV_AUTOINC', '@PRSERV_PV_AUTOINC@')
-    d.setVar('EXTENDPRAUTO', '@EXTENDPRAUTO@')
-}
-
-LOCALEBASEPN ??= "${PN}"
-
-python package_do_split_locales() {
-    if (d.getVar('PACKAGE_NO_LOCALE') == '1'):
-        bb.debug(1, "package requested not splitting locales")
-        return
-
-    packages = (d.getVar('PACKAGES') or "").split()
-
-    datadir = d.getVar('datadir')
-    if not datadir:
-        bb.note("datadir not defined")
-        return
-
-    dvar = d.getVar('PKGD')
-    pn = d.getVar('LOCALEBASEPN')
-
-    if pn + '-locale' in packages:
-        packages.remove(pn + '-locale')
-
-    localedir = os.path.join(dvar + datadir, 'locale')
-
-    if not cpath.isdir(localedir):
-        bb.debug(1, "No locale files in this package")
-        return
-
-    locales = os.listdir(localedir)
-
-    summary = d.getVar('SUMMARY') or pn
-    description = d.getVar('DESCRIPTION') or ""
-    locale_section = d.getVar('LOCALE_SECTION')
-    mlprefix = d.getVar('MLPREFIX') or ""
-    for l in sorted(locales):
-        ln = legitimize_package_name(l)
-        pkg = pn + '-locale-' + ln
-        packages.append(pkg)
-        d.setVar('FILES:' + pkg, os.path.join(datadir, 'locale', l))
-        d.setVar('RRECOMMENDS:' + pkg, '%svirtual-locale-%s' % (mlprefix, ln))
-        d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, mlprefix, ln))
-        d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l))
-        d.setVar('DESCRIPTION:' + pkg, '%s  This package contains language translation files for the %s locale.' % (description, l))
-        if locale_section:
-            d.setVar('SECTION:' + pkg, locale_section)
-
-    d.setVar('PACKAGES', ' '.join(packages))
-
-    # Disabled by RP 18/06/07
-    # Wildcards aren't supported in debian
-    # They break with ipkg since glibc-locale* will mean that
-    # glibc-localedata-translit* won't install as a dependency
-    # for some other package which breaks meta-toolchain
-    # Probably breaks since virtual-locale- isn't provided anywhere
-    #rdep = (d.getVar('RDEPENDS:%s' % pn) or "").split()
-    #rdep.append('%s-locale*' % pn)
-    #d.setVar('RDEPENDS:%s' % pn, ' '.join(rdep))
-}
-
-python perform_packagecopy () {
-    import subprocess
-    import shutil
-
-    dest = d.getVar('D')
-    dvar = d.getVar('PKGD')
-
-    # Start by package population by taking a copy of the installed
-    # files to operate on
-    # Preserve sparse files and hard links
-    cmd = 'tar --exclude=./sysroot-only -cf - -C %s -p -S . | tar -xf - -C %s' % (dest, dvar)
-    subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
-    # replace RPATHs for the nativesdk binaries, to make them relocatable
-    if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d):
-        rpath_replace (dvar, d)
-}
-perform_packagecopy[cleandirs] = "${PKGD}"
-perform_packagecopy[dirs] = "${PKGD}"
-
-# We generate a master list of directories to process, we start by
-# seeding this list with reasonable defaults, then load from
-# the fs-perms.txt files
-python fixup_perms () {
-    import pwd, grp
-
-    # init using a string with the same format as a line as documented in
-    # the fs-perms.txt file
-    # <path> <mode> <uid> <gid> <walk> <fmode> <fuid> <fgid>
-    # <path> link <link target>
-    #
-    # __str__ can be used to print out an entry in the input format
-    #
-    # if fs_perms_entry.path is None:
-    #    an error occurred
-    # if fs_perms_entry.link, you can retrieve:
-    #    fs_perms_entry.path = path
-    #    fs_perms_entry.link = target of link
-    # if not fs_perms_entry.link, you can retrieve:
-    #    fs_perms_entry.path = path
-    #    fs_perms_entry.mode = expected dir mode or None
-    #    fs_perms_entry.uid = expected uid or -1
-    #    fs_perms_entry.gid = expected gid or -1
-    #    fs_perms_entry.walk = 'true' or something else
-    #    fs_perms_entry.fmode = expected file mode or None
-    #    fs_perms_entry.fuid = expected file uid or -1
-    #    fs_perms_entry_fgid = expected file gid or -1
-    class fs_perms_entry():
-        def __init__(self, line):
-            lsplit = line.split()
-            if len(lsplit) == 3 and lsplit[1].lower() == "link":
-                self._setlink(lsplit[0], lsplit[2])
-            elif len(lsplit) == 8:
-                self._setdir(lsplit[0], lsplit[1], lsplit[2], lsplit[3], lsplit[4], lsplit[5], lsplit[6], lsplit[7])
-            else:
-                msg = "Fixup Perms: invalid config line %s" % line
-                oe.qa.handle_error("perm-config", msg, d)
-                self.path = None
-                self.link = None
-
-        def _setdir(self, path, mode, uid, gid, walk, fmode, fuid, fgid):
-            self.path = os.path.normpath(path)
-            self.link = None
-            self.mode = self._procmode(mode)
-            self.uid  = self._procuid(uid)
-            self.gid  = self._procgid(gid)
-            self.walk = walk.lower()
-            self.fmode = self._procmode(fmode)
-            self.fuid = self._procuid(fuid)
-            self.fgid = self._procgid(fgid)
-
-        def _setlink(self, path, link):
-            self.path = os.path.normpath(path)
-            self.link = link
-
-        def _procmode(self, mode):
-            if not mode or (mode and mode == "-"):
-                return None
-            else:
-                return int(mode,8)
-
-        # Note uid/gid -1 has special significance in os.lchown
-        def _procuid(self, uid):
-            if uid is None or uid == "-":
-                return -1
-            elif uid.isdigit():
-                return int(uid)
-            else:
-                return pwd.getpwnam(uid).pw_uid
-
-        def _procgid(self, gid):
-            if gid is None or gid == "-":
-                return -1
-            elif gid.isdigit():
-                return int(gid)
-            else:
-                return grp.getgrnam(gid).gr_gid
-
-        # Use for debugging the entries
-        def __str__(self):
-            if self.link:
-                return "%s link %s" % (self.path, self.link)
-            else:
-                mode = "-"
-                if self.mode:
-                    mode = "0%o" % self.mode
-                fmode = "-"
-                if self.fmode:
-                    fmode = "0%o" % self.fmode
-                uid = self._mapugid(self.uid)
-                gid = self._mapugid(self.gid)
-                fuid = self._mapugid(self.fuid)
-                fgid = self._mapugid(self.fgid)
-                return "%s %s %s %s %s %s %s %s" % (self.path, mode, uid, gid, self.walk, fmode, fuid, fgid)
-
-        def _mapugid(self, id):
-            if id is None or id == -1:
-                return "-"
-            else:
-                return "%d" % id
-
-    # Fix the permission, owner and group of path
-    def fix_perms(path, mode, uid, gid, dir):
-        if mode and not os.path.islink(path):
-            #bb.note("Fixup Perms: chmod 0%o %s" % (mode, dir))
-            os.chmod(path, mode)
-        # -1 is a special value that means don't change the uid/gid
-        # if they are BOTH -1, don't bother to lchown
-        if not (uid == -1 and gid == -1):
-            #bb.note("Fixup Perms: lchown %d:%d %s" % (uid, gid, dir))
-            os.lchown(path, uid, gid)
-
-    # Return a list of configuration files based on either the default
-    # files/fs-perms.txt or the contents of FILESYSTEM_PERMS_TABLES
-    # paths are resolved via BBPATH
-    def get_fs_perms_list(d):
-        str = ""
-        bbpath = d.getVar('BBPATH')
-        fs_perms_tables = d.getVar('FILESYSTEM_PERMS_TABLES') or ""
-        for conf_file in fs_perms_tables.split():
-            confpath = bb.utils.which(bbpath, conf_file)
-            if confpath:
-                str += " %s" % bb.utils.which(bbpath, conf_file)
-            else:
-                bb.warn("cannot find %s specified in FILESYSTEM_PERMS_TABLES" % conf_file)
-        return str
-
-
-
-    dvar = d.getVar('PKGD')
-
-    fs_perms_table = {}
-    fs_link_table = {}
-
-    # By default all of the standard directories specified in
-    # bitbake.conf will get 0755 root:root.
-    target_path_vars = [    'base_prefix',
-                'prefix',
-                'exec_prefix',
-                'base_bindir',
-                'base_sbindir',
-                'base_libdir',
-                'datadir',
-                'sysconfdir',
-                'servicedir',
-                'sharedstatedir',
-                'localstatedir',
-                'infodir',
-                'mandir',
-                'docdir',
-                'bindir',
-                'sbindir',
-                'libexecdir',
-                'libdir',
-                'includedir',
-                'oldincludedir' ]
-
-    for path in target_path_vars:
-        dir = d.getVar(path) or ""
-        if dir == "":
-            continue
-        fs_perms_table[dir] = fs_perms_entry(d.expand("%s 0755 root root false - - -" % (dir)))
-
-    # Now we actually load from the configuration files
-    for conf in get_fs_perms_list(d).split():
-        if not os.path.exists(conf):
-            continue
-        with open(conf) as f:
-            for line in f:
-                if line.startswith('#'):
-                    continue
-                lsplit = line.split()
-                if len(lsplit) == 0:
-                    continue
-                if len(lsplit) != 8 and not (len(lsplit) == 3 and lsplit[1].lower() == "link"):
-                    msg = "Fixup perms: %s invalid line: %s" % (conf, line)
-                    oe.qa.handle_error("perm-line", msg, d)
-                    continue
-                entry = fs_perms_entry(d.expand(line))
-                if entry and entry.path:
-                    if entry.link:
-                        fs_link_table[entry.path] = entry
-                        if entry.path in fs_perms_table:
-                            fs_perms_table.pop(entry.path)
-                    else:
-                        fs_perms_table[entry.path] = entry
-                        if entry.path in fs_link_table:
-                            fs_link_table.pop(entry.path)
-
-    # Debug -- list out in-memory table
-    #for dir in fs_perms_table:
-    #    bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir])))
-    #for link in fs_link_table:
-    #    bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link])))
-
-    # We process links first, so we can go back and fixup directory ownership
-    # for any newly created directories
-    # Process in sorted order so /run gets created before /run/lock, etc.
-    for entry in sorted(fs_link_table.values(), key=lambda x: x.link):
-        link = entry.link
-        dir = entry.path
-        origin = dvar + dir
-        if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)):
-            continue
-
-        if link[0] == "/":
-            target = dvar + link
-            ptarget = link
-        else:
-            target = os.path.join(os.path.dirname(origin), link)
-            ptarget = os.path.join(os.path.dirname(dir), link)
-        if os.path.exists(target):
-            msg = "Fixup Perms: Unable to correct directory link, target already exists: %s -> %s" % (dir, ptarget)
-            oe.qa.handle_error("perm-link", msg, d)
-            continue
-
-        # Create path to move directory to, move it, and then setup the symlink
-        bb.utils.mkdirhier(os.path.dirname(target))
-        #bb.note("Fixup Perms: Rename %s -> %s" % (dir, ptarget))
-        bb.utils.rename(origin, target)
-        #bb.note("Fixup Perms: Link %s -> %s" % (dir, link))
-        os.symlink(link, origin)
-
-    for dir in fs_perms_table:
-        origin = dvar + dir
-        if not (cpath.exists(origin) and cpath.isdir(origin)):
-            continue
-
-        fix_perms(origin, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir)
-
-        if fs_perms_table[dir].walk == 'true':
-            for root, dirs, files in os.walk(origin):
-                for dr in dirs:
-                    each_dir = os.path.join(root, dr)
-                    fix_perms(each_dir, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir)
-                for f in files:
-                    each_file = os.path.join(root, f)
-                    fix_perms(each_file, fs_perms_table[dir].fmode, fs_perms_table[dir].fuid, fs_perms_table[dir].fgid, dir)
-}
-
-def package_debug_vars(d):
-    # We default to '.debug' style
-    if d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-file-directory':
-        # Single debug-file-directory style debug info
-        debug_vars = {
-            "append": ".debug",
-            "staticappend": "",
-            "dir": "",
-            "staticdir": "",
-            "libdir": "/usr/lib/debug",
-            "staticlibdir": "/usr/lib/debug-static",
-            "srcdir": "/usr/src/debug",
-        }
-    elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-without-src':
-        # Original OE-core, a.k.a. ".debug", style debug info, but without sources in /usr/src/debug
-        debug_vars = {
-            "append": "",
-            "staticappend": "",
-            "dir": "/.debug",
-            "staticdir": "/.debug-static",
-            "libdir": "",
-            "staticlibdir": "",
-            "srcdir": "",
-        }
-    elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg':
-        debug_vars = {
-            "append": "",
-            "staticappend": "",
-            "dir": "/.debug",
-            "staticdir": "/.debug-static",
-            "libdir": "",
-            "staticlibdir": "",
-            "srcdir": "/usr/src/debug",
-        }
-    else:
-        # Original OE-core, a.k.a. ".debug", style debug info
-        debug_vars = {
-            "append": "",
-            "staticappend": "",
-            "dir": "/.debug",
-            "staticdir": "/.debug-static",
-            "libdir": "",
-            "staticlibdir": "",
-            "srcdir": "/usr/src/debug",
-        }
-
-    return debug_vars
-
-python split_and_strip_files () {
-    import stat, errno
-    import subprocess
-
-    dvar = d.getVar('PKGD')
-    pn = d.getVar('PN')
-    hostos = d.getVar('HOST_OS')
-
-    oldcwd = os.getcwd()
-    os.chdir(dvar)
-
-    dv = package_debug_vars(d)
-
-    #
-    # First lets figure out all of the files we may have to process ... do this only once!
-    #
-    elffiles = {}
-    symlinks = {}
-    staticlibs = []
-    inodes = {}
-    libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
-    baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir"))
-    skipfiles = (d.getVar("INHIBIT_PACKAGE_STRIP_FILES") or "").split()
-    if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1' or \
-            d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'):
-        checkelf = {}
-        checkelflinks = {}
-        for root, dirs, files in cpath.walk(dvar):
-            for f in files:
-                file = os.path.join(root, f)
-
-                # Skip debug files
-                if dv["append"] and file.endswith(dv["append"]):
-                    continue
-                if dv["dir"] and dv["dir"] in os.path.dirname(file[len(dvar):]):
-                    continue
-
-                if file in skipfiles:
-                    continue
-
-                if oe.package.is_static_lib(file):
-                    staticlibs.append(file)
-                    continue
-
-                try:
-                    ltarget = cpath.realpath(file, dvar, False)
-                    s = cpath.lstat(ltarget)
-                except OSError as e:
-                    (err, strerror) = e.args
-                    if err != errno.ENOENT:
-                        raise
-                    # Skip broken symlinks
-                    continue
-                if not s:
-                    continue
-                # Check its an executable
-                if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) \
-                        or (s[stat.ST_MODE] & stat.S_IXOTH) \
-                        or ((file.startswith(libdir) or file.startswith(baselibdir)) \
-                        and (".so" in f or ".node" in f)) \
-                        or (f.startswith('vmlinux') or ".ko" in f):
-
-                    if cpath.islink(file):
-                        checkelflinks[file] = ltarget
-                        continue
-                    # Use a reference of device ID and inode number to identify files
-                    file_reference = "%d_%d" % (s.st_dev, s.st_ino)
-                    checkelf[file] = (file, file_reference)
-
-        results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelflinks.values(), d)
-        results_map = {}
-        for (ltarget, elf_file) in results:
-            results_map[ltarget] = elf_file
-        for file in checkelflinks:
-            ltarget = checkelflinks[file]
-            # If it's a symlink, and points to an ELF file, we capture the readlink target
-            if results_map[ltarget]:
-                target = os.readlink(file)
-                #bb.note("Sym: %s (%d)" % (ltarget, results_map[ltarget]))
-                symlinks[file] = target
-
-        results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d)
-
-        # Sort results by file path. This ensures that the files are always
-        # processed in the same order, which is important to make sure builds
-        # are reproducible when dealing with hardlinks
-        results.sort(key=lambda x: x[0])
-
-        for (file, elf_file) in results:
-            # It's a file (or hardlink), not a link
-            # ...but is it ELF, and is it already stripped?
-            if elf_file & 1:
-                if elf_file & 2:
-                    if 'already-stripped' in (d.getVar('INSANE_SKIP:' + pn) or "").split():
-                        bb.note("Skipping file %s from %s for already-stripped QA test" % (file[len(dvar):], pn))
-                    else:
-                        msg = "File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dvar):], pn)
-                        oe.qa.handle_error("already-stripped", msg, d)
-                    continue
-
-                # At this point we have an unstripped elf file. We need to:
-                #  a) Make sure any file we strip is not hardlinked to anything else outside this tree
-                #  b) Only strip any hardlinked file once (no races)
-                #  c) Track any hardlinks between files so that we can reconstruct matching debug file hardlinks
-
-                # Use a reference of device ID and inode number to identify files
-                file_reference = checkelf[file][1]
-                if file_reference in inodes:
-                    os.unlink(file)
-                    os.link(inodes[file_reference][0], file)
-                    inodes[file_reference].append(file)
-                else:
-                    inodes[file_reference] = [file]
-                    # break hardlink
-                    bb.utils.break_hardlinks(file)
-                    elffiles[file] = elf_file
-                # Modified the file so clear the cache
-                cpath.updatecache(file)
-
-    def strip_pkgd_prefix(f):
-        nonlocal dvar
-
-        if f.startswith(dvar):
-            return f[len(dvar):]
-
-        return f
-
-    #
-    # First lets process debug splitting
-    #
-    if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'):
-        results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, dv, d))
-
-        if dv["srcdir"] and not hostos.startswith("mingw"):
-            if (d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'):
-                results = oe.utils.multiprocess_launch(splitstaticdebuginfo, staticlibs, d, extraargs=(dvar, dv, d))
-            else:
-                for file in staticlibs:
-                    results.append( (file,source_info(file, d)) )
-
-        d.setVar("PKGDEBUGSOURCES", {strip_pkgd_prefix(f): sorted(s) for f, s in results})
-
-        sources = set()
-        for r in results:
-            sources.update(r[1])
-
-        # Hardlink our debug symbols to the other hardlink copies
-        for ref in inodes:
-            if len(inodes[ref]) == 1:
-                continue
-
-            target = inodes[ref][0][len(dvar):]
-            for file in inodes[ref][1:]:
-                src = file[len(dvar):]
-                dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(target) + dv["append"]
-                fpath = dvar + dest
-                ftarget = dvar + dv["libdir"] + os.path.dirname(target) + dv["dir"] + "/" + os.path.basename(target) + dv["append"]
-                bb.utils.mkdirhier(os.path.dirname(fpath))
-                # Only one hardlink of separated debug info file in each directory
-                if not os.access(fpath, os.R_OK):
-                    #bb.note("Link %s -> %s" % (fpath, ftarget))
-                    os.link(ftarget, fpath)
-
-        # Create symlinks for all cases we were able to split symbols
-        for file in symlinks:
-            src = file[len(dvar):]
-            dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"]
-            fpath = dvar + dest
-            # Skip it if the target doesn't exist
-            try:
-                s = os.stat(fpath)
-            except OSError as e:
-                (err, strerror) = e.args
-                if err != errno.ENOENT:
-                    raise
-                continue
-
-            ltarget = symlinks[file]
-            lpath = os.path.dirname(ltarget)
-            lbase = os.path.basename(ltarget)
-            ftarget = ""
-            if lpath and lpath != ".":
-                ftarget += lpath + dv["dir"] + "/"
-            ftarget += lbase + dv["append"]
-            if lpath.startswith(".."):
-                ftarget = os.path.join("..", ftarget)
-            bb.utils.mkdirhier(os.path.dirname(fpath))
-            #bb.note("Symlink %s -> %s" % (fpath, ftarget))
-            os.symlink(ftarget, fpath)
-
-        # Process the dv["srcdir"] if requested...
-        # This copies and places the referenced sources for later debugging...
-        copydebugsources(dv["srcdir"], sources, d)
-    #
-    # End of debug splitting
-    #
-
-    #
-    # Now lets go back over things and strip them
-    #
-    if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1'):
-        strip = d.getVar("STRIP")
-        sfiles = []
-        for file in elffiles:
-            elf_file = int(elffiles[file])
-            #bb.note("Strip %s" % file)
-            sfiles.append((file, elf_file, strip))
-        if (d.getVar('PACKAGE_STRIP_STATIC') == '1' or d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'):
-            for f in staticlibs:
-                sfiles.append((f, 16, strip))
-
-        oe.utils.multiprocess_launch(oe.package.runstrip, sfiles, d)
-
-    # Build "minidebuginfo" and reinject it back into the stripped binaries
-    if d.getVar('PACKAGE_MINIDEBUGINFO') == '1':
-        oe.utils.multiprocess_launch(inject_minidebuginfo, list(elffiles), d,
-                                     extraargs=(dvar, dv, d))
-
-    #
-    # End of strip
-    #
-    os.chdir(oldcwd)
-}
-
-python populate_packages () {
-    import glob, re
-
-    workdir = d.getVar('WORKDIR')
-    outdir = d.getVar('DEPLOY_DIR')
-    dvar = d.getVar('PKGD')
-    packages = d.getVar('PACKAGES').split()
-    pn = d.getVar('PN')
-
-    bb.utils.mkdirhier(outdir)
-    os.chdir(dvar)
-    
-    autodebug = not (d.getVar("NOAUTOPACKAGEDEBUG") or False)
-
-    split_source_package = (d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg')
-
-    # If debug-with-srcpkg mode is enabled then add the source package if it
-    # doesn't exist and add the source file contents to the source package.
-    if split_source_package:
-        src_package_name = ('%s-src' % d.getVar('PN'))
-        if not src_package_name in packages:
-            packages.append(src_package_name)
-        d.setVar('FILES:%s' % src_package_name, '/usr/src/debug')
-
-    # Sanity check PACKAGES for duplicates
-    # Sanity should be moved to sanity.bbclass once we have the infrastructure
-    package_dict = {}
-
-    for i, pkg in enumerate(packages):
-        if pkg in package_dict:
-            msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg
-            oe.qa.handle_error("packages-list", msg, d)
-        # Ensure the source package gets the chance to pick up the source files
-        # before the debug package by ordering it first in PACKAGES. Whether it
-        # actually picks up any source files is controlled by
-        # PACKAGE_DEBUG_SPLIT_STYLE.
-        elif pkg.endswith("-src"):
-            package_dict[pkg] = (10, i)
-        elif autodebug and pkg.endswith("-dbg"):
-            package_dict[pkg] = (30, i)
-        else:
-            package_dict[pkg] = (50, i)
-    packages = sorted(package_dict.keys(), key=package_dict.get)
-    d.setVar('PACKAGES', ' '.join(packages))
-    pkgdest = d.getVar('PKGDEST')
-
-    seen = []
-
-    # os.mkdir masks the permissions with umask so we have to unset it first
-    oldumask = os.umask(0)
-
-    debug = []
-    for root, dirs, files in cpath.walk(dvar):
-        dir = root[len(dvar):]
-        if not dir:
-            dir = os.sep
-        for f in (files + dirs):
-            path = "." + os.path.join(dir, f)
-            if "/.debug/" in path or "/.debug-static/" in path or path.endswith("/.debug"):
-                debug.append(path)
-
-    for pkg in packages:
-        root = os.path.join(pkgdest, pkg)
-        bb.utils.mkdirhier(root)
-
-        filesvar = d.getVar('FILES:%s' % pkg) or ""
-        if "//" in filesvar:
-            msg = "FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg
-            oe.qa.handle_error("files-invalid", msg, d)
-            filesvar.replace("//", "/")
-
-        origfiles = filesvar.split()
-        files, symlink_paths = files_from_filevars(origfiles)
-
-        if autodebug and pkg.endswith("-dbg"):
-            files.extend(debug)
-
-        for file in files:
-            if (not cpath.islink(file)) and (not cpath.exists(file)):
-                continue
-            if file in seen:
-                continue
-            seen.append(file)
-
-            def mkdir(src, dest, p):
-                src = os.path.join(src, p)
-                dest = os.path.join(dest, p)
-                fstat = cpath.stat(src)
-                os.mkdir(dest)
-                os.chmod(dest, fstat.st_mode)
-                os.chown(dest, fstat.st_uid, fstat.st_gid)
-                if p not in seen:
-                    seen.append(p)
-                cpath.updatecache(dest)
-
-            def mkdir_recurse(src, dest, paths):
-                if cpath.exists(dest + '/' + paths):
-                    return
-                while paths.startswith("./"):
-                    paths = paths[2:]
-                p = "."
-                for c in paths.split("/"):
-                    p = os.path.join(p, c)
-                    if not cpath.exists(os.path.join(dest, p)):
-                        mkdir(src, dest, p)
-
-            if cpath.isdir(file) and not cpath.islink(file):
-                mkdir_recurse(dvar, root, file)
-                continue
-
-            mkdir_recurse(dvar, root, os.path.dirname(file))
-            fpath = os.path.join(root,file)
-            if not cpath.islink(file):
-                os.link(file, fpath)
-                continue
-            ret = bb.utils.copyfile(file, fpath)
-            if ret is False or ret == 0:
-                bb.fatal("File population failed")
-
-        # Check if symlink paths exist
-        for file in symlink_paths:
-            if not os.path.exists(os.path.join(root,file)):
-                bb.fatal("File '%s' cannot be packaged into '%s' because its "
-                         "parent directory structure does not exist. One of "
-                         "its parent directories is a symlink whose target "
-                         "directory is not included in the package." %
-                         (file, pkg))
-
-    os.umask(oldumask)
-    os.chdir(workdir)
-
-    # Handle excluding packages with incompatible licenses
-    package_list = []
-    for pkg in packages:
-        licenses = d.getVar('_exclude_incompatible-' + pkg)
-        if licenses:
-            msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, licenses)
-            oe.qa.handle_error("incompatible-license", msg, d)
-        else:
-            package_list.append(pkg)
-    d.setVar('PACKAGES', ' '.join(package_list))
-
-    unshipped = []
-    for root, dirs, files in cpath.walk(dvar):
-        dir = root[len(dvar):]
-        if not dir:
-            dir = os.sep
-        for f in (files + dirs):
-            path = os.path.join(dir, f)
-            if ('.' + path) not in seen:
-                unshipped.append(path)
-
-    if unshipped != []:
-        msg = pn + ": Files/directories were installed but not shipped in any package:"
-        if "installed-vs-shipped" in (d.getVar('INSANE_SKIP:' + pn) or "").split():
-            bb.note("Package %s skipping QA tests: installed-vs-shipped" % pn)
-        else:
-            for f in unshipped:
-                msg = msg + "\n  " + f
-            msg = msg + "\nPlease set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.\n"
-            msg = msg + "%s: %d installed and not shipped files." % (pn, len(unshipped))
-            oe.qa.handle_error("installed-vs-shipped", msg, d)
-}
-populate_packages[dirs] = "${D}"
-
-python package_fixsymlinks () {
-    import errno
-    pkgdest = d.getVar('PKGDEST')
-    packages = d.getVar("PACKAGES", False).split()
-
-    dangling_links = {}
-    pkg_files = {}
-    for pkg in packages:
-        dangling_links[pkg] = []
-        pkg_files[pkg] = []
-        inst_root = os.path.join(pkgdest, pkg)
-        for path in pkgfiles[pkg]:
-                rpath = path[len(inst_root):]
-                pkg_files[pkg].append(rpath)
-                rtarget = cpath.realpath(path, inst_root, True, assume_dir = True)
-                if not cpath.lexists(rtarget):
-                    dangling_links[pkg].append(os.path.normpath(rtarget[len(inst_root):]))
-
-    newrdepends = {}
-    for pkg in dangling_links:
-        for l in dangling_links[pkg]:
-            found = False
-            bb.debug(1, "%s contains dangling link %s" % (pkg, l))
-            for p in packages:
-                if l in pkg_files[p]:
-                        found = True
-                        bb.debug(1, "target found in %s" % p)
-                        if p == pkg:
-                            break
-                        if pkg not in newrdepends:
-                            newrdepends[pkg] = []
-                        newrdepends[pkg].append(p)
-                        break
-            if found == False:
-                bb.note("%s contains dangling symlink to %s" % (pkg, l))
-
-    for pkg in newrdepends:
-        rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "")
-        for p in newrdepends[pkg]:
-            if p not in rdepends:
-                rdepends[p] = []
-        d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False))
-}
-
-
-python package_package_name_hook() {
-    """
-    A package_name_hook function can be used to rewrite the package names by
-    changing PKG.  For an example, see debian.bbclass.
-    """
-    pass
-}
-
-EXPORT_FUNCTIONS package_name_hook
-
-
-PKGDESTWORK = "${WORKDIR}/pkgdata"
-
-PKGDATA_VARS = "PN PE PV PR PKGE PKGV PKGR LICENSE DESCRIPTION SUMMARY RDEPENDS RPROVIDES RRECOMMENDS RSUGGESTS RREPLACES RCONFLICTS SECTION PKG ALLOW_EMPTY FILES CONFFILES FILES_INFO PACKAGE_ADD_METADATA pkg_postinst pkg_postrm pkg_preinst pkg_prerm"
-
-python emit_pkgdata() {
-    from glob import glob
-    import json
-    import bb.compress.zstd
-
-    def process_postinst_on_target(pkg, mlprefix):
-        pkgval = d.getVar('PKG:%s' % pkg)
-        if pkgval is None:
-            pkgval = pkg
-
-        defer_fragment = """
-if [ -n "$D" ]; then
-    $INTERCEPT_DIR/postinst_intercept delay_to_first_boot %s mlprefix=%s
-    exit 0
-fi
-""" % (pkgval, mlprefix)
-
-        postinst = d.getVar('pkg_postinst:%s' % pkg)
-        postinst_ontarget = d.getVar('pkg_postinst_ontarget:%s' % pkg)
-
-        if postinst_ontarget:
-            bb.debug(1, 'adding deferred pkg_postinst_ontarget() to pkg_postinst() for %s' % pkg)
-            if not postinst:
-                postinst = '#!/bin/sh\n'
-            postinst += defer_fragment
-            postinst += postinst_ontarget
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-    def add_set_e_to_scriptlets(pkg):
-        for scriptlet_name in ('pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm'):
-            scriptlet = d.getVar('%s:%s' % (scriptlet_name, pkg))
-            if scriptlet:
-                scriptlet_split = scriptlet.split('\n')
-                if scriptlet_split[0].startswith("#!"):
-                    scriptlet = scriptlet_split[0] + "\nset -e\n" + "\n".join(scriptlet_split[1:])
-                else:
-                    scriptlet = "set -e\n" + "\n".join(scriptlet_split[0:])
-            d.setVar('%s:%s' % (scriptlet_name, pkg), scriptlet)
-
-    def write_if_exists(f, pkg, var):
-        def encode(str):
-            import codecs
-            c = codecs.getencoder("unicode_escape")
-            return c(str)[0].decode("latin1")
-
-        val = d.getVar('%s:%s' % (var, pkg))
-        if val:
-            f.write('%s:%s: %s\n' % (var, pkg, encode(val)))
-            return val
-        val = d.getVar('%s' % (var))
-        if val:
-            f.write('%s: %s\n' % (var, encode(val)))
-        return val
-
-    def write_extra_pkgs(variants, pn, packages, pkgdatadir):
-        for variant in variants:
-            with open("%s/%s-%s" % (pkgdatadir, variant, pn), 'w') as fd:
-                fd.write("PACKAGES: %s\n" % ' '.join(
-                            map(lambda pkg: '%s-%s' % (variant, pkg), packages.split())))
-
-    def write_extra_runtime_pkgs(variants, packages, pkgdatadir):
-        for variant in variants:
-            for pkg in packages.split():
-                ml_pkg = "%s-%s" % (variant, pkg)
-                subdata_file = "%s/runtime/%s" % (pkgdatadir, ml_pkg)
-                with open(subdata_file, 'w') as fd:
-                    fd.write("PKG:%s: %s" % (ml_pkg, pkg))
-
-    packages = d.getVar('PACKAGES')
-    pkgdest = d.getVar('PKGDEST')
-    pkgdatadir = d.getVar('PKGDESTWORK')
-
-    data_file = pkgdatadir + d.expand("/${PN}")
-    with open(data_file, 'w') as fd:
-        fd.write("PACKAGES: %s\n" % packages)
-
-    pkgdebugsource = d.getVar("PKGDEBUGSOURCES") or []
-
-    pn = d.getVar('PN')
-    global_variants = (d.getVar('MULTILIB_GLOBAL_VARIANTS') or "").split()
-    variants = (d.getVar('MULTILIB_VARIANTS') or "").split()
-
-    if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d):
-        write_extra_pkgs(variants, pn, packages, pkgdatadir)
-
-    if bb.data.inherits_class('allarch', d) and not variants \
-        and not bb.data.inherits_class('packagegroup', d):
-        write_extra_pkgs(global_variants, pn, packages, pkgdatadir)
-
-    workdir = d.getVar('WORKDIR')
-
-    for pkg in packages.split():
-        pkgval = d.getVar('PKG:%s' % pkg)
-        if pkgval is None:
-            pkgval = pkg
-            d.setVar('PKG:%s' % pkg, pkg)
-
-        extended_data = {
-            "files_info": {}
-        }
-
-        pkgdestpkg = os.path.join(pkgdest, pkg)
-        files = {}
-        files_extra = {}
-        total_size = 0
-        seen = set()
-        for f in pkgfiles[pkg]:
-            fpath = os.sep + os.path.relpath(f, pkgdestpkg)
-
-            fstat = os.lstat(f)
-            files[fpath] = fstat.st_size
-
-            extended_data["files_info"].setdefault(fpath, {})
-            extended_data["files_info"][fpath]['size'] = fstat.st_size
-
-            if fstat.st_ino not in seen:
-                seen.add(fstat.st_ino)
-                total_size += fstat.st_size
-
-            if fpath in pkgdebugsource:
-                extended_data["files_info"][fpath]['debugsrc'] = pkgdebugsource[fpath]
-                del pkgdebugsource[fpath]
-
-        d.setVar('FILES_INFO:' + pkg , json.dumps(files, sort_keys=True))
-
-        process_postinst_on_target(pkg, d.getVar("MLPREFIX"))
-        add_set_e_to_scriptlets(pkg)
-
-        subdata_file = pkgdatadir + "/runtime/%s" % pkg
-        with open(subdata_file, 'w') as sf:
-            for var in (d.getVar('PKGDATA_VARS') or "").split():
-                val = write_if_exists(sf, pkg, var)
-
-            write_if_exists(sf, pkg, 'FILERPROVIDESFLIST')
-            for dfile in sorted((d.getVar('FILERPROVIDESFLIST:' + pkg) or "").split()):
-                write_if_exists(sf, pkg, 'FILERPROVIDES:' + dfile)
-
-            write_if_exists(sf, pkg, 'FILERDEPENDSFLIST')
-            for dfile in sorted((d.getVar('FILERDEPENDSFLIST:' + pkg) or "").split()):
-                write_if_exists(sf, pkg, 'FILERDEPENDS:' + dfile)
-
-            sf.write('%s:%s: %d\n' % ('PKGSIZE', pkg, total_size))
-
-        subdata_extended_file = pkgdatadir + "/extended/%s.json.zstd" % pkg
-        num_threads = int(d.getVar("BB_NUMBER_THREADS"))
-        with bb.compress.zstd.open(subdata_extended_file, "wt", encoding="utf-8", num_threads=num_threads) as f:
-            json.dump(extended_data, f, sort_keys=True, separators=(",", ":"))
-
-        # Symlinks needed for rprovides lookup
-        rprov = d.getVar('RPROVIDES:%s' % pkg) or d.getVar('RPROVIDES')
-        if rprov:
-            for p in bb.utils.explode_deps(rprov):
-                subdata_sym = pkgdatadir + "/runtime-rprovides/%s/%s" % (p, pkg)
-                bb.utils.mkdirhier(os.path.dirname(subdata_sym))
-                oe.path.symlink("../../runtime/%s" % pkg, subdata_sym, True)
-
-        allow_empty = d.getVar('ALLOW_EMPTY:%s' % pkg)
-        if not allow_empty:
-            allow_empty = d.getVar('ALLOW_EMPTY')
-        root = "%s/%s" % (pkgdest, pkg)
-        os.chdir(root)
-        g = glob('*')
-        if g or allow_empty == "1":
-            # Symlinks needed for reverse lookups (from the final package name)
-            subdata_sym = pkgdatadir + "/runtime-reverse/%s" % pkgval
-            oe.path.symlink("../runtime/%s" % pkg, subdata_sym, True)
-
-            packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg
-            open(packagedfile, 'w').close()
-
-    if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d):
-        write_extra_runtime_pkgs(variants, packages, pkgdatadir)
-
-    if bb.data.inherits_class('allarch', d) and not variants \
-        and not bb.data.inherits_class('packagegroup', d):
-        write_extra_runtime_pkgs(global_variants, packages, pkgdatadir)
-
-}
-emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides ${PKGDESTWORK}/extended"
-emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS"
-
-ldconfig_postinst_fragment() {
-if [ x"$D" = "x" ]; then
-	if [ -x /sbin/ldconfig ]; then /sbin/ldconfig ; fi
-fi
-}
-
-RPMDEPS = "${STAGING_LIBDIR_NATIVE}/rpm/rpmdeps --alldeps --define '__font_provides %{nil}'"
-
-# Collect perfile run-time dependency metadata
-# Output:
-#  FILERPROVIDESFLIST:pkg - list of all files w/ deps
-#  FILERPROVIDES:filepath:pkg - per file dep
-#
-#  FILERDEPENDSFLIST:pkg - list of all files w/ deps
-#  FILERDEPENDS:filepath:pkg - per file dep
-
-python package_do_filedeps() {
-    if d.getVar('SKIP_FILEDEPS') == '1':
-        return
-
-    pkgdest = d.getVar('PKGDEST')
-    packages = d.getVar('PACKAGES')
-    rpmdeps = d.getVar('RPMDEPS')
-
-    def chunks(files, n):
-        return [files[i:i+n] for i in range(0, len(files), n)]
-
-    pkglist = []
-    for pkg in packages.split():
-        if d.getVar('SKIP_FILEDEPS:' + pkg) == '1':
-            continue
-        if pkg.endswith('-dbg') or pkg.endswith('-doc') or pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or pkg.startswith('kernel-module-') or pkg.endswith('-src'):
-            continue
-        for files in chunks(pkgfiles[pkg], 100):
-            pkglist.append((pkg, files, rpmdeps, pkgdest))
-
-    processed = oe.utils.multiprocess_launch(oe.package.filedeprunner, pkglist, d)
-
-    provides_files = {}
-    requires_files = {}
-
-    for result in processed:
-        (pkg, provides, requires) = result
-
-        if pkg not in provides_files:
-            provides_files[pkg] = []
-        if pkg not in requires_files:
-            requires_files[pkg] = []
-
-        for file in sorted(provides):
-            provides_files[pkg].append(file)
-            key = "FILERPROVIDES:" + file + ":" + pkg
-            d.appendVar(key, " " + " ".join(provides[file]))
-
-        for file in sorted(requires):
-            requires_files[pkg].append(file)
-            key = "FILERDEPENDS:" + file + ":" + pkg
-            d.appendVar(key, " " + " ".join(requires[file]))
-
-    for pkg in requires_files:
-        d.setVar("FILERDEPENDSFLIST:" + pkg, " ".join(sorted(requires_files[pkg])))
-    for pkg in provides_files:
-        d.setVar("FILERPROVIDESFLIST:" + pkg, " ".join(sorted(provides_files[pkg])))
-}
-
-SHLIBSDIRS = "${WORKDIR_PKGDATA}/${MLPREFIX}shlibs2"
-SHLIBSWORKDIR = "${PKGDESTWORK}/${MLPREFIX}shlibs2"
-
-python package_do_shlibs() {
-    import itertools
-    import re, pipes
-    import subprocess
-
-    exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', False)
-    if exclude_shlibs:
-        bb.note("not generating shlibs")
-        return
-
-    lib_re = re.compile(r"^.*\.so")
-    libdir_re = re.compile(r".*/%s$" % d.getVar('baselib'))
-
-    packages = d.getVar('PACKAGES')
-
-    shlib_pkgs = []
-    exclusion_list = d.getVar("EXCLUDE_PACKAGES_FROM_SHLIBS")
-    if exclusion_list:
-        for pkg in packages.split():
-            if pkg not in exclusion_list.split():
-                shlib_pkgs.append(pkg)
-            else:
-                bb.note("not generating shlibs for %s" % pkg)
-    else:
-        shlib_pkgs = packages.split()
-
-    hostos = d.getVar('HOST_OS')
-
-    workdir = d.getVar('WORKDIR')
-
-    ver = d.getVar('PKGV')
-    if not ver:
-        msg = "PKGV not defined"
-        oe.qa.handle_error("pkgv-undefined", msg, d)
-        return
-
-    pkgdest = d.getVar('PKGDEST')
-
-    shlibswork_dir = d.getVar('SHLIBSWORKDIR')
-
-    def linux_so(file, pkg, pkgver, d):
-        needs_ldconfig = False
-        needed = set()
-        sonames = set()
-        renames = []
-        ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
-        cmd = d.getVar('OBJDUMP') + " -p " + pipes.quote(file) + " 2>/dev/null"
-        fd = os.popen(cmd)
-        lines = fd.readlines()
-        fd.close()
-        rpath = tuple()
-        for l in lines:
-            m = re.match(r"\s+RPATH\s+([^\s]*)", l)
-            if m:
-                rpaths = m.group(1).replace("$ORIGIN", ldir).split(":")
-                rpath = tuple(map(os.path.normpath, rpaths))
-        for l in lines:
-            m = re.match(r"\s+NEEDED\s+([^\s]*)", l)
-            if m:
-                dep = m.group(1)
-                if dep not in needed:
-                    needed.add((dep, file, rpath))
-            m = re.match(r"\s+SONAME\s+([^\s]*)", l)
-            if m:
-                this_soname = m.group(1)
-                prov = (this_soname, ldir, pkgver)
-                if not prov in sonames:
-                    # if library is private (only used by package) then do not build shlib for it
-                    import fnmatch
-                    if not private_libs or len([i for i in private_libs if fnmatch.fnmatch(this_soname, i)]) == 0:
-                        sonames.add(prov)
-                if libdir_re.match(os.path.dirname(file)):
-                    needs_ldconfig = True
-                if needs_ldconfig and snap_symlinks and (os.path.basename(file) != this_soname):
-                    renames.append((file, os.path.join(os.path.dirname(file), this_soname)))
-        return (needs_ldconfig, needed, sonames, renames)
-
-    def darwin_so(file, needed, sonames, renames, pkgver):
-        if not os.path.exists(file):
-            return
-        ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
-
-        def get_combinations(base):
-            #
-            # Given a base library name, find all combinations of this split by "." and "-"
-            #
-            combos = []
-            options = base.split(".")
-            for i in range(1, len(options) + 1):
-                combos.append(".".join(options[0:i]))
-            options = base.split("-")
-            for i in range(1, len(options) + 1):
-                combos.append("-".join(options[0:i]))
-            return combos
-
-        if (file.endswith('.dylib') or file.endswith('.so')) and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-src'):
-            # Drop suffix
-            name = os.path.basename(file).rsplit(".",1)[0]
-            # Find all combinations
-            combos = get_combinations(name)
-            for combo in combos:
-                if not combo in sonames:
-                    prov = (combo, ldir, pkgver)
-                    sonames.add(prov)
-        if file.endswith('.dylib') or file.endswith('.so'):
-            rpath = []
-            p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            out, err = p.communicate()
-            # If returned successfully, process stdout for results
-            if p.returncode == 0:
-                for l in out.split("\n"):
-                    l = l.strip()
-                    if l.startswith('path '):
-                        rpath.append(l.split()[1])
-
-        p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        out, err = p.communicate()
-        # If returned successfully, process stdout for results
-        if p.returncode == 0:
-            for l in out.split("\n"):
-                l = l.strip()
-                if not l or l.endswith(":"):
-                    continue
-                if "is not an object file" in l:
-                    continue
-                name = os.path.basename(l.split()[0]).rsplit(".", 1)[0]
-                if name and name not in needed[pkg]:
-                     needed[pkg].add((name, file, tuple()))
-
-    def mingw_dll(file, needed, sonames, renames, pkgver):
-        if not os.path.exists(file):
-            return
-
-        if file.endswith(".dll"):
-            # assume all dlls are shared objects provided by the package
-            sonames.add((os.path.basename(file), os.path.dirname(file).replace(pkgdest + "/" + pkg, ''), pkgver))
-
-        if (file.endswith(".dll") or file.endswith(".exe")):
-            # use objdump to search for "DLL Name: .*\.dll"
-            p = subprocess.Popen([d.expand("${HOST_PREFIX}objdump"), "-p", file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            out, err = p.communicate()
-            # process the output, grabbing all .dll names
-            if p.returncode == 0:
-                for m in re.finditer(r"DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE):
-                    dllname = m.group(1)
-                    if dllname:
-                        needed[pkg].add((dllname, file, tuple()))
-
-    if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS') == "1":
-        snap_symlinks = True
-    else:
-        snap_symlinks = False
-
-    needed = {}
-
-    shlib_provider = oe.package.read_shlib_providers(d)
-
-    for pkg in shlib_pkgs:
-        private_libs = d.getVar('PRIVATE_LIBS:' + pkg) or d.getVar('PRIVATE_LIBS') or ""
-        private_libs = private_libs.split()
-        needs_ldconfig = False
-        bb.debug(2, "calculating shlib provides for %s" % pkg)
-
-        pkgver = d.getVar('PKGV:' + pkg)
-        if not pkgver:
-            pkgver = d.getVar('PV_' + pkg)
-        if not pkgver:
-            pkgver = ver
-
-        needed[pkg] = set()
-        sonames = set()
-        renames = []
-        linuxlist = []
-        for file in pkgfiles[pkg]:
-                soname = None
-                if cpath.islink(file):
-                    continue
-                if hostos == "darwin" or hostos == "darwin8":
-                    darwin_so(file, needed, sonames, renames, pkgver)
-                elif hostos.startswith("mingw"):
-                    mingw_dll(file, needed, sonames, renames, pkgver)
-                elif os.access(file, os.X_OK) or lib_re.match(file):
-                    linuxlist.append(file)
-
-        if linuxlist:
-            results = oe.utils.multiprocess_launch(linux_so, linuxlist, d, extraargs=(pkg, pkgver, d))
-            for r in results:
-                ldconfig = r[0]
-                needed[pkg] |= r[1]
-                sonames |= r[2]
-                renames.extend(r[3])
-                needs_ldconfig = needs_ldconfig or ldconfig
-
-        for (old, new) in renames:
-            bb.note("Renaming %s to %s" % (old, new))
-            bb.utils.rename(old, new)
-            pkgfiles[pkg].remove(old)
-
-        shlibs_file = os.path.join(shlibswork_dir, pkg + ".list")
-        if len(sonames):
-            with open(shlibs_file, 'w') as fd:
-                for s in sorted(sonames):
-                    if s[0] in shlib_provider and s[1] in shlib_provider[s[0]]:
-                        (old_pkg, old_pkgver) = shlib_provider[s[0]][s[1]]
-                        if old_pkg != pkg:
-                            bb.warn('%s-%s was registered as shlib provider for %s, changing it to %s-%s because it was built later' % (old_pkg, old_pkgver, s[0], pkg, pkgver))
-                    bb.debug(1, 'registering %s-%s as shlib provider for %s' % (pkg, pkgver, s[0]))
-                    fd.write(s[0] + ':' + s[1] + ':' + s[2] + '\n')
-                    if s[0] not in shlib_provider:
-                        shlib_provider[s[0]] = {}
-                    shlib_provider[s[0]][s[1]] = (pkg, pkgver)
-        if needs_ldconfig:
-            bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
-            postinst = d.getVar('pkg_postinst:%s' % pkg)
-            if not postinst:
-                postinst = '#!/bin/sh\n'
-            postinst += d.getVar('ldconfig_postinst_fragment')
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-        bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames))
-
-    assumed_libs = d.getVar('ASSUME_SHLIBS')
-    if assumed_libs:
-        libdir = d.getVar("libdir")
-        for e in assumed_libs.split():
-            l, dep_pkg = e.split(":")
-            lib_ver = None
-            dep_pkg = dep_pkg.rsplit("_", 1)
-            if len(dep_pkg) == 2:
-                lib_ver = dep_pkg[1]
-            dep_pkg = dep_pkg[0]
-            if l not in shlib_provider:
-                shlib_provider[l] = {}
-            shlib_provider[l][libdir] = (dep_pkg, lib_ver)
-
-    libsearchpath = [d.getVar('libdir'), d.getVar('base_libdir')]
-
-    for pkg in shlib_pkgs:
-        bb.debug(2, "calculating shlib requirements for %s" % pkg)
-
-        private_libs = d.getVar('PRIVATE_LIBS:' + pkg) or d.getVar('PRIVATE_LIBS') or ""
-        private_libs = private_libs.split()
-
-        deps = list()
-        for n in needed[pkg]:
-            # if n is in private libraries, don't try to search provider for it
-            # this could cause problem in case some abc.bb provides private
-            # /opt/abc/lib/libfoo.so.1 and contains /usr/bin/abc depending on system library libfoo.so.1
-            # but skipping it is still better alternative than providing own
-            # version and then adding runtime dependency for the same system library
-            import fnmatch
-            if private_libs and len([i for i in private_libs if fnmatch.fnmatch(n[0], i)]) > 0:
-                bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0]))
-                continue
-            if n[0] in shlib_provider.keys():
-                shlib_provider_map = shlib_provider[n[0]]
-                matches = set()
-                for p in itertools.chain(list(n[2]), sorted(shlib_provider_map.keys()), libsearchpath):
-                    if p in shlib_provider_map:
-                        matches.add(p)
-                if len(matches) > 1:
-                    matchpkgs = ', '.join([shlib_provider_map[match][0] for match in matches])
-                    bb.error("%s: Multiple shlib providers for %s: %s (used by files: %s)" % (pkg, n[0], matchpkgs, n[1]))
-                elif len(matches) == 1:
-                    (dep_pkg, ver_needed) = shlib_provider_map[matches.pop()]
-
-                    bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1]))
-
-                    if dep_pkg == pkg:
-                        continue
-
-                    if ver_needed:
-                        dep = "%s (>= %s)" % (dep_pkg, ver_needed)
-                    else:
-                        dep = dep_pkg
-                    if not dep in deps:
-                        deps.append(dep)
-                    continue
-            bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1]))
-
-        deps_file = os.path.join(pkgdest, pkg + ".shlibdeps")
-        if os.path.exists(deps_file):
-            os.remove(deps_file)
-        if deps:
-            with open(deps_file, 'w') as fd:
-                for dep in sorted(deps):
-                    fd.write(dep + '\n')
-}
-
-python package_do_pkgconfig () {
-    import re
-
-    packages = d.getVar('PACKAGES')
-    workdir = d.getVar('WORKDIR')
-    pkgdest = d.getVar('PKGDEST')
-
-    shlibs_dirs = d.getVar('SHLIBSDIRS').split()
-    shlibswork_dir = d.getVar('SHLIBSWORKDIR')
-
-    pc_re = re.compile(r'(.*)\.pc$')
-    var_re = re.compile(r'(.*)=(.*)')
-    field_re = re.compile(r'(.*): (.*)')
-
-    pkgconfig_provided = {}
-    pkgconfig_needed = {}
-    for pkg in packages.split():
-        pkgconfig_provided[pkg] = []
-        pkgconfig_needed[pkg] = []
-        for file in sorted(pkgfiles[pkg]):
-                m = pc_re.match(file)
-                if m:
-                    pd = bb.data.init()
-                    name = m.group(1)
-                    pkgconfig_provided[pkg].append(os.path.basename(name))
-                    if not os.access(file, os.R_OK):
-                        continue
-                    with open(file, 'r') as f:
-                        lines = f.readlines()
-                    for l in lines:
-                        m = var_re.match(l)
-                        if m:
-                            name = m.group(1)
-                            val = m.group(2)
-                            pd.setVar(name, pd.expand(val))
-                            continue
-                        m = field_re.match(l)
-                        if m:
-                            hdr = m.group(1)
-                            exp = pd.expand(m.group(2))
-                            if hdr == 'Requires':
-                                pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
-
-    for pkg in packages.split():
-        pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist")
-        if pkgconfig_provided[pkg] != []:
-            with open(pkgs_file, 'w') as f:
-                for p in sorted(pkgconfig_provided[pkg]):
-                    f.write('%s\n' % p)
-
-    # Go from least to most specific since the last one found wins
-    for dir in reversed(shlibs_dirs):
-        if not os.path.exists(dir):
-            continue
-        for file in sorted(os.listdir(dir)):
-            m = re.match(r'^(.*)\.pclist$', file)
-            if m:
-                pkg = m.group(1)
-                with open(os.path.join(dir, file)) as fd:
-                    lines = fd.readlines()
-                pkgconfig_provided[pkg] = []
-                for l in lines:
-                    pkgconfig_provided[pkg].append(l.rstrip())
-
-    for pkg in packages.split():
-        deps = []
-        for n in pkgconfig_needed[pkg]:
-            found = False
-            for k in pkgconfig_provided.keys():
-                if n in pkgconfig_provided[k]:
-                    if k != pkg and not (k in deps):
-                        deps.append(k)
-                    found = True
-            if found == False:
-                bb.note("couldn't find pkgconfig module '%s' in any package" % n)
-        deps_file = os.path.join(pkgdest, pkg + ".pcdeps")
-        if len(deps):
-            with open(deps_file, 'w') as fd:
-                for dep in deps:
-                    fd.write(dep + '\n')
-}
-
-def read_libdep_files(d):
-    pkglibdeps = {}
-    packages = d.getVar('PACKAGES').split()
-    for pkg in packages:
-        pkglibdeps[pkg] = {}
-        for extension in ".shlibdeps", ".pcdeps", ".clilibdeps":
-            depsfile = d.expand("${PKGDEST}/" + pkg + extension)
-            if os.access(depsfile, os.R_OK):
-                with open(depsfile) as fd:
-                    lines = fd.readlines()
-                for l in lines:
-                    l.rstrip()
-                    deps = bb.utils.explode_dep_versions2(l)
-                    for dep in deps:
-                        if not dep in pkglibdeps[pkg]:
-                            pkglibdeps[pkg][dep] = deps[dep]
-    return pkglibdeps
-
-python read_shlibdeps () {
-    pkglibdeps = read_libdep_files(d)
-
-    packages = d.getVar('PACKAGES').split()
-    for pkg in packages:
-        rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "")
-        for dep in sorted(pkglibdeps[pkg]):
-            # Add the dep if it's not already there, or if no comparison is set
-            if dep not in rdepends:
-                rdepends[dep] = []
-            for v in pkglibdeps[pkg][dep]:
-                if v not in rdepends[dep]:
-                    rdepends[dep].append(v)
-        d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False))
-}
-
-python package_depchains() {
-    """
-    For a given set of prefix and postfix modifiers, make those packages
-    RRECOMMENDS on the corresponding packages for its RDEPENDS.
-
-    Example:  If package A depends upon package B, and A's .bb emits an
-    A-dev package, this would make A-dev Recommends: B-dev.
-
-    If only one of a given suffix is specified, it will take the RRECOMMENDS
-    based on the RDEPENDS of *all* other packages. If more than one of a given
-    suffix is specified, its will only use the RDEPENDS of the single parent
-    package.
-    """
-
-    packages  = d.getVar('PACKAGES')
-    postfixes = (d.getVar('DEPCHAIN_POST') or '').split()
-    prefixes  = (d.getVar('DEPCHAIN_PRE') or '').split()
-
-    def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d):
-
-        #bb.note('depends for %s is %s' % (base, depends))
-        rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "")
-
-        for depend in sorted(depends):
-            if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'):
-                #bb.note("Skipping %s" % depend)
-                continue
-            if depend.endswith('-dev'):
-                depend = depend[:-4]
-            if depend.endswith('-dbg'):
-                depend = depend[:-4]
-            pkgname = getname(depend, suffix)
-            #bb.note("Adding %s for %s" % (pkgname, depend))
-            if pkgname not in rreclist and pkgname != pkg:
-                rreclist[pkgname] = []
-
-        #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist)))
-        d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False))
-
-    def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d):
-
-        #bb.note('rdepends for %s is %s' % (base, rdepends))
-        rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "")
-
-        for depend in sorted(rdepends):
-            if depend.find('virtual-locale-') != -1:
-                #bb.note("Skipping %s" % depend)
-                continue
-            if depend.endswith('-dev'):
-                depend = depend[:-4]
-            if depend.endswith('-dbg'):
-                depend = depend[:-4]
-            pkgname = getname(depend, suffix)
-            #bb.note("Adding %s for %s" % (pkgname, depend))
-            if pkgname not in rreclist and pkgname != pkg:
-                rreclist[pkgname] = []
-
-        #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist)))
-        d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False))
-
-    def add_dep(list, dep):
-        if dep not in list:
-            list.append(dep)
-
-    depends = []
-    for dep in bb.utils.explode_deps(d.getVar('DEPENDS') or ""):
-        add_dep(depends, dep)
-
-    rdepends = []
-    for pkg in packages.split():
-        for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + pkg) or ""):
-            add_dep(rdepends, dep)
-
-    #bb.note('rdepends is %s' % rdepends)
-
-    def post_getname(name, suffix):
-        return '%s%s' % (name, suffix)
-    def pre_getname(name, suffix):
-        return '%s%s' % (suffix, name)
-
-    pkgs = {}
-    for pkg in packages.split():
-        for postfix in postfixes:
-            if pkg.endswith(postfix):
-                if not postfix in pkgs:
-                    pkgs[postfix] = {}
-                pkgs[postfix][pkg] = (pkg[:-len(postfix)], post_getname)
-
-        for prefix in prefixes:
-            if pkg.startswith(prefix):
-                if not prefix in pkgs:
-                    pkgs[prefix] = {}
-                pkgs[prefix][pkg] = (pkg[:-len(prefix)], pre_getname)
-
-    if "-dbg" in pkgs:
-        pkglibdeps = read_libdep_files(d)
-        pkglibdeplist = []
-        for pkg in pkglibdeps:
-            for k in pkglibdeps[pkg]:
-                add_dep(pkglibdeplist, k)
-        dbgdefaultdeps = ((d.getVar('DEPCHAIN_DBGDEFAULTDEPS') == '1') or (bb.data.inherits_class('packagegroup', d)))
-
-    for suffix in pkgs:
-        for pkg in pkgs[suffix]:
-            if d.getVarFlag('RRECOMMENDS:' + pkg, 'nodeprrecs'):
-                continue
-            (base, func) = pkgs[suffix][pkg]
-            if suffix == "-dev":
-                pkg_adddeprrecs(pkg, base, suffix, func, depends, d)
-            elif suffix == "-dbg":
-                if not dbgdefaultdeps:
-                    pkg_addrrecs(pkg, base, suffix, func, pkglibdeplist, d)
-                    continue
-            if len(pkgs[suffix]) == 1:
-                pkg_addrrecs(pkg, base, suffix, func, rdepends, d)
-            else:
-                rdeps = []
-                for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + base) or ""):
-                    add_dep(rdeps, dep)
-                pkg_addrrecs(pkg, base, suffix, func, rdeps, d)
-}
-
-# Since bitbake can't determine which variables are accessed during package
-# iteration, we need to list them here:
-PACKAGEVARS = "FILES RDEPENDS RRECOMMENDS SUMMARY DESCRIPTION RSUGGESTS RPROVIDES RCONFLICTS PKG ALLOW_EMPTY pkg_postinst pkg_postrm pkg_postinst_ontarget INITSCRIPT_NAME INITSCRIPT_PARAMS DEBIAN_NOAUTONAME ALTERNATIVE PKGE PKGV PKGR USERADD_PARAM GROUPADD_PARAM CONFFILES SYSTEMD_SERVICE LICENSE SECTION pkg_preinst pkg_prerm RREPLACES GROUPMEMS_PARAM SYSTEMD_AUTO_ENABLE SKIP_FILEDEPS PRIVATE_LIBS PACKAGE_ADD_METADATA"
-
-def gen_packagevar(d, pkgvars="PACKAGEVARS"):
-    ret = []
-    pkgs = (d.getVar("PACKAGES") or "").split()
-    vars = (d.getVar(pkgvars) or "").split()
-    for v in vars:
-        ret.append(v)
-    for p in pkgs:
-        for v in vars:
-            ret.append(v + ":" + p)
-
-        # Ensure that changes to INCOMPATIBLE_LICENSE re-run do_package for
-        # affected recipes.
-        ret.append('_exclude_incompatible-%s' % p)
-    return " ".join(ret)
-
-PACKAGE_PREPROCESS_FUNCS ?= ""
-# Functions for setting up PKGD
-PACKAGEBUILDPKGD ?= " \
-                package_prepare_pkgdata \
-                perform_packagecopy \
-                ${PACKAGE_PREPROCESS_FUNCS} \
-                split_and_strip_files \
-                fixup_perms \
-                "
-# Functions which split PKGD up into separate packages
-PACKAGESPLITFUNCS ?= " \
-                package_do_split_locales \
-                populate_packages"
-# Functions which process metadata based on split packages
-PACKAGEFUNCS += " \
-                package_fixsymlinks \
-                package_name_hook \
-                package_do_filedeps \
-                package_do_shlibs \
-                package_do_pkgconfig \
-                read_shlibdeps \
-                package_depchains \
-                emit_pkgdata"
-
-python do_package () {
-    # Change the following version to cause sstate to invalidate the package
-    # cache.  This is useful if an item this class depends on changes in a
-    # way that the output of this class changes.  rpmdeps is a good example
-    # as any change to rpmdeps requires this to be rerun.
-    # PACKAGE_BBCLASS_VERSION = "4"
-
-    # Init cachedpath
-    global cpath
-    cpath = oe.cachedpath.CachedPath()
-
-    ###########################################################################
-    # Sanity test the setup
-    ###########################################################################
-
-    packages = (d.getVar('PACKAGES') or "").split()
-    if len(packages) < 1:
-        bb.debug(1, "No packages to build, skipping do_package")
-        return
-
-    workdir = d.getVar('WORKDIR')
-    outdir = d.getVar('DEPLOY_DIR')
-    dest = d.getVar('D')
-    dvar = d.getVar('PKGD')
-    pn = d.getVar('PN')
-
-    if not workdir or not outdir or not dest or not dvar or not pn:
-        msg = "WORKDIR, DEPLOY_DIR, D, PN and PKGD all must be defined, unable to package"
-        oe.qa.handle_error("var-undefined", msg, d)
-        return
-
-    bb.build.exec_func("package_convert_pr_autoinc", d)
-
-    ###########################################################################
-    # Optimisations
-    ###########################################################################
-
-    # Continually expanding complex expressions is inefficient, particularly
-    # when we write to the datastore and invalidate the expansion cache. This
-    # code pre-expands some frequently used variables
-
-    def expandVar(x, d):
-        d.setVar(x, d.getVar(x))
-
-    for x in 'PN', 'PV', 'BPN', 'TARGET_SYS', 'EXTENDPRAUTO':
-        expandVar(x, d)
-
-    ###########################################################################
-    # Setup PKGD (from D)
-    ###########################################################################
-
-    for f in (d.getVar('PACKAGEBUILDPKGD') or '').split():
-        bb.build.exec_func(f, d)
-
-    ###########################################################################
-    # Split up PKGD into PKGDEST
-    ###########################################################################
-
-    cpath = oe.cachedpath.CachedPath()
-
-    for f in (d.getVar('PACKAGESPLITFUNCS') or '').split():
-        bb.build.exec_func(f, d)
-
-    ###########################################################################
-    # Process PKGDEST
-    ###########################################################################
-
-    # Build global list of files in each split package
-    global pkgfiles
-    pkgfiles = {}
-    packages = d.getVar('PACKAGES').split()
-    pkgdest = d.getVar('PKGDEST')
-    for pkg in packages:
-        pkgfiles[pkg] = []
-        for walkroot, dirs, files in cpath.walk(pkgdest + "/" + pkg):
-            for file in files:
-                pkgfiles[pkg].append(walkroot + os.sep + file)
-
-    for f in (d.getVar('PACKAGEFUNCS') or '').split():
-        bb.build.exec_func(f, d)
-
-    oe.qa.exit_if_errors(d)
-}
-
-do_package[dirs] = "${SHLIBSWORKDIR} ${D}"
-do_package[vardeps] += "${PACKAGEBUILDPKGD} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}"
-addtask package after do_install
-
-SSTATETASKS += "do_package"
-do_package[cleandirs] = "${PKGDEST} ${PKGDESTWORK}"
-do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST} ${PKGDESTWORK}"
-do_package_setscene[dirs] = "${STAGING_DIR}"
-
-python do_package_setscene () {
-    sstate_setscene(d)
-}
-addtask do_package_setscene
-
-# Copy from PKGDESTWORK to tempdirectory as tempdirectory can be cleaned at both
-# do_package_setscene and do_packagedata_setscene leading to races
-python do_packagedata () {
-    bb.build.exec_func("package_get_auto_pr", d)
-
-    src = d.expand("${PKGDESTWORK}")
-    dest = d.expand("${WORKDIR}/pkgdata-pdata-input")
-    oe.path.copyhardlinktree(src, dest)
-
-    bb.build.exec_func("packagedata_translate_pr_autoinc", d)
-}
-do_packagedata[cleandirs] += "${WORKDIR}/pkgdata-pdata-input"
-
-# Translate the EXTENDPRAUTO and AUTOINC to the final values
-packagedata_translate_pr_autoinc() {
-    find ${WORKDIR}/pkgdata-pdata-input -type f | xargs --no-run-if-empty \
-        sed -e 's,@PRSERV_PV_AUTOINC@,${PRSERV_PV_AUTOINC},g' \
-            -e 's,@EXTENDPRAUTO@,${EXTENDPRAUTO},g' -i
-}
-
-addtask packagedata before do_build after do_package
-
-SSTATETASKS += "do_packagedata"
-do_packagedata[sstate-inputdirs] = "${WORKDIR}/pkgdata-pdata-input"
-do_packagedata[sstate-outputdirs] = "${PKGDATA_DIR}"
-do_packagedata[stamp-extra-info] = "${MACHINE_ARCH}"
-
-python do_packagedata_setscene () {
-    sstate_setscene(d)
-}
-addtask do_packagedata_setscene
-
-#
-# Helper functions for the package writing classes
-#
-
-def mapping_rename_hook(d):
-    """
-    Rewrite variables to account for package renaming in things
-    like debian.bbclass or manual PKG variable name changes
-    """
-    pkg = d.getVar("PKG")
-    runtime_mapping_rename("RDEPENDS", pkg, d)
-    runtime_mapping_rename("RRECOMMENDS", pkg, d)
-    runtime_mapping_rename("RSUGGESTS", pkg, d)
diff --git a/poky/meta/classes/package_deb.bbclass b/poky/meta/classes/package_deb.bbclass
deleted file mode 100644
index a9b8ba0..0000000
--- a/poky/meta/classes/package_deb.bbclass
+++ /dev/null
@@ -1,327 +0,0 @@
-#
-# Copyright 2006-2008 OpenedHand Ltd.
-#
-
-inherit package
-
-IMAGE_PKGTYPE ?= "deb"
-
-DPKG_BUILDCMD ??= "dpkg-deb"
-
-DPKG_ARCH ?= "${@debian_arch_map(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'))}"
-DPKG_ARCH[vardepvalue] = "${DPKG_ARCH}"
-
-PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs"
-
-APTCONF_TARGET = "${WORKDIR}"
-
-APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
-
-def debian_arch_map(arch, tune):
-    tune_features = tune.split()
-    if arch == "allarch":
-        return "all"
-    if arch in ["i586", "i686"]:
-        return "i386"
-    if arch == "x86_64":
-        if "mx32" in tune_features:
-            return "x32"
-        return "amd64"
-    if arch.startswith("mips"):
-        endian = ["el", ""]["bigendian" in tune_features]
-        if "n64" in tune_features:
-            return "mips64" + endian
-        if "n32" in tune_features:
-            return "mipsn32" + endian
-        return "mips" + endian
-    if arch == "powerpc":
-        return arch + ["", "spe"]["spe" in tune_features]
-    if arch == "aarch64":
-        return "arm64"
-    if arch == "arm":
-        return arch + ["el", "hf"]["callconvention-hard" in tune_features]
-    return arch
-
-python do_package_deb () {
-    packages = d.getVar('PACKAGES')
-    if not packages:
-        bb.debug(1, "PACKAGES not defined, nothing to package")
-        return
-
-    tmpdir = d.getVar('TMPDIR')
-    if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK):
-        os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"))
-
-    oe.utils.multiprocess_launch(deb_write_pkg, packages.split(), d, extraargs=(d,))
-}
-do_package_deb[vardeps] += "deb_write_pkg"
-do_package_deb[vardepsexclude] = "BB_NUMBER_THREADS"
-
-def deb_write_pkg(pkg, d):
-    import re, copy
-    import textwrap
-    import subprocess
-    import collections
-    import codecs
-
-    outdir = d.getVar('PKGWRITEDIRDEB')
-    pkgdest = d.getVar('PKGDEST')
-
-    def cleanupcontrol(root):
-        for p in ['CONTROL', 'DEBIAN']:
-            p = os.path.join(root, p)
-            if os.path.exists(p):
-                bb.utils.prunedir(p)
-
-    localdata = bb.data.createCopy(d)
-    root = "%s/%s" % (pkgdest, pkg)
-
-    lf = bb.utils.lockfile(root + ".lock")
-    try:
-
-        localdata.setVar('ROOT', '')
-        localdata.setVar('ROOT_%s' % pkg, root)
-        pkgname = localdata.getVar('PKG:%s' % pkg)
-        if not pkgname:
-            pkgname = pkg
-        localdata.setVar('PKG', pkgname)
-
-        localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)
-
-        basedir = os.path.join(os.path.dirname(root))
-
-        pkgoutdir = os.path.join(outdir, localdata.getVar('PACKAGE_ARCH'))
-        bb.utils.mkdirhier(pkgoutdir)
-
-        os.chdir(root)
-        cleanupcontrol(root)
-        from glob import glob
-        g = glob('*')
-        if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
-            bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
-            return
-
-        controldir = os.path.join(root, 'DEBIAN')
-        bb.utils.mkdirhier(controldir)
-        os.chmod(controldir, 0o755)
-
-        ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8')
-
-        fields = []
-        pe = d.getVar('PKGE')
-        if pe and int(pe) > 0:
-            fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']])
-        else:
-            fields.append(["Version: %s-%s\n", ['PKGV', 'PKGR']])
-        fields.append(["Description: %s\n", ['DESCRIPTION']])
-        fields.append(["Section: %s\n", ['SECTION']])
-        fields.append(["Priority: %s\n", ['PRIORITY']])
-        fields.append(["Maintainer: %s\n", ['MAINTAINER']])
-        fields.append(["Architecture: %s\n", ['DPKG_ARCH']])
-        fields.append(["OE: %s\n", ['PN']])
-        fields.append(["PackageArch: %s\n", ['PACKAGE_ARCH']])
-        if d.getVar('HOMEPAGE'):
-            fields.append(["Homepage: %s\n", ['HOMEPAGE']])
-
-        # Package, Version, Maintainer, Description - mandatory
-        # Section, Priority, Essential, Architecture, Source, Depends, Pre-Depends, Recommends, Suggests, Conflicts, Replaces, Provides - Optional
-
-
-        def pullData(l, d):
-            l2 = []
-            for i in l:
-                data = d.getVar(i)
-                if data is None:
-                    raise KeyError(i)
-                if i == 'DPKG_ARCH' and d.getVar('PACKAGE_ARCH') == 'all':
-                    data = 'all'
-                elif i == 'PACKAGE_ARCH' or i == 'DPKG_ARCH':
-                   # The params in deb package control don't allow character
-                   # `_', so change the arch's `_' to `-'. Such as `x86_64'
-                   # -->`x86-64'
-                   data = data.replace('_', '-')
-                l2.append(data)
-            return l2
-
-        ctrlfile.write("Package: %s\n" % pkgname)
-        if d.getVar('PACKAGE_ARCH') == "all":
-            ctrlfile.write("Multi-Arch: foreign\n")
-        # check for required fields
-        for (c, fs) in fields:
-            # Special behavior for description...
-            if 'DESCRIPTION' in fs:
-                 summary = localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or "."
-                 ctrlfile.write('Description: %s\n' % summary)
-                 description = localdata.getVar('DESCRIPTION') or "."
-                 description = textwrap.dedent(description).strip()
-                 if '\\n' in description:
-                     # Manually indent
-                     for t in description.split('\\n'):
-                         ctrlfile.write(' %s\n' % (t.strip() or '.'))
-                 else:
-                     # Auto indent
-                     ctrlfile.write('%s\n' % textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '))
-
-            else:
-                 ctrlfile.write(c % tuple(pullData(fs, localdata)))
-
-        # more fields
-
-        custom_fields_chunk = get_package_additional_metadata("deb", localdata)
-        if custom_fields_chunk:
-            ctrlfile.write(custom_fields_chunk)
-            ctrlfile.write("\n")
-
-        mapping_rename_hook(localdata)
-
-        def debian_cmp_remap(var):
-            # dpkg does not allow for '(', ')' or ':' in a dependency name
-            # Replace any instances of them with '__'
-            #
-            # In debian '>' and '<' do not mean what it appears they mean
-            #   '<' = less or equal
-            #   '>' = greater or equal
-            # adjust these to the '<<' and '>>' equivalents
-            # Also, "=" specifiers only work if they have the PR in, so 1.2.3 != 1.2.3-r0
-            # so to avoid issues, map this to ">= 1.2.3 << 1.2.3.0"
-            for dep in list(var.keys()):
-                if '(' in dep or '/' in dep:
-                    newdep = re.sub(r'[(:)/]', '__', dep)
-                    if newdep.startswith("__"):
-                        newdep = "A" + newdep
-                    if newdep != dep:
-                        var[newdep] = var[dep]
-                        del var[dep]
-            for dep in var:
-                for i, v in enumerate(var[dep]):
-                    if (v or "").startswith("< "):
-                        var[dep][i] = var[dep][i].replace("< ", "<< ")
-                    elif (v or "").startswith("> "):
-                        var[dep][i] = var[dep][i].replace("> ", ">> ")
-                    elif (v or "").startswith("= ") and "-r" not in v:
-                        ver = var[dep][i].replace("= ", "")
-                        var[dep][i] = var[dep][i].replace("= ", ">= ")
-                        var[dep].append("<< " + ver + ".0")
-
-        rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
-        debian_cmp_remap(rdepends)
-        for dep in list(rdepends.keys()):
-                if dep == pkg:
-                        del rdepends[dep]
-                        continue
-                if '*' in dep:
-                        del rdepends[dep]
-        rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or "")
-        debian_cmp_remap(rrecommends)
-        for dep in list(rrecommends.keys()):
-                if '*' in dep:
-                        del rrecommends[dep]
-        rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS") or "")
-        debian_cmp_remap(rsuggests)
-        # Deliberately drop version information here, not wanted/supported by deb
-        rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES") or ""), [])
-        # Remove file paths if any from rprovides, debian does not support custom providers
-        for key in list(rprovides.keys()):
-            if key.startswith('/'):
-                del rprovides[key]
-        rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0]))
-        debian_cmp_remap(rprovides)
-        rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES") or "")
-        debian_cmp_remap(rreplaces)
-        rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS") or "")
-        debian_cmp_remap(rconflicts)
-        if rdepends:
-            ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))
-        if rsuggests:
-            ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests))
-        if rrecommends:
-            ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends))
-        if rprovides:
-            ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides))
-        if rreplaces:
-            ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
-        if rconflicts:
-            ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
-        ctrlfile.close()
-
-        for script in ["preinst", "postinst", "prerm", "postrm"]:
-            scriptvar = localdata.getVar('pkg_%s' % script)
-            if not scriptvar:
-                continue
-            scriptvar = scriptvar.strip()
-            scriptfile = open(os.path.join(controldir, script), 'w')
-
-            if scriptvar.startswith("#!"):
-                pos = scriptvar.find("\n") + 1
-                scriptfile.write(scriptvar[:pos])
-            else:
-                pos = 0
-                scriptfile.write("#!/bin/sh\n")
-
-            # Prevent the prerm/postrm scripts from being run during an upgrade
-            if script in ('prerm', 'postrm'):
-                scriptfile.write('[ "$1" != "upgrade" ] || exit 0\n')
-
-            scriptfile.write(scriptvar[pos:])
-            scriptfile.write('\n')
-            scriptfile.close()
-            os.chmod(os.path.join(controldir, script), 0o755)
-
-        conffiles_str = ' '.join(get_conffiles(pkg, d))
-        if conffiles_str:
-            conffiles = open(os.path.join(controldir, 'conffiles'), 'w')
-            for f in conffiles_str.split():
-                if os.path.exists(oe.path.join(root, f)):
-                    conffiles.write('%s\n' % f)
-            conffiles.close()
-
-        os.chdir(basedir)
-        subprocess.check_output("PATH=\"%s\" %s -b %s %s" % (localdata.getVar("PATH"), localdata.getVar("DPKG_BUILDCMD"),
-                                                             root, pkgoutdir),
-                                stderr=subprocess.STDOUT,
-                                shell=True)
-
-    finally:
-        cleanupcontrol(root)
-        bb.utils.unlockfile(lf)
-
-# Otherwise allarch packages may change depending on override configuration
-deb_write_pkg[vardepsexclude] = "OVERRIDES"
-
-# Have to list any variables referenced as X_<pkg> that aren't in pkgdata here
-DEBEXTRAVARS = "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE PACKAGE_ADD_METADATA_DEB"
-do_package_write_deb[vardeps] += "${@gen_packagevar(d, 'DEBEXTRAVARS')}"
-
-SSTATETASKS += "do_package_write_deb"
-do_package_write_deb[sstate-inputdirs] = "${PKGWRITEDIRDEB}"
-do_package_write_deb[sstate-outputdirs] = "${DEPLOY_DIR_DEB}"
-
-python do_package_write_deb_setscene () {
-    tmpdir = d.getVar('TMPDIR')
-
-    if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK):
-        os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"))
-
-    sstate_setscene(d)
-}
-addtask do_package_write_deb_setscene
-
-python () {
-    if d.getVar('PACKAGES') != '':
-        deps = ' dpkg-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
-        d.appendVarFlag('do_package_write_deb', 'depends', deps)
-        d.setVarFlag('do_package_write_deb', 'fakeroot', "1")
-}
-
-python do_package_write_deb () {
-    bb.build.exec_func("read_subpackage_metadata", d)
-    bb.build.exec_func("do_package_deb", d)
-}
-do_package_write_deb[dirs] = "${PKGWRITEDIRDEB}"
-do_package_write_deb[cleandirs] = "${PKGWRITEDIRDEB}"
-do_package_write_deb[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}"
-addtask package_write_deb after do_packagedata do_package do_deploy_source_date_epoch before do_build
-do_build[rdeptask] += "do_package_write_deb"
-
-PACKAGEINDEXDEPS += "dpkg-native:do_populate_sysroot"
-PACKAGEINDEXDEPS += "apt-native:do_populate_sysroot"
diff --git a/poky/meta/classes/package_ipk.bbclass b/poky/meta/classes/package_ipk.bbclass
deleted file mode 100644
index 9fe3c52..0000000
--- a/poky/meta/classes/package_ipk.bbclass
+++ /dev/null
@@ -1,286 +0,0 @@
-inherit package
-
-IMAGE_PKGTYPE ?= "ipk"
-
-IPKGCONF_TARGET = "${WORKDIR}/opkg.conf"
-IPKGCONF_SDK =  "${WORKDIR}/opkg-sdk.conf"
-IPKGCONF_SDK_TARGET = "${WORKDIR}/opkg-sdk-target.conf"
-
-PKGWRITEDIRIPK = "${WORKDIR}/deploy-ipks"
-
-# Program to be used to build opkg packages
-OPKGBUILDCMD ??= 'opkg-build -Z xz -a "${XZ_DEFAULTS}"'
-
-OPKG_ARGS += "--force_postinstall --prefer-arch-to-version"
-OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
-OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE') or "").split())][(d.getVar("PACKAGE_EXCLUDE") or "").strip() != ""]}"
-
-OPKGLIBDIR ??= "${localstatedir}/lib"
-
-python do_package_ipk () {
-    workdir = d.getVar('WORKDIR')
-    outdir = d.getVar('PKGWRITEDIRIPK')
-    tmpdir = d.getVar('TMPDIR')
-    pkgdest = d.getVar('PKGDEST')
-    if not workdir or not outdir or not tmpdir:
-        bb.error("Variables incorrectly set, unable to package")
-        return
-
-    packages = d.getVar('PACKAGES')
-    if not packages or packages == '':
-        bb.debug(1, "No packages; nothing to do")
-        return
-
-    # We're about to add new packages so the index needs to be checked
-    # so remove the appropriate stamp file.
-    if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK):
-        os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"))
-
-    oe.utils.multiprocess_launch(ipk_write_pkg, packages.split(), d, extraargs=(d,))
-}
-do_package_ipk[vardeps] += "ipk_write_pkg"
-do_package_ipk[vardepsexclude] = "BB_NUMBER_THREADS"
-
-def ipk_write_pkg(pkg, d):
-    import re, copy
-    import subprocess
-    import textwrap
-    import collections
-    import glob
-
-    def cleanupcontrol(root):
-        for p in ['CONTROL', 'DEBIAN']:
-            p = os.path.join(root, p)
-            if os.path.exists(p):
-                bb.utils.prunedir(p)
-
-    outdir = d.getVar('PKGWRITEDIRIPK')
-    pkgdest = d.getVar('PKGDEST')
-    recipesource = os.path.basename(d.getVar('FILE'))
-
-    localdata = bb.data.createCopy(d)
-    root = "%s/%s" % (pkgdest, pkg)
-
-    lf = bb.utils.lockfile(root + ".lock")
-    try:
-        localdata.setVar('ROOT', '')
-        localdata.setVar('ROOT_%s' % pkg, root)
-        pkgname = localdata.getVar('PKG:%s' % pkg)
-        if not pkgname:
-            pkgname = pkg
-        localdata.setVar('PKG', pkgname)
-
-        localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)
-
-        basedir = os.path.join(os.path.dirname(root))
-        arch = localdata.getVar('PACKAGE_ARCH')
-
-        if localdata.getVar('IPK_HIERARCHICAL_FEED', False) == "1":
-            # Spread packages across subdirectories so each isn't too crowded
-            if pkgname.startswith('lib'):
-                pkg_prefix = 'lib' + pkgname[3]
-            else:
-                pkg_prefix = pkgname[0]
-
-            # Keep -dbg, -dev, -doc, -staticdev, -locale and -locale-* packages
-            # together. These package suffixes are taken from the definitions of
-            # PACKAGES and PACKAGES_DYNAMIC in meta/conf/bitbake.conf
-            if pkgname[-4:] in ('-dbg', '-dev', '-doc'):
-                pkg_subdir = pkgname[:-4]
-            elif pkgname.endswith('-staticdev'):
-                pkg_subdir = pkgname[:-10]
-            elif pkgname.endswith('-locale'):
-                pkg_subdir = pkgname[:-7]
-            elif '-locale-' in pkgname:
-                pkg_subdir = pkgname[:pkgname.find('-locale-')]
-            else:
-                pkg_subdir = pkgname
-
-            pkgoutdir = "%s/%s/%s/%s" % (outdir, arch, pkg_prefix, pkg_subdir)
-        else:
-            pkgoutdir = "%s/%s" % (outdir, arch)
-
-        bb.utils.mkdirhier(pkgoutdir)
-        os.chdir(root)
-        cleanupcontrol(root)
-        g = glob.glob('*')
-        if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
-            bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
-            return
-
-        controldir = os.path.join(root, 'CONTROL')
-        bb.utils.mkdirhier(controldir)
-        ctrlfile = open(os.path.join(controldir, 'control'), 'w')
-
-        fields = []
-        pe = d.getVar('PKGE')
-        if pe and int(pe) > 0:
-            fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']])
-        else:
-            fields.append(["Version: %s-%s\n", ['PKGV', 'PKGR']])
-        fields.append(["Description: %s\n", ['DESCRIPTION']])
-        fields.append(["Section: %s\n", ['SECTION']])
-        fields.append(["Priority: %s\n", ['PRIORITY']])
-        fields.append(["Maintainer: %s\n", ['MAINTAINER']])
-        fields.append(["License: %s\n", ['LICENSE']])
-        fields.append(["Architecture: %s\n", ['PACKAGE_ARCH']])
-        fields.append(["OE: %s\n", ['PN']])
-        if d.getVar('HOMEPAGE'):
-            fields.append(["Homepage: %s\n", ['HOMEPAGE']])
-
-        def pullData(l, d):
-            l2 = []
-            for i in l:
-                l2.append(d.getVar(i))
-            return l2
-
-        ctrlfile.write("Package: %s\n" % pkgname)
-        # check for required fields
-        for (c, fs) in fields:
-            for f in fs:
-                if localdata.getVar(f, False) is None:
-                    raise KeyError(f)
-            # Special behavior for description...
-            if 'DESCRIPTION' in fs:
-                summary = localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or "."
-                ctrlfile.write('Description: %s\n' % summary)
-                description = localdata.getVar('DESCRIPTION') or "."
-                description = textwrap.dedent(description).strip()
-                if '\\n' in description:
-                    # Manually indent: multiline description includes a leading space
-                    for t in description.split('\\n'):
-                        ctrlfile.write(' %s\n' % (t.strip() or ' .'))
-                else:
-                    # Auto indent
-                    ctrlfile.write('%s\n' % textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' '))
-            else:
-                ctrlfile.write(c % tuple(pullData(fs, localdata)))
-
-        custom_fields_chunk = get_package_additional_metadata("ipk", localdata)
-        if custom_fields_chunk is not None:
-            ctrlfile.write(custom_fields_chunk)
-            ctrlfile.write("\n")
-
-        mapping_rename_hook(localdata)
-
-        def debian_cmp_remap(var):
-            # In debian '>' and '<' do not mean what it appears they mean
-            #   '<' = less or equal
-            #   '>' = greater or equal
-            # adjust these to the '<<' and '>>' equivalents
-            # Also, "=" specifiers only work if they have the PR in, so 1.2.3 != 1.2.3-r0
-            # so to avoid issues, map this to ">= 1.2.3 << 1.2.3.0"
-            for dep in var:
-                for i, v in enumerate(var[dep]):
-                    if (v or "").startswith("< "):
-                        var[dep][i] = var[dep][i].replace("< ", "<< ")
-                    elif (v or "").startswith("> "):
-                        var[dep][i] = var[dep][i].replace("> ", ">> ")
-                    elif (v or "").startswith("= ") and "-r" not in v:
-                        ver = var[dep][i].replace("= ", "")
-                        var[dep][i] = var[dep][i].replace("= ", ">= ")
-                        var[dep].append("<< " + ver + ".0")
-
-        rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
-        debian_cmp_remap(rdepends)
-        rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or "")
-        debian_cmp_remap(rrecommends)
-        rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS") or "")
-        debian_cmp_remap(rsuggests)
-        # Deliberately drop version information here, not wanted/supported by ipk
-        rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES") or ""), [])
-        rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0]))
-        debian_cmp_remap(rprovides)
-        rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES") or "")
-        debian_cmp_remap(rreplaces)
-        rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS") or "")
-        debian_cmp_remap(rconflicts)
-
-        if rdepends:
-            ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))
-        if rsuggests:
-            ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests))
-        if rrecommends:
-            ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends))
-        if rprovides:
-            ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides))
-        if rreplaces:
-            ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
-        if rconflicts:
-            ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
-        ctrlfile.write("Source: %s\n" % recipesource)
-        ctrlfile.close()
-
-        for script in ["preinst", "postinst", "prerm", "postrm"]:
-            scriptvar = localdata.getVar('pkg_%s' % script)
-            if not scriptvar:
-                continue
-            scriptfile = open(os.path.join(controldir, script), 'w')
-            scriptfile.write(scriptvar)
-            scriptfile.close()
-            os.chmod(os.path.join(controldir, script), 0o755)
-
-        conffiles_str = ' '.join(get_conffiles(pkg, d))
-        if conffiles_str:
-            conffiles = open(os.path.join(controldir, 'conffiles'), 'w')
-            for f in conffiles_str.split():
-                if os.path.exists(oe.path.join(root, f)):
-                    conffiles.write('%s\n' % f)
-            conffiles.close()
-
-        os.chdir(basedir)
-        subprocess.check_output("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH"),
-                                                          d.getVar("OPKGBUILDCMD"), pkg, pkgoutdir),
-                                stderr=subprocess.STDOUT,
-                                shell=True)
-
-        if d.getVar('IPK_SIGN_PACKAGES') == '1':
-            ipkver = "%s-%s" % (localdata.getVar('PKGV'), localdata.getVar('PKGR'))
-            ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, localdata.getVar('PACKAGE_ARCH'))
-            sign_ipk(d, ipk_to_sign)
-
-    finally:
-        cleanupcontrol(root)
-        bb.utils.unlockfile(lf)
-
-# Have to list any variables referenced as X_<pkg> that aren't in pkgdata here
-IPKEXTRAVARS = "PRIORITY MAINTAINER PACKAGE_ARCH HOMEPAGE PACKAGE_ADD_METADATA_IPK"
-ipk_write_pkg[vardeps] += "${@gen_packagevar(d, 'IPKEXTRAVARS')}"
-
-# Otherwise allarch packages may change depending on override configuration
-ipk_write_pkg[vardepsexclude] = "OVERRIDES"
-
-
-SSTATETASKS += "do_package_write_ipk"
-do_package_write_ipk[sstate-inputdirs] = "${PKGWRITEDIRIPK}"
-do_package_write_ipk[sstate-outputdirs] = "${DEPLOY_DIR_IPK}"
-
-python do_package_write_ipk_setscene () {
-    tmpdir = d.getVar('TMPDIR')
-
-    if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK):
-        os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"))
-
-    sstate_setscene(d)
-}
-addtask do_package_write_ipk_setscene
-
-python () {
-    if d.getVar('PACKAGES') != '':
-        deps = ' opkg-utils-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot xz-native:do_populate_sysroot'
-        d.appendVarFlag('do_package_write_ipk', 'depends', deps)
-        d.setVarFlag('do_package_write_ipk', 'fakeroot', "1")
-}
-
-python do_package_write_ipk () {
-    bb.build.exec_func("read_subpackage_metadata", d)
-    bb.build.exec_func("do_package_ipk", d)
-}
-do_package_write_ipk[dirs] = "${PKGWRITEDIRIPK}"
-do_package_write_ipk[cleandirs] = "${PKGWRITEDIRIPK}"
-do_package_write_ipk[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}"
-addtask package_write_ipk after do_packagedata do_package do_deploy_source_date_epoch before do_build
-do_build[rdeptask] += "do_package_write_ipk"
-
-PACKAGEINDEXDEPS += "opkg-utils-native:do_populate_sysroot"
-PACKAGEINDEXDEPS += "opkg-native:do_populate_sysroot"
diff --git a/poky/meta/classes/package_pkgdata.bbclass b/poky/meta/classes/package_pkgdata.bbclass
deleted file mode 100644
index a1ea8fc..0000000
--- a/poky/meta/classes/package_pkgdata.bbclass
+++ /dev/null
@@ -1,167 +0,0 @@
-WORKDIR_PKGDATA = "${WORKDIR}/pkgdata-sysroot"
-
-def package_populate_pkgdata_dir(pkgdatadir, d):
-    import glob
-
-    postinsts = []
-    seendirs = set()
-    stagingdir = d.getVar("PKGDATA_DIR")
-    pkgarchs = ['${MACHINE_ARCH}']
-    pkgarchs = pkgarchs + list(reversed(d.getVar("PACKAGE_EXTRA_ARCHS").split()))
-    pkgarchs.append('allarch')
-
-    bb.utils.mkdirhier(pkgdatadir)
-    for pkgarch in pkgarchs:
-        for manifest in glob.glob(d.expand("${SSTATE_MANIFESTS}/manifest-%s-*.packagedata" % pkgarch)):
-            with open(manifest, "r") as f:
-                for l in f:
-                    l = l.strip()
-                    dest = l.replace(stagingdir, "")
-                    if l.endswith("/"):
-                        staging_copydir(l, pkgdatadir, dest, seendirs)
-                        continue
-                    try:
-                        staging_copyfile(l, pkgdatadir, dest, postinsts, seendirs)
-                    except FileExistsError:
-                        continue
-
-python package_prepare_pkgdata() {
-    import copy
-    import glob
-
-    taskdepdata = d.getVar("BB_TASKDEPDATA", False)
-    mytaskname = d.getVar("BB_RUNTASK")
-    if mytaskname.endswith("_setscene"):
-        mytaskname = mytaskname.replace("_setscene", "")
-    workdir = d.getVar("WORKDIR")
-    pn = d.getVar("PN")
-    stagingdir = d.getVar("PKGDATA_DIR")
-    pkgdatadir = d.getVar("WORKDIR_PKGDATA")
-
-    # Detect bitbake -b usage
-    nodeps = d.getVar("BB_LIMITEDDEPS") or False
-    if nodeps:
-        staging_package_populate_pkgdata_dir(pkgdatadir, d)
-        return
-
-    start = None
-    configuredeps = []
-    for dep in taskdepdata:
-        data = taskdepdata[dep]
-        if data[1] == mytaskname and data[0] == pn:
-            start = dep
-            break
-    if start is None:
-        bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
-
-    # We need to figure out which sysroot files we need to expose to this task.
-    # This needs to match what would get restored from sstate, which is controlled
-    # ultimately by calls from bitbake to setscene_depvalid().
-    # That function expects a setscene dependency tree. We build a dependency tree
-    # condensed to inter-sstate task dependencies, similar to that used by setscene
-    # tasks. We can then call into setscene_depvalid() and decide
-    # which dependencies we can "see" and should expose in the recipe specific sysroot.
-    setscenedeps = copy.deepcopy(taskdepdata)
-
-    start = set([start])
-
-    sstatetasks = d.getVar("SSTATETASKS").split()
-    # Add recipe specific tasks referenced by setscene_depvalid()
-    sstatetasks.append("do_stash_locale")
-
-    # If start is an sstate task (like do_package) we need to add in its direct dependencies
-    # else the code below won't recurse into them.
-    for dep in set(start):
-        for dep2 in setscenedeps[dep][3]:
-            start.add(dep2)
-        start.remove(dep)
-
-    # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
-    for dep in taskdepdata:
-        data = setscenedeps[dep]
-        if data[1] not in sstatetasks:
-            for dep2 in setscenedeps:
-                data2 = setscenedeps[dep2]
-                if dep in data2[3]:
-                    data2[3].update(setscenedeps[dep][3])
-                    data2[3].remove(dep)
-            if dep in start:
-                start.update(setscenedeps[dep][3])
-                start.remove(dep)
-            del setscenedeps[dep]
-
-    # Remove circular references
-    for dep in setscenedeps:
-        if dep in setscenedeps[dep][3]:
-            setscenedeps[dep][3].remove(dep)
-
-    # Direct dependencies should be present and can be depended upon
-    for dep in set(start):
-        if setscenedeps[dep][1] == "do_packagedata":
-            if dep not in configuredeps:
-                configuredeps.append(dep)
-
-    msgbuf = []
-    # Call into setscene_depvalid for each sub-dependency and only copy sysroot files
-    # for ones that would be restored from sstate.
-    done = list(start)
-    next = list(start)
-    while next:
-        new = []
-        for dep in next:
-            data = setscenedeps[dep]
-            for datadep in data[3]:
-                if datadep in done:
-                    continue
-                taskdeps = {}
-                taskdeps[dep] = setscenedeps[dep][:2]
-                taskdeps[datadep] = setscenedeps[datadep][:2]
-                retval = setscene_depvalid(datadep, taskdeps, [], d, msgbuf)
-                done.append(datadep)
-                new.append(datadep)
-                if retval:
-                    msgbuf.append("Skipping setscene dependency %s" % datadep)
-                    continue
-                if datadep not in configuredeps and setscenedeps[datadep][1] == "do_packagedata":
-                    configuredeps.append(datadep)
-                    msgbuf.append("Adding dependency on %s" % setscenedeps[datadep][0])
-                else:
-                    msgbuf.append("Following dependency on %s" % setscenedeps[datadep][0])
-        next = new
-
-    # This logging is too verbose for day to day use sadly
-    #bb.debug(2, "\n".join(msgbuf))
-
-    seendirs = set()
-    postinsts = []
-    multilibs = {}
-    manifests = {}
-
-    msg_adding = []
-
-    for dep in configuredeps:
-        c = setscenedeps[dep][0]
-        msg_adding.append(c)
-
-        manifest, d2 = oe.sstatesig.find_sstate_manifest(c, setscenedeps[dep][2], "packagedata", d, multilibs)
-        destsysroot = pkgdatadir
-
-        if manifest:
-            targetdir = destsysroot
-            with open(manifest, "r") as f:
-                manifests[dep] = manifest
-                for l in f:
-                    l = l.strip()
-                    dest = targetdir + l.replace(stagingdir, "")
-                    if l.endswith("/"):
-                        staging_copydir(l, targetdir, dest, seendirs)
-                        continue
-                    staging_copyfile(l, targetdir, dest, postinsts, seendirs)
-
-    bb.note("Installed into pkgdata-sysroot: %s" % str(msg_adding))
-
-}
-package_prepare_pkgdata[cleandirs] = "${WORKDIR_PKGDATA}"
-package_prepare_pkgdata[vardepsexclude] += "MACHINE_ARCH PACKAGE_EXTRA_ARCHS SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA SSTATETASKS"
-
-
diff --git a/poky/meta/classes/package_rpm.bbclass b/poky/meta/classes/package_rpm.bbclass
deleted file mode 100644
index e9ff1f7..0000000
--- a/poky/meta/classes/package_rpm.bbclass
+++ /dev/null
@@ -1,755 +0,0 @@
-inherit package
-
-IMAGE_PKGTYPE ?= "rpm"
-
-RPM="rpm"
-RPMBUILD="rpmbuild"
-
-PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms"
-
-# Maintaining the perfile dependencies has singificant overhead when writing the
-# packages. When set, this value merges them for efficiency.
-MERGEPERFILEDEPS = "1"
-
-# Filter dependencies based on a provided function.
-def filter_deps(var, f):
-    import collections
-
-    depends_dict = bb.utils.explode_dep_versions2(var)
-    newdeps_dict = collections.OrderedDict()
-    for dep in depends_dict:
-        if f(dep):
-            newdeps_dict[dep] = depends_dict[dep]
-    return bb.utils.join_deps(newdeps_dict, commasep=False)
-
-# Filter out absolute paths (typically /bin/sh and /usr/bin/env) and any perl
-# dependencies for nativesdk packages.
-def filter_nativesdk_deps(srcname, var):
-    if var and srcname.startswith("nativesdk-"):
-        var = filter_deps(var, lambda dep: not dep.startswith('/') and dep != 'perl' and not dep.startswith('perl('))
-    return var
-
-# Construct per file dependencies file
-def write_rpm_perfiledata(srcname, d):
-    workdir = d.getVar('WORKDIR')
-    packages = d.getVar('PACKAGES')
-    pkgd = d.getVar('PKGD')
-
-    def dump_filerdeps(varname, outfile, d):
-        outfile.write("#!/usr/bin/env python3\n\n")
-        outfile.write("# Dependency table\n")
-        outfile.write('deps = {\n')
-        for pkg in packages.split():
-            dependsflist_key = 'FILE' + varname + 'FLIST' + ":" + pkg
-            dependsflist = (d.getVar(dependsflist_key) or "")
-            for dfile in dependsflist.split():
-                key = "FILE" + varname + ":" + dfile + ":" + pkg
-                deps = filter_nativesdk_deps(srcname, d.getVar(key) or "")
-                depends_dict = bb.utils.explode_dep_versions(deps)
-                file = dfile.replace("@underscore@", "_")
-                file = file.replace("@closebrace@", "]")
-                file = file.replace("@openbrace@", "[")
-                file = file.replace("@tab@", "\t")
-                file = file.replace("@space@", " ")
-                file = file.replace("@at@", "@")
-                outfile.write('"' + pkgd + file + '" : "')
-                for dep in depends_dict:
-                    ver = depends_dict[dep]
-                    if dep and ver:
-                        ver = ver.replace("(","")
-                        ver = ver.replace(")","")
-                        outfile.write(dep + " " + ver + " ")
-                    else:
-                        outfile.write(dep + " ")
-                outfile.write('",\n')
-        outfile.write('}\n\n')
-        outfile.write("import sys\n")
-        outfile.write("while 1:\n")
-        outfile.write("\tline = sys.stdin.readline().strip()\n")
-        outfile.write("\tif not line:\n")
-        outfile.write("\t\tsys.exit(0)\n")
-        outfile.write("\tif line in deps:\n")
-        outfile.write("\t\tprint(deps[line] + '\\n')\n")
-
-    # OE-core dependencies a.k.a. RPM requires
-    outdepends = workdir + "/" + srcname + ".requires"
-
-    dependsfile = open(outdepends, 'w')
-
-    dump_filerdeps('RDEPENDS', dependsfile, d)
-
-    dependsfile.close()
-    os.chmod(outdepends, 0o755)
-
-    # OE-core / RPM Provides
-    outprovides = workdir + "/" + srcname + ".provides"
-
-    providesfile = open(outprovides, 'w')
-
-    dump_filerdeps('RPROVIDES', providesfile, d)
-
-    providesfile.close()
-    os.chmod(outprovides, 0o755)
-
-    return (outdepends, outprovides)
-
-
-python write_specfile () {
-    import oe.packagedata
-
-    # append information for logs and patches to %prep
-    def add_prep(d,spec_files_bottom):
-        if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
-            spec_files_bottom.append('%%prep -n %s' % d.getVar('PN') )
-            spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"")
-            spec_files_bottom.append('')
-
-    # append the name of tarball to key word 'SOURCE' in xxx.spec.
-    def tail_source(d):
-        if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
-            ar_outdir = d.getVar('ARCHIVER_OUTDIR')
-            if not os.path.exists(ar_outdir):
-                return
-            source_list = os.listdir(ar_outdir)
-            source_number = 0
-            for source in source_list:
-                # do_deploy_archives may have already run (from sstate) meaning a .src.rpm may already 
-                # exist in ARCHIVER_OUTDIR so skip if present.
-                if source.endswith(".src.rpm"):
-                    continue
-                # The rpmbuild doesn't need the root permission, but it needs
-                # to know the file's user and group name, the only user and
-                # group in fakeroot is "root" when working in fakeroot.
-                f = os.path.join(ar_outdir, source)
-                os.chown(f, 0, 0)
-                spec_preamble_top.append('Source%s: %s' % (source_number, source))
-                source_number += 1
-
-    # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
-    # This format is similar to OE, however there are restrictions on the
-    # characters that can be in a field.  In the Version field, "-"
-    # characters are not allowed.  "-" is allowed in the Release field.
-    #
-    # We translate the "-" in the version to a "+", by loading the PKGV
-    # from the dependent recipe, replacing the - with a +, and then using
-    # that value to do a replace inside of this recipe's dependencies.
-    # This preserves the "-" separator between the version and release, as
-    # well as any "-" characters inside of the release field.
-    #
-    # All of this has to happen BEFORE the mapping_rename_hook as
-    # after renaming we cannot look up the dependencies in the packagedata
-    # store.
-    def translate_vers(varname, d):
-        depends = d.getVar(varname)
-        if depends:
-            depends_dict = bb.utils.explode_dep_versions2(depends)
-            newdeps_dict = {}
-            for dep in depends_dict:
-                verlist = []
-                for ver in depends_dict[dep]:
-                    if '-' in ver:
-                        subd = oe.packagedata.read_subpkgdata_dict(dep, d)
-                        if 'PKGV' in subd:
-                            pv = subd['PV']
-                            pkgv = subd['PKGV']
-                            reppv = pkgv.replace('-', '+')
-                            ver = ver.replace(pv, reppv).replace(pkgv, reppv)
-                        if 'PKGR' in subd:
-                            # Make sure PKGR rather than PR in ver
-                            pr = '-' + subd['PR']
-                            pkgr = '-' + subd['PKGR']
-                            if pkgr not in ver:
-                                ver = ver.replace(pr, pkgr)
-                        verlist.append(ver)
-                    else:
-                        verlist.append(ver)
-                newdeps_dict[dep] = verlist
-            depends = bb.utils.join_deps(newdeps_dict)
-            d.setVar(varname, depends.strip())
-
-    # We need to change the style the dependency from BB to RPM
-    # This needs to happen AFTER the mapping_rename_hook
-    def print_deps(variable, tag, array, d):
-        depends = variable
-        if depends:
-            depends_dict = bb.utils.explode_dep_versions2(depends)
-            for dep in depends_dict:
-                for ver in depends_dict[dep]:
-                    ver = ver.replace('(', '')
-                    ver = ver.replace(')', '')
-                    array.append("%s: %s %s" % (tag, dep, ver))
-                if not len(depends_dict[dep]):
-                    array.append("%s: %s" % (tag, dep))
-
-    def walk_files(walkpath, target, conffiles, dirfiles):
-        # We can race against the ipk/deb backends which create CONTROL or DEBIAN directories
-        # when packaging. We just ignore these files which are created in 
-        # packages-split/ and not package/
-        # We have the odd situation where the CONTROL/DEBIAN directory can be removed in the middle of
-        # of the walk, the isdir() test would then fail and the walk code would assume its a file
-        # hence we check for the names in files too.
-        for rootpath, dirs, files in os.walk(walkpath):
-            path = rootpath.replace(walkpath, "")
-            if path.endswith("DEBIAN") or path.endswith("CONTROL"):
-                continue
-            path = path.replace("%", "%%%%%%%%")
-            path = path.replace("[", "?")
-            path = path.replace("]", "?")
-
-            # Treat all symlinks to directories as normal files.
-            # os.walk() lists them as directories.
-            def move_to_files(dir):
-                if os.path.islink(os.path.join(rootpath, dir)):
-                    files.append(dir)
-                    return True
-                else:
-                    return False
-            dirs[:] = [dir for dir in dirs if not move_to_files(dir)]
-
-            # Directory handling can happen in two ways, either DIRFILES is not set at all
-            # in which case we fall back to the older behaviour of packages owning all their
-            # directories
-            if dirfiles is None:
-                for dir in dirs:
-                    if dir == "CONTROL" or dir == "DEBIAN":
-                        continue
-                    dir = dir.replace("%", "%%%%%%%%")
-                    dir = dir.replace("[", "?")
-                    dir = dir.replace("]", "?")
-                    # All packages own the directories their files are in...
-                    target.append('%dir "' + path + '/' + dir + '"')
-            else:
-                # packages own only empty directories or explict directory.
-                # This will prevent the overlapping of security permission.
-                if path and not files and not dirs:
-                    target.append('%dir "' + path + '"')
-                elif path and path in dirfiles:
-                    target.append('%dir "' + path + '"')
-
-            for file in files:
-                if file == "CONTROL" or file == "DEBIAN":
-                    continue
-                file = file.replace("%", "%%%%%%%%")
-                file = file.replace("[", "?")
-                file = file.replace("]", "?")
-                if conffiles.count(path + '/' + file):
-                    target.append('%config "' + path + '/' + file + '"')
-                else:
-                    target.append('"' + path + '/' + file + '"')
-
-    # Prevent the prerm/postrm scripts from being run during an upgrade
-    def wrap_uninstall(scriptvar):
-        scr = scriptvar.strip()
-        if scr.startswith("#!"):
-            pos = scr.find("\n") + 1
-        else:
-            pos = 0
-        scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi'
-        return scr
-
-    def get_perfile(varname, pkg, d):
-        deps = []
-        dependsflist_key = 'FILE' + varname + 'FLIST' + ":" + pkg
-        dependsflist = (d.getVar(dependsflist_key) or "")
-        for dfile in dependsflist.split():
-            key = "FILE" + varname + ":" + dfile + ":" + pkg
-            depends = d.getVar(key)
-            if depends:
-                deps.append(depends)
-        return " ".join(deps)
-
-    def append_description(spec_preamble, text):
-        """
-        Add the description to the spec file.
-        """
-        import textwrap
-        dedent_text = textwrap.dedent(text).strip()
-        # Bitbake saves "\n" as "\\n"
-        if '\\n' in dedent_text:
-            for t in dedent_text.split('\\n'):
-                spec_preamble.append(t.strip())
-        else:
-            spec_preamble.append('%s' % textwrap.fill(dedent_text, width=75))
-
-    packages = d.getVar('PACKAGES')
-    if not packages or packages == '':
-        bb.debug(1, "No packages; nothing to do")
-        return
-
-    pkgdest = d.getVar('PKGDEST')
-    if not pkgdest:
-        bb.fatal("No PKGDEST")
-
-    outspecfile = d.getVar('OUTSPECFILE')
-    if not outspecfile:
-        bb.fatal("No OUTSPECFILE")
-
-    # Construct the SPEC file...
-    srcname    = d.getVar('PN')
-    localdata = bb.data.createCopy(d)
-    localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + srcname)
-    srcsummary = (localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or ".")
-    srcversion = localdata.getVar('PKGV').replace('-', '+')
-    srcrelease = localdata.getVar('PKGR')
-    srcepoch   = (localdata.getVar('PKGE') or "")
-    srclicense = localdata.getVar('LICENSE')
-    srcsection = localdata.getVar('SECTION')
-    srcmaintainer  = localdata.getVar('MAINTAINER')
-    srchomepage    = localdata.getVar('HOMEPAGE')
-    srcdescription = localdata.getVar('DESCRIPTION') or "."
-    srccustomtagschunk = get_package_additional_metadata("rpm", localdata)
-
-    srcdepends     = d.getVar('DEPENDS')
-    srcrdepends    = ""
-    srcrrecommends = ""
-    srcrsuggests   = ""
-    srcrprovides   = ""
-    srcrreplaces   = ""
-    srcrconflicts  = ""
-    srcrobsoletes  = ""
-
-    srcrpreinst  = []
-    srcrpostinst = []
-    srcrprerm    = []
-    srcrpostrm   = []
-
-    spec_preamble_top = []
-    spec_preamble_bottom = []
-
-    spec_scriptlets_top = []
-    spec_scriptlets_bottom = []
-
-    spec_files_top = []
-    spec_files_bottom = []
-
-    perfiledeps = (d.getVar("MERGEPERFILEDEPS") or "0") == "0"
-    extra_pkgdata = (d.getVar("RPM_EXTRA_PKGDATA") or "0") == "1"
-
-    for pkg in packages.split():
-        localdata = bb.data.createCopy(d)
-
-        root = "%s/%s" % (pkgdest, pkg)
-
-        localdata.setVar('ROOT', '')
-        localdata.setVar('ROOT_%s' % pkg, root)
-        pkgname = localdata.getVar('PKG:%s' % pkg)
-        if not pkgname:
-            pkgname = pkg
-        localdata.setVar('PKG', pkgname)
-
-        localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)
-
-        conffiles = get_conffiles(pkg, d)
-        dirfiles = localdata.getVar('DIRFILES')
-        if dirfiles is not None:
-            dirfiles = dirfiles.split()
-
-        splitname    = pkgname
-
-        splitsummary = (localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or ".")
-        splitversion = (localdata.getVar('PKGV') or "").replace('-', '+')
-        splitrelease = (localdata.getVar('PKGR') or "")
-        splitepoch   = (localdata.getVar('PKGE') or "")
-        splitlicense = (localdata.getVar('LICENSE') or "")
-        splitsection = (localdata.getVar('SECTION') or "")
-        splitdescription = (localdata.getVar('DESCRIPTION') or ".")
-        splitcustomtagschunk = get_package_additional_metadata("rpm", localdata)
-
-        translate_vers('RDEPENDS', localdata)
-        translate_vers('RRECOMMENDS', localdata)
-        translate_vers('RSUGGESTS', localdata)
-        translate_vers('RPROVIDES', localdata)
-        translate_vers('RREPLACES', localdata)
-        translate_vers('RCONFLICTS', localdata)
-
-        # Map the dependencies into their final form
-        mapping_rename_hook(localdata)
-
-        splitrdepends    = localdata.getVar('RDEPENDS') or ""
-        splitrrecommends = localdata.getVar('RRECOMMENDS') or ""
-        splitrsuggests   = localdata.getVar('RSUGGESTS') or ""
-        splitrprovides   = localdata.getVar('RPROVIDES') or ""
-        splitrreplaces   = localdata.getVar('RREPLACES') or ""
-        splitrconflicts  = localdata.getVar('RCONFLICTS') or ""
-        splitrobsoletes  = ""
-
-        splitrpreinst  = localdata.getVar('pkg_preinst')
-        splitrpostinst = localdata.getVar('pkg_postinst')
-        splitrprerm    = localdata.getVar('pkg_prerm')
-        splitrpostrm   = localdata.getVar('pkg_postrm')
-
-
-        if not perfiledeps:
-            # Add in summary of per file dependencies
-            splitrdepends = splitrdepends + " " + get_perfile('RDEPENDS', pkg, d)
-            splitrprovides = splitrprovides + " " + get_perfile('RPROVIDES', pkg, d)
-
-        splitrdepends = filter_nativesdk_deps(srcname, splitrdepends)
-
-        # Gather special src/first package data
-        if srcname == splitname:
-            archiving = d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and \
-                        bb.data.inherits_class('archiver', d)
-            if archiving and srclicense != splitlicense:
-                bb.warn("The SRPM produced may not have the correct overall source license in the License tag. This is due to the LICENSE for the primary package and SRPM conflicting.")
-
-            srclicense     = splitlicense
-            srcrdepends    = splitrdepends
-            srcrrecommends = splitrrecommends
-            srcrsuggests   = splitrsuggests
-            srcrprovides   = splitrprovides
-            srcrreplaces   = splitrreplaces
-            srcrconflicts  = splitrconflicts
-
-            srcrpreinst    = splitrpreinst
-            srcrpostinst   = splitrpostinst
-            srcrprerm      = splitrprerm
-            srcrpostrm     = splitrpostrm
-
-            file_list = []
-            walk_files(root, file_list, conffiles, dirfiles)
-            if not file_list and localdata.getVar('ALLOW_EMPTY', False) != "1":
-                bb.note("Not creating empty RPM package for %s" % splitname)
-            else:
-                spec_files_top.append('%files')
-                if extra_pkgdata:
-                    package_rpm_extra_pkgdata(splitname, spec_files_top, localdata)
-                spec_files_top.append('%defattr(-,-,-,-)')
-                if file_list:
-                    bb.note("Creating RPM package for %s" % splitname)
-                    spec_files_top.extend(file_list)
-                else:
-                    bb.note("Creating empty RPM package for %s" % splitname)
-                spec_files_top.append('')
-            continue
-
-        # Process subpackage data
-        spec_preamble_bottom.append('%%package -n %s' % splitname)
-        spec_preamble_bottom.append('Summary: %s' % splitsummary)
-        if srcversion != splitversion:
-            spec_preamble_bottom.append('Version: %s' % splitversion)
-        if srcrelease != splitrelease:
-            spec_preamble_bottom.append('Release: %s' % splitrelease)
-        if srcepoch != splitepoch:
-            spec_preamble_bottom.append('Epoch: %s' % splitepoch)
-        spec_preamble_bottom.append('License: %s' % splitlicense)
-        spec_preamble_bottom.append('Group: %s' % splitsection)
-
-        if srccustomtagschunk != splitcustomtagschunk:
-            spec_preamble_bottom.append(splitcustomtagschunk)
-
-        # Replaces == Obsoletes && Provides
-        robsoletes = bb.utils.explode_dep_versions2(splitrobsoletes)
-        rprovides = bb.utils.explode_dep_versions2(splitrprovides)
-        rreplaces = bb.utils.explode_dep_versions2(splitrreplaces)
-        for dep in rreplaces:
-            if not dep in robsoletes:
-                robsoletes[dep] = rreplaces[dep]
-            if not dep in rprovides:
-                rprovides[dep] = rreplaces[dep]
-        splitrobsoletes = bb.utils.join_deps(robsoletes, commasep=False)
-        splitrprovides = bb.utils.join_deps(rprovides, commasep=False)
-
-        print_deps(splitrdepends, "Requires", spec_preamble_bottom, d)
-        if splitrpreinst:
-            print_deps(splitrdepends, "Requires(pre)", spec_preamble_bottom, d)
-        if splitrpostinst:
-            print_deps(splitrdepends, "Requires(post)", spec_preamble_bottom, d)
-        if splitrprerm:
-            print_deps(splitrdepends, "Requires(preun)", spec_preamble_bottom, d)
-        if splitrpostrm:
-            print_deps(splitrdepends, "Requires(postun)", spec_preamble_bottom, d)
-
-        print_deps(splitrrecommends, "Recommends", spec_preamble_bottom, d)
-        print_deps(splitrsuggests,  "Suggests", spec_preamble_bottom, d)
-        print_deps(splitrprovides,  "Provides", spec_preamble_bottom, d)
-        print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d)
-        print_deps(splitrconflicts,  "Conflicts", spec_preamble_bottom, d)
-
-        spec_preamble_bottom.append('')
-
-        spec_preamble_bottom.append('%%description -n %s' % splitname)
-        append_description(spec_preamble_bottom, splitdescription)
-
-        spec_preamble_bottom.append('')
-
-        # Now process scriptlets
-        if splitrpreinst:
-            spec_scriptlets_bottom.append('%%pre -n %s' % splitname)
-            spec_scriptlets_bottom.append('# %s - preinst' % splitname)
-            spec_scriptlets_bottom.append(splitrpreinst)
-            spec_scriptlets_bottom.append('')
-        if splitrpostinst:
-            spec_scriptlets_bottom.append('%%post -n %s' % splitname)
-            spec_scriptlets_bottom.append('# %s - postinst' % splitname)
-            spec_scriptlets_bottom.append(splitrpostinst)
-            spec_scriptlets_bottom.append('')
-        if splitrprerm:
-            spec_scriptlets_bottom.append('%%preun -n %s' % splitname)
-            spec_scriptlets_bottom.append('# %s - prerm' % splitname)
-            scriptvar = wrap_uninstall(splitrprerm)
-            spec_scriptlets_bottom.append(scriptvar)
-            spec_scriptlets_bottom.append('')
-        if splitrpostrm:
-            spec_scriptlets_bottom.append('%%postun -n %s' % splitname)
-            spec_scriptlets_bottom.append('# %s - postrm' % splitname)
-            scriptvar = wrap_uninstall(splitrpostrm)
-            spec_scriptlets_bottom.append(scriptvar)
-            spec_scriptlets_bottom.append('')
-
-        # Now process files
-        file_list = []
-        walk_files(root, file_list, conffiles, dirfiles)
-        if not file_list and localdata.getVar('ALLOW_EMPTY', False) != "1":
-            bb.note("Not creating empty RPM package for %s" % splitname)
-        else:
-            spec_files_bottom.append('%%files -n %s' % splitname)
-            if extra_pkgdata:
-                package_rpm_extra_pkgdata(splitname, spec_files_bottom, localdata)
-            spec_files_bottom.append('%defattr(-,-,-,-)')
-            if file_list:
-                bb.note("Creating RPM package for %s" % splitname)
-                spec_files_bottom.extend(file_list)
-            else:
-                bb.note("Creating empty RPM package for %s" % splitname)
-            spec_files_bottom.append('')
-
-        del localdata
-    
-    add_prep(d,spec_files_bottom)
-    spec_preamble_top.append('Summary: %s' % srcsummary)
-    spec_preamble_top.append('Name: %s' % srcname)
-    spec_preamble_top.append('Version: %s' % srcversion)
-    spec_preamble_top.append('Release: %s' % srcrelease)
-    if srcepoch and srcepoch.strip() != "":
-        spec_preamble_top.append('Epoch: %s' % srcepoch)
-    spec_preamble_top.append('License: %s' % srclicense)
-    spec_preamble_top.append('Group: %s' % srcsection)
-    spec_preamble_top.append('Packager: %s' % srcmaintainer)
-    if srchomepage:
-        spec_preamble_top.append('URL: %s' % srchomepage)
-    if srccustomtagschunk:
-        spec_preamble_top.append(srccustomtagschunk)
-    tail_source(d)
-
-    # Replaces == Obsoletes && Provides
-    robsoletes = bb.utils.explode_dep_versions2(srcrobsoletes)
-    rprovides = bb.utils.explode_dep_versions2(srcrprovides)
-    rreplaces = bb.utils.explode_dep_versions2(srcrreplaces)
-    for dep in rreplaces:
-        if not dep in robsoletes:
-            robsoletes[dep] = rreplaces[dep]
-        if not dep in rprovides:
-            rprovides[dep] = rreplaces[dep]
-    srcrobsoletes = bb.utils.join_deps(robsoletes, commasep=False)
-    srcrprovides = bb.utils.join_deps(rprovides, commasep=False)
-
-    print_deps(srcdepends, "BuildRequires", spec_preamble_top, d)
-    print_deps(srcrdepends, "Requires", spec_preamble_top, d)
-    if srcrpreinst:
-        print_deps(srcrdepends, "Requires(pre)", spec_preamble_top, d)
-    if srcrpostinst:
-        print_deps(srcrdepends, "Requires(post)", spec_preamble_top, d)
-    if srcrprerm:
-        print_deps(srcrdepends, "Requires(preun)", spec_preamble_top, d)
-    if srcrpostrm:
-        print_deps(srcrdepends, "Requires(postun)", spec_preamble_top, d)
-
-    print_deps(srcrrecommends, "Recommends", spec_preamble_top, d)
-    print_deps(srcrsuggests, "Suggests", spec_preamble_top, d)
-    print_deps(srcrprovides, "Provides", spec_preamble_top, d)
-    print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d)
-    print_deps(srcrconflicts, "Conflicts", spec_preamble_top, d)
-
-    spec_preamble_top.append('')
-
-    spec_preamble_top.append('%description')
-    append_description(spec_preamble_top, srcdescription)
-
-    spec_preamble_top.append('')
-
-    if srcrpreinst:
-        spec_scriptlets_top.append('%pre')
-        spec_scriptlets_top.append('# %s - preinst' % srcname)
-        spec_scriptlets_top.append(srcrpreinst)
-        spec_scriptlets_top.append('')
-    if srcrpostinst:
-        spec_scriptlets_top.append('%post')
-        spec_scriptlets_top.append('# %s - postinst' % srcname)
-        spec_scriptlets_top.append(srcrpostinst)
-        spec_scriptlets_top.append('')
-    if srcrprerm:
-        spec_scriptlets_top.append('%preun')
-        spec_scriptlets_top.append('# %s - prerm' % srcname)
-        scriptvar = wrap_uninstall(srcrprerm)
-        spec_scriptlets_top.append(scriptvar)
-        spec_scriptlets_top.append('')
-    if srcrpostrm:
-        spec_scriptlets_top.append('%postun')
-        spec_scriptlets_top.append('# %s - postrm' % srcname)
-        scriptvar = wrap_uninstall(srcrpostrm)
-        spec_scriptlets_top.append(scriptvar)
-        spec_scriptlets_top.append('')
-
-    # Write the SPEC file
-    specfile = open(outspecfile, 'w')
-
-    # RPMSPEC_PREAMBLE is a way to add arbitrary text to the top
-    # of the generated spec file
-    external_preamble = d.getVar("RPMSPEC_PREAMBLE")
-    if external_preamble:
-        specfile.write(external_preamble + "\n")
-
-    for line in spec_preamble_top:
-        specfile.write(line + "\n")
-
-    for line in spec_preamble_bottom:
-        specfile.write(line + "\n")
-
-    for line in spec_scriptlets_top:
-        specfile.write(line + "\n")
-
-    for line in spec_scriptlets_bottom:
-        specfile.write(line + "\n")
-
-    for line in spec_files_top:
-        specfile.write(line + "\n")
-
-    for line in spec_files_bottom:
-        specfile.write(line + "\n")
-
-    specfile.close()
-}
-# Otherwise allarch packages may change depending on override configuration
-write_specfile[vardepsexclude] = "OVERRIDES"
-
-# Have to list any variables referenced as X_<pkg> that aren't in pkgdata here
-RPMEXTRAVARS = "PACKAGE_ADD_METADATA_RPM"
-write_specfile[vardeps] += "${@gen_packagevar(d, 'RPMEXTRAVARS')}"
-
-python do_package_rpm () {
-    workdir = d.getVar('WORKDIR')
-    tmpdir = d.getVar('TMPDIR')
-    pkgd = d.getVar('PKGD')
-    pkgdest = d.getVar('PKGDEST')
-    if not workdir or not pkgd or not tmpdir:
-        bb.error("Variables incorrectly set, unable to package")
-        return
-
-    packages = d.getVar('PACKAGES')
-    if not packages or packages == '':
-        bb.debug(1, "No packages; nothing to do")
-        return
-
-    # Construct the spec file...
-    # If the spec file already exist, and has not been stored into 
-    # pseudo's files.db, it maybe cause rpmbuild src.rpm fail,
-    # so remove it before doing rpmbuild src.rpm.
-    srcname    = d.getVar('PN')
-    outspecfile = workdir + "/" + srcname + ".spec"
-    if os.path.isfile(outspecfile):
-        os.remove(outspecfile)
-    d.setVar('OUTSPECFILE', outspecfile)
-    bb.build.exec_func('write_specfile', d)
-
-    perfiledeps = (d.getVar("MERGEPERFILEDEPS") or "0") == "0"
-    if perfiledeps:
-        outdepends, outprovides = write_rpm_perfiledata(srcname, d)
-
-    # Setup the rpmbuild arguments...
-    rpmbuild = d.getVar('RPMBUILD')
-    targetsys = d.getVar('TARGET_SYS')
-    targetvendor = d.getVar('HOST_VENDOR')
-
-    # Too many places in dnf stack assume that arch-independent packages are "noarch".
-    # Let's not fight against this.
-    package_arch = (d.getVar('PACKAGE_ARCH') or "").replace("-", "_")
-    if package_arch == "all":
-        package_arch = "noarch"
-
-    sdkpkgsuffix = (d.getVar('SDKPKGSUFFIX') or "nativesdk").replace("-", "_")
-    d.setVar('PACKAGE_ARCH_EXTEND', package_arch)
-    pkgwritedir = d.expand('${PKGWRITEDIRRPM}/${PACKAGE_ARCH_EXTEND}')
-    d.setVar('RPM_PKGWRITEDIR', pkgwritedir)
-    bb.debug(1, 'PKGWRITEDIR: %s' % d.getVar('RPM_PKGWRITEDIR'))
-    pkgarch = d.expand('${PACKAGE_ARCH_EXTEND}${HOST_VENDOR}-linux')
-    bb.utils.mkdirhier(pkgwritedir)
-    os.chmod(pkgwritedir, 0o755)
-
-    cmd = rpmbuild
-    cmd = cmd + " --noclean --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
-    cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'"
-    cmd = cmd + " --define '_builddir " + d.getVar('B') + "'"
-    cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'"
-    cmd = cmd + " --define '_use_internal_dependency_generator 0'"
-    cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'"
-    cmd = cmd + " --define '_build_id_links none'"
-    cmd = cmd + " --define '_binary_payload w19T%d.zstdio'" % int(d.getVar("ZSTD_THREADS"))
-    cmd = cmd + " --define '_source_payload w19T%d.zstdio'" % int(d.getVar("ZSTD_THREADS"))
-    cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'"
-    cmd = cmd + " --define 'use_source_date_epoch_as_buildtime 1'"
-    cmd = cmd + " --define '_buildhost reproducible'"
-    cmd = cmd + " --define '__font_provides %{nil}'"
-    if perfiledeps:
-        cmd = cmd + " --define '__find_requires " + outdepends + "'"
-        cmd = cmd + " --define '__find_provides " + outprovides + "'"
-    else:
-        cmd = cmd + " --define '__find_requires %{nil}'"
-        cmd = cmd + " --define '__find_provides %{nil}'"
-    cmd = cmd + " --define '_unpackaged_files_terminate_build 0'"
-    cmd = cmd + " --define 'debug_package %{nil}'"
-    cmd = cmd + " --define '_tmppath " + workdir + "'"
-    if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
-        cmd = cmd + " --define '_sourcedir " + d.getVar('ARCHIVER_OUTDIR') + "'"
-        cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_RPMOUTDIR') + "'"
-        cmdsrpm = cmdsrpm + " -bs " + outspecfile
-        # Build the .src.rpm
-        d.setVar('SBUILDSPEC', cmdsrpm + "\n")
-        d.setVarFlag('SBUILDSPEC', 'func', '1')
-        bb.build.exec_func('SBUILDSPEC', d)
-    cmd = cmd + " -bb " + outspecfile
-
-    # rpm 4 creates various empty directories in _topdir, let's clean them up
-    cleanupcmd = "rm -rf %s/BUILDROOT %s/SOURCES %s/SPECS %s/SRPMS" % (workdir, workdir, workdir, workdir)
-
-    # Build the rpm package!
-    d.setVar('BUILDSPEC', cmd + "\n" + cleanupcmd + "\n")
-    d.setVarFlag('BUILDSPEC', 'func', '1')
-    bb.build.exec_func('BUILDSPEC', d)
-
-    if d.getVar('RPM_SIGN_PACKAGES') == '1':
-        bb.build.exec_func("sign_rpm", d)
-}
-
-python () {
-    if d.getVar('PACKAGES') != '':
-        deps = ' rpm-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
-        d.appendVarFlag('do_package_write_rpm', 'depends', deps)
-        d.setVarFlag('do_package_write_rpm', 'fakeroot', '1')
-}
-
-SSTATETASKS += "do_package_write_rpm"
-do_package_write_rpm[sstate-inputdirs] = "${PKGWRITEDIRRPM}"
-do_package_write_rpm[sstate-outputdirs] = "${DEPLOY_DIR_RPM}"
-# Take a shared lock, we can write multiple packages at the same time...
-# but we need to stop the rootfs/solver from running while we do...
-do_package_write_rpm[sstate-lockfile-shared] += "${DEPLOY_DIR_RPM}/rpm.lock"
-
-python do_package_write_rpm_setscene () {
-    sstate_setscene(d)
-}
-addtask do_package_write_rpm_setscene
-
-python do_package_write_rpm () {
-    bb.build.exec_func("read_subpackage_metadata", d)
-    bb.build.exec_func("do_package_rpm", d)
-}
-
-do_package_write_rpm[dirs] = "${PKGWRITEDIRRPM}"
-do_package_write_rpm[cleandirs] = "${PKGWRITEDIRRPM}"
-do_package_write_rpm[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}"
-addtask package_write_rpm after do_packagedata do_package do_deploy_source_date_epoch before do_build
-do_build[rdeptask] += "do_package_write_rpm"
-
-PACKAGEINDEXDEPS += "rpm-native:do_populate_sysroot"
-PACKAGEINDEXDEPS += "createrepo-c-native:do_populate_sysroot"
diff --git a/poky/meta/classes/package_tar.bbclass b/poky/meta/classes/package_tar.bbclass
deleted file mode 100644
index d6c1b30..0000000
--- a/poky/meta/classes/package_tar.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-inherit package
-
-IMAGE_PKGTYPE ?= "tar"
-
-python do_package_tar () {
-    import subprocess
-
-    oldcwd = os.getcwd()
-
-    workdir = d.getVar('WORKDIR')
-    if not workdir:
-        bb.error("WORKDIR not defined, unable to package")
-        return
-
-    outdir = d.getVar('DEPLOY_DIR_TAR')
-    if not outdir:
-        bb.error("DEPLOY_DIR_TAR not defined, unable to package")
-        return
-
-    dvar = d.getVar('D')
-    if not dvar:
-        bb.error("D not defined, unable to package")
-        return
-
-    packages = d.getVar('PACKAGES')
-    if not packages:
-        bb.debug(1, "PACKAGES not defined, nothing to package")
-        return
-
-    pkgdest = d.getVar('PKGDEST')
-
-    bb.utils.mkdirhier(outdir)
-    bb.utils.mkdirhier(dvar)
-
-    for pkg in packages.split():
-        localdata = bb.data.createCopy(d)
-        root = "%s/%s" % (pkgdest, pkg)
-
-        overrides = localdata.getVar('OVERRIDES', False)
-        localdata.setVar('OVERRIDES', '%s:%s' % (overrides, pkg))
-
-        bb.utils.mkdirhier(root)
-        basedir = os.path.dirname(root)
-        tarfn = localdata.expand("${DEPLOY_DIR_TAR}/${PKG}-${PKGV}-${PKGR}.tar.gz")
-        os.chdir(root)
-        dlist = os.listdir(root)
-        if not dlist:
-            bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
-            continue
-        args = "tar -cz --exclude=CONTROL --exclude=DEBIAN -f".split()
-        ret = subprocess.call(args + [tarfn] + dlist)
-        if ret != 0:
-            bb.error("Creation of tar %s failed." % tarfn)
-
-    os.chdir(oldcwd)
-}
-
-python () {
-    if d.getVar('PACKAGES') != '':
-        deps = ' tar-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
-        d.appendVarFlag('do_package_write_tar', 'depends', deps)
-        d.setVarFlag('do_package_write_tar', 'fakeroot', "1")
-}
-
-
-python do_package_write_tar () {
-    bb.build.exec_func("read_subpackage_metadata", d)
-    bb.build.exec_func("do_package_tar", d)
-}
-do_package_write_tar[dirs] = "${D}"
-addtask package_write_tar before do_build after do_packagedata do_package
diff --git a/poky/meta/classes/packagedata.bbclass b/poky/meta/classes/packagedata.bbclass
deleted file mode 100644
index c2760e2..0000000
--- a/poky/meta/classes/packagedata.bbclass
+++ /dev/null
@@ -1,34 +0,0 @@
-python read_subpackage_metadata () {
-    import oe.packagedata
-
-    vars = {
-        "PN" : d.getVar('PN'), 
-        "PE" : d.getVar('PE'), 
-        "PV" : d.getVar('PV'),
-        "PR" : d.getVar('PR'),
-    }
-
-    data = oe.packagedata.read_pkgdata(vars["PN"], d)
-
-    for key in data.keys():
-        d.setVar(key, data[key])
-
-    for pkg in d.getVar('PACKAGES').split():
-        sdata = oe.packagedata.read_subpkgdata(pkg, d)
-        for key in sdata.keys():
-            if key in vars:
-                if sdata[key] != vars[key]:
-                    if key == "PN":
-                        bb.fatal("Recipe %s is trying to create package %s which was already written by recipe %s. This will cause corruption, please resolve this and only provide the package from one recipe or the other or only build one of the recipes." % (vars[key], pkg, sdata[key]))
-                    bb.fatal("Recipe %s is trying to change %s from '%s' to '%s'. This will cause do_package_write_* failures since the incorrect data will be used and they will be unable to find the right workdir." % (vars["PN"], key, vars[key], sdata[key]))
-                continue
-            #
-            # If we set unsuffixed variables here there is a chance they could clobber override versions
-            # of that variable, e.g. DESCRIPTION could clobber DESCRIPTION:<pkgname>
-            # We therefore don't clobber for the unsuffixed variable versions
-            #
-            if key.endswith(":" + pkg):
-                d.setVar(key, sdata[key])
-            else:
-                d.setVar(key, sdata[key], parsing=True)
-}
diff --git a/poky/meta/classes/packagegroup.bbclass b/poky/meta/classes/packagegroup.bbclass
deleted file mode 100644
index 557b1b6..0000000
--- a/poky/meta/classes/packagegroup.bbclass
+++ /dev/null
@@ -1,61 +0,0 @@
-# Class for packagegroup (package group) recipes
-
-# By default, only the packagegroup package itself is in PACKAGES.
-# -dbg and -dev flavours are handled by the anonfunc below.
-# This means that packagegroup recipes used to build multiple packagegroup
-# packages have to modify PACKAGES after inheriting packagegroup.bbclass.
-PACKAGES = "${PN}"
-
-# By default, packagegroup packages do not depend on a certain architecture.
-# Only if dependencies are modified by MACHINE_FEATURES, packages
-# need to be set to MACHINE_ARCH before inheriting packagegroup.bbclass
-PACKAGE_ARCH ?= "all"
-
-# Fully expanded - so it applies the overrides as well
-PACKAGE_ARCH_EXPANDED := "${PACKAGE_ARCH}"
-
-LICENSE ?= "MIT"
-
-inherit ${@oe.utils.ifelse(d.getVar('PACKAGE_ARCH_EXPANDED') == 'all', 'allarch', '')}
-
-# This automatically adds -dbg and -dev flavours of all PACKAGES
-# to the list. Their dependencies (RRECOMMENDS) are handled as usual
-# by package_depchains in a following step.
-# Also mark all packages as ALLOW_EMPTY
-python () {
-    packages = d.getVar('PACKAGES').split()
-    if d.getVar('PACKAGEGROUP_DISABLE_COMPLEMENTARY') != '1':
-        types = ['', '-dbg', '-dev']
-        if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d):
-            types.append('-ptest')
-        packages = [pkg + suffix for pkg in packages
-                    for suffix in types]
-        d.setVar('PACKAGES', ' '.join(packages))
-    for pkg in packages:
-        d.setVar('ALLOW_EMPTY:%s' % pkg, '1')
-}
-
-# We don't want to look at shared library dependencies for the
-# dbg packages
-DEPCHAIN_DBGDEFAULTDEPS = "1"
-
-# We only need the packaging tasks - disable the rest
-deltask do_fetch
-deltask do_unpack
-deltask do_patch
-deltask do_configure
-deltask do_compile
-deltask do_install
-deltask do_populate_sysroot
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-python () {
-    if bb.data.inherits_class('nativesdk', d):
-        return
-    initman = d.getVar("VIRTUAL-RUNTIME_init_manager")
-    if initman and initman in ['sysvinit', 'systemd'] and not bb.utils.contains('DISTRO_FEATURES', initman, True, False, d):
-        bb.fatal("Please ensure that your setting of VIRTUAL-RUNTIME_init_manager (%s) matches the entries enabled in DISTRO_FEATURES" % initman)
-}
-
-CVE_PRODUCT = ""
diff --git a/poky/meta/classes/patch.bbclass b/poky/meta/classes/patch.bbclass
deleted file mode 100644
index 8de7025..0000000
--- a/poky/meta/classes/patch.bbclass
+++ /dev/null
@@ -1,169 +0,0 @@
-# Copyright (C) 2006  OpenedHand LTD
-
-# Point to an empty file so any user's custom settings don't break things
-QUILTRCFILE ?= "${STAGING_ETCDIR_NATIVE}/quiltrc"
-
-PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot"
-
-# There is a bug in patch 2.7.3 and earlier where index lines
-# in patches can change file modes when they shouldn't:
-# http://git.savannah.gnu.org/cgit/patch.git/patch/?id=82b800c9552a088a241457948219d25ce0a407a4
-# This leaks into debug sources in particular. Add the dependency
-# to target recipes to avoid this problem until we can rely on 2.7.4 or later.
-PATCHDEPENDENCY:append:class-target = " patch-replacement-native:do_populate_sysroot"
-
-PATCH_GIT_USER_NAME ?= "OpenEmbedded"
-PATCH_GIT_USER_EMAIL ?= "oe.patch@oe"
-
-inherit terminal
-
-python () {
-    if d.getVar('PATCHTOOL') == 'git' and d.getVar('PATCH_COMMIT_FUNCTIONS') == '1':
-        extratasks = bb.build.tasksbetween('do_unpack', 'do_patch', d)
-        try:
-            extratasks.remove('do_unpack')
-        except ValueError:
-            # For some recipes do_unpack doesn't exist, ignore it
-            pass
-
-        d.appendVarFlag('do_patch', 'prefuncs', ' patch_task_patch_prefunc')
-        for task in extratasks:
-            d.appendVarFlag(task, 'postfuncs', ' patch_task_postfunc')
-}
-
-python patch_task_patch_prefunc() {
-    # Prefunc for do_patch
-    srcsubdir = d.getVar('S')
-
-    workdir = os.path.abspath(d.getVar('WORKDIR'))
-    testsrcdir = os.path.abspath(srcsubdir)
-    if (testsrcdir + os.sep).startswith(workdir + os.sep):
-        # Double-check that either workdir or S or some directory in-between is a git repository
-        found = False
-        while testsrcdir != workdir:
-            if os.path.exists(os.path.join(testsrcdir, '.git')):
-                found = True
-                break
-            if testsrcdir == workdir:
-                break
-            testsrcdir = os.path.dirname(testsrcdir)
-        if not found:
-            bb.fatal('PATCHTOOL = "git" set for source tree that is not a git repository. Refusing to continue as that may result in commits being made in your metadata repository.')
-
-    patchdir = os.path.join(srcsubdir, 'patches')
-    if os.path.exists(patchdir):
-        if os.listdir(patchdir):
-            d.setVar('PATCH_HAS_PATCHES_DIR', '1')
-        else:
-            os.rmdir(patchdir)
-}
-
-python patch_task_postfunc() {
-    # Prefunc for task functions between do_unpack and do_patch
-    import oe.patch
-    import shutil
-    func = d.getVar('BB_RUNTASK')
-    srcsubdir = d.getVar('S')
-
-    if os.path.exists(srcsubdir):
-        if func == 'do_patch':
-            haspatches = (d.getVar('PATCH_HAS_PATCHES_DIR') == '1')
-            patchdir = os.path.join(srcsubdir, 'patches')
-            if os.path.exists(patchdir):
-                shutil.rmtree(patchdir)
-                if haspatches:
-                    stdout, _ = bb.process.run('git status --porcelain patches', cwd=srcsubdir)
-                    if stdout:
-                        bb.process.run('git checkout patches', cwd=srcsubdir)
-        stdout, _ = bb.process.run('git status --porcelain .', cwd=srcsubdir)
-        if stdout:
-            useroptions = []
-            oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d)
-            bb.process.run('git add .; git %s commit -a -m "Committing changes from %s\n\n%s"' % (' '.join(useroptions), func, oe.patch.GitApplyTree.ignore_commit_prefix + ' - from %s' % func), cwd=srcsubdir)
-}
-
-def src_patches(d, all=False, expand=True):
-    import oe.patch
-    return oe.patch.src_patches(d, all, expand)
-
-def should_apply(parm, d):
-    """Determine if we should apply the given patch"""
-    import oe.patch
-    return oe.patch.should_apply(parm, d)
-
-should_apply[vardepsexclude] = "DATE SRCDATE"
-
-python patch_do_patch() {
-    import oe.patch
-
-    patchsetmap = {
-        "patch": oe.patch.PatchTree,
-        "quilt": oe.patch.QuiltTree,
-        "git": oe.patch.GitApplyTree,
-    }
-
-    cls = patchsetmap[d.getVar('PATCHTOOL') or 'quilt']
-
-    resolvermap = {
-        "noop": oe.patch.NOOPResolver,
-        "user": oe.patch.UserResolver,
-    }
-
-    rcls = resolvermap[d.getVar('PATCHRESOLVE') or 'user']
-
-    classes = {}
-
-    s = d.getVar('S')
-
-    os.putenv('PATH', d.getVar('PATH'))
-
-    # We must use one TMPDIR per process so that the "patch" processes
-    # don't generate the same temp file name.
-
-    import tempfile
-    process_tmpdir = tempfile.mkdtemp()
-    os.environ['TMPDIR'] = process_tmpdir
-
-    for patch in src_patches(d):
-        _, _, local, _, _, parm = bb.fetch.decodeurl(patch)
-
-        if "patchdir" in parm:
-            patchdir = parm["patchdir"]
-            if not os.path.isabs(patchdir):
-                patchdir = os.path.join(s, patchdir)
-            if not os.path.isdir(patchdir):
-                bb.fatal("Target directory '%s' not found, patchdir '%s' is incorrect in patch file '%s'" %
-                    (patchdir, parm["patchdir"], parm['patchname']))
-        else:
-            patchdir = s
-
-        if not patchdir in classes:
-            patchset = cls(patchdir, d)
-            resolver = rcls(patchset, oe_terminal)
-            classes[patchdir] = (patchset, resolver)
-            patchset.Clean()
-        else:
-            patchset, resolver = classes[patchdir]
-
-        bb.note("Applying patch '%s' (%s)" % (parm['patchname'], oe.path.format_display(local, d)))
-        try:
-            patchset.Import({"file":local, "strippath": parm['striplevel']}, True)
-        except Exception as exc:
-            bb.utils.remove(process_tmpdir, True)
-            bb.fatal("Importing patch '%s' with striplevel '%s'\n%s" % (parm['patchname'], parm['striplevel'], repr(exc).replace("\\n", "\n")))
-        try:
-            resolver.Resolve()
-        except bb.BBHandledException as e:
-            bb.utils.remove(process_tmpdir, True)
-            bb.fatal("Applying patch '%s' on target directory '%s'\n%s" % (parm['patchname'], patchdir, repr(e).replace("\\n", "\n")))
-
-    bb.utils.remove(process_tmpdir, True)
-    del os.environ['TMPDIR']
-}
-patch_do_patch[vardepsexclude] = "PATCHRESOLVE"
-
-addtask patch after do_unpack
-do_patch[dirs] = "${WORKDIR}"
-do_patch[depends] = "${PATCHDEPENDENCY}"
-
-EXPORT_FUNCTIONS do_patch
diff --git a/poky/meta/classes/perl-version.bbclass b/poky/meta/classes/perl-version.bbclass
deleted file mode 100644
index 84b67b8..0000000
--- a/poky/meta/classes/perl-version.bbclass
+++ /dev/null
@@ -1,66 +0,0 @@
-PERL_OWN_DIR = ""
-
-# Determine the staged version of perl from the perl configuration file
-# Assign vardepvalue, because otherwise signature is changed before and after
-# perl is built (from None to real version in config.sh).
-get_perl_version[vardepvalue] = "${PERL_OWN_DIR}"
-def get_perl_version(d):
-    import re
-    cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh')
-    try:
-        f = open(cfg, 'r')
-    except IOError:
-        return None
-    l = f.readlines();
-    f.close();
-    r = re.compile(r"^version='(\d*\.\d*\.\d*)'")
-    for s in l:
-        m = r.match(s)
-        if m:
-            return m.group(1)
-    return None
-
-PERLVERSION := "${@get_perl_version(d)}"
-PERLVERSION[vardepvalue] = ""
-
-
-# Determine the staged arch of perl from the perl configuration file
-# Assign vardepvalue, because otherwise signature is changed before and after
-# perl is built (from None to real version in config.sh).
-def get_perl_arch(d):
-    import re
-    cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh')
-    try:
-        f = open(cfg, 'r')
-    except IOError:
-        return None
-    l = f.readlines();
-    f.close();
-    r = re.compile("^archname='([^']*)'")
-    for s in l:
-        m = r.match(s)
-        if m:
-            return m.group(1)
-    return None
-
-PERLARCH := "${@get_perl_arch(d)}"
-PERLARCH[vardepvalue] = ""
-
-# Determine the staged arch of perl-native from the perl configuration file
-# Assign vardepvalue, because otherwise signature is changed before and after
-# perl is built (from None to real version in config.sh).
-def get_perl_hostarch(d):
-    import re
-    cfg = d.expand('${STAGING_LIBDIR_NATIVE}/perl5/config.sh')
-    try:
-        f = open(cfg, 'r')
-    except IOError:
-        return None
-    l = f.readlines();
-    f.close();
-    r = re.compile("^archname='([^']*)'")
-    for s in l:
-        m = r.match(s)
-        if m:
-            return m.group(1)
-    return None
diff --git a/poky/meta/classes/perlnative.bbclass b/poky/meta/classes/perlnative.bbclass
deleted file mode 100644
index cc8de8b..0000000
--- a/poky/meta/classes/perlnative.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-EXTRANATIVEPATH += "perl-native"
-DEPENDS += "perl-native"
-OECMAKE_PERLNATIVE_DIR = "${STAGING_BINDIR_NATIVE}/perl-native"
diff --git a/poky/meta/classes/pixbufcache.bbclass b/poky/meta/classes/pixbufcache.bbclass
deleted file mode 100644
index 886bf19..0000000
--- a/poky/meta/classes/pixbufcache.bbclass
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# This class will generate the proper postinst/postrm scriptlets for pixbuf
-# packages.
-#
-
-DEPENDS:append:class-target = " qemu-native"
-inherit qemu
-
-PIXBUF_PACKAGES ??= "${PN}"
-
-PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native"
-
-pixbufcache_common() {
-if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} libdir=${libdir} \
-		bindir=${bindir} base_libdir=${base_libdir}
-else
-
-	# Update the pixbuf loaders in case they haven't been registered yet
-	${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
-
-	if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
-		for icondir in /usr/share/icons/*; do
-			if [ -d ${icondir} ]; then
-				gtk-update-icon-cache -t -q ${icondir}
-			fi
-		done
-	fi
-fi
-}
-
-python populate_packages:append() {
-    pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split()
-
-    for pkg in pixbuf_pkgs:
-        bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg)
-        postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
-        if not postinst:
-            postinst = '#!/bin/sh\n'
-        postinst += d.getVar('pixbufcache_common')
-        d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
-        if not postrm:
-            postrm = '#!/bin/sh\n'
-        postrm += d.getVar('pixbufcache_common')
-        d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
-gdkpixbuf_complete() {
-GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
-}
-
-DEPENDS:append:class-native = " gdk-pixbuf-native"
-SYSROOT_PREPROCESS_FUNCS:append:class-native = " pixbufcache_sstate_postinst"
-
-pixbufcache_sstate_postinst() {
-	mkdir -p ${SYSROOT_DESTDIR}${bindir}
-	dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
-        echo '#!/bin/sh' > $dest
-	echo "${gdkpixbuf_complete}" >> $dest
-	chmod 0755 $dest
-}
diff --git a/poky/meta/classes/pkgconfig.bbclass b/poky/meta/classes/pkgconfig.bbclass
deleted file mode 100644
index fa94527..0000000
--- a/poky/meta/classes/pkgconfig.bbclass
+++ /dev/null
@@ -1,2 +0,0 @@
-DEPENDS:prepend = "pkgconfig-native "
-
diff --git a/poky/meta/classes/populate_sdk.bbclass b/poky/meta/classes/populate_sdk.bbclass
deleted file mode 100644
index f64a911..0000000
--- a/poky/meta/classes/populate_sdk.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-# The majority of populate_sdk is located in populate_sdk_base
-# This chunk simply facilitates compatibility with SDK only recipes.
-
-inherit populate_sdk_base
-
-addtask populate_sdk after do_install before do_build
-
diff --git a/poky/meta/classes/populate_sdk_base.bbclass b/poky/meta/classes/populate_sdk_base.bbclass
deleted file mode 100644
index f260217..0000000
--- a/poky/meta/classes/populate_sdk_base.bbclass
+++ /dev/null
@@ -1,376 +0,0 @@
-PACKAGES = ""
-
-inherit image-postinst-intercepts image-artifact-names
-
-# Wildcards specifying complementary packages to install for every package that has been explicitly
-# installed into the rootfs
-COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev'
-COMPLEMENTARY_GLOB[staticdev-pkgs] = '*-staticdev'
-COMPLEMENTARY_GLOB[doc-pkgs] = '*-doc'
-COMPLEMENTARY_GLOB[dbg-pkgs] = '*-dbg'
-COMPLEMENTARY_GLOB[src-pkgs] = '*-src'
-COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest'
-COMPLEMENTARY_GLOB[bash-completion-pkgs] = '*-bash-completion'
-
-def complementary_globs(featurevar, d):
-    all_globs = d.getVarFlags('COMPLEMENTARY_GLOB')
-    globs = []
-    features = set((d.getVar(featurevar) or '').split())
-    for name, glob in all_globs.items():
-        if name in features:
-            globs.append(glob)
-    return ' '.join(globs)
-
-SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs src-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}"
-SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
-SDKIMAGE_INSTALL_COMPLEMENTARY[vardeps] += "SDKIMAGE_FEATURES"
-
-PACKAGE_ARCHS:append:task-populate-sdk = " sdk-provides-dummy-target"
-SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}"
-
-# List of locales to install, or "all" for all of them, or unset for none.
-SDKIMAGE_LINGUAS ?= "all"
-
-inherit rootfs_${IMAGE_PKGTYPE}
-
-SDK_DIR = "${WORKDIR}/sdk"
-SDK_OUTPUT = "${SDK_DIR}/image"
-SDK_DEPLOY = "${DEPLOY_DIR}/sdk"
-
-SDKDEPLOYDIR = "${WORKDIR}/${SDKMACHINE}-deploy-${PN}-populate-sdk"
-
-B:task-populate-sdk = "${SDK_DIR}"
-
-SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
-
-SDK_TOOLCHAIN_LANGS ??= ""
-SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust"
-
-TOOLCHAIN_HOST_TASK ?= " \
-    nativesdk-packagegroup-sdk-host \
-    packagegroup-cross-canadian-${MACHINE} \
-    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-cross-canadian-${MACHINE}', '', d)} \
-    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-cross-canadian-${MACHINE}', '', d)} \
-"
-TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= ""
-TOOLCHAIN_TARGET_TASK ?= " \
-    ${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \
-    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', multilib_pkg_extend(d, 'packagegroup-go-sdk-target'), '', d)} \
-    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', multilib_pkg_extend(d, 'libstd-rs'), '', d)} \
-    target-sdk-provides-dummy \
-"
-TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= ""
-TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
-
-# Default archived SDK's suffix
-SDK_ARCHIVE_TYPE ?= "tar.xz"
-SDK_XZ_COMPRESSION_LEVEL ?= "-9"
-SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}"
-
-# To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz
-python () {
-    if d.getVar('SDK_ARCHIVE_TYPE') == 'zip':
-       d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native')
-       # SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR}
-       # recommand to cd into input dir first to avoid archive with buildpath
-       d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r -y ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .')
-    else:
-       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}')
-}
-
-SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
-SDK_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"
-PATH:prepend = "${WORKDIR}/recipe-sysroot/${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:"
-SDK_DEPENDS += "nativesdk-glibc-locale"
-
-# We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it
-# could be set to the MACHINE_ARCH
-REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-PID = "${@os.getpid()}"
-
-EXCLUDE_FROM_WORLD = "1"
-
-SDK_PACKAGING_FUNC ?= "create_shar"
-SDK_PRE_INSTALL_COMMAND ?= ""
-SDK_POST_INSTALL_COMMAND ?= ""
-SDK_RELOCATE_AFTER_INSTALL ?= "1"
-
-SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk"
-SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK"
-
-SDK_TARGET_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.target.manifest"
-SDK_HOST_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.host.manifest"
-SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"
-SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
-
-SDK_PRUNE_SYSROOT_DIRS ?= "/dev"
-
-python write_target_sdk_manifest () {
-    from oe.sdk import sdk_list_installed_packages
-    from oe.utils import format_pkg_list
-    sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST"))
-    pkgs = sdk_list_installed_packages(d, True)
-    if not os.path.exists(sdkmanifestdir):
-        bb.utils.mkdirhier(sdkmanifestdir)
-    with open(d.getVar('SDK_TARGET_MANIFEST'), 'w') as output:
-        output.write(format_pkg_list(pkgs, 'ver'))
-}
-
-sdk_prune_dirs () {
-    for d in ${SDK_PRUNE_SYSROOT_DIRS}; do
-        rm -rf ${SDK_OUTPUT}${SDKTARGETSYSROOT}$d
-    done
-}
-
-python write_sdk_test_data() {
-    from oe.data import export2json
-    testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR'), d.getVar('TOOLCHAIN_OUTPUTNAME'))
-    bb.utils.mkdirhier(os.path.dirname(testdata))
-    export2json(d, testdata)
-}
-
-python write_host_sdk_manifest () {
-    from oe.sdk import sdk_list_installed_packages
-    from oe.utils import format_pkg_list
-    sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST"))
-    pkgs = sdk_list_installed_packages(d, False)
-    if not os.path.exists(sdkmanifestdir):
-        bb.utils.mkdirhier(sdkmanifestdir)
-    with open(d.getVar('SDK_HOST_MANIFEST'), 'w') as output:
-        output.write(format_pkg_list(pkgs, 'ver'))
-}
-
-POPULATE_SDK_POST_TARGET_COMMAND:append = " write_sdk_test_data ; "
-POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk  = " write_target_sdk_manifest; sdk_prune_dirs; "
-POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manifest; "
-
-SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}"
-SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; ${SDK_PACKAGING_COMMAND} "
-
-def populate_sdk_common(d):
-    from oe.sdk import populate_sdk
-    from oe.manifest import create_manifest, Manifest
-
-    # Handle package exclusions
-    excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split()
-    inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split()
-    inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split()
-
-    d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
-    d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
-
-    for pkg in excl_pkgs:
-        if pkg in inst_pkgs:
-            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))
-            inst_pkgs.remove(pkg)
-
-        if pkg in inst_attempt_pkgs:
-            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))
-            inst_attempt_pkgs.remove(pkg)
-
-    d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
-    d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
-
-    pn = d.getVar('PN')
-    runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d)
-    runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d)
-
-    ld = bb.data.createCopy(d)
-    ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata")
-    runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld)
-    runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld)
-    d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK"))
-    d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY"))
-    
-    # create target/host SDK manifests
-    create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
-                    manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST)
-    create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
-                    manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET)
-
-    populate_sdk(d)
-
-fakeroot python do_populate_sdk() {
-    populate_sdk_common(d)
-}
-SSTATETASKS += "do_populate_sdk"
-SSTATE_SKIP_CREATION:task-populate-sdk = '1'
-do_populate_sdk[cleandirs] = "${SDKDEPLOYDIR}"
-do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}"
-do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}"
-do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}"
-python do_populate_sdk_setscene () {
-    sstate_setscene(d)
-}
-addtask do_populate_sdk_setscene
-
-PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR},${WORKDIR}/oe-sdk-repo,${WORKDIR}/sstate-build-populate_sdk"
-
-fakeroot create_sdk_files() {
-	cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
-
-	# Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern.
-	# Escape special characters like '+' and '.' in the SDKPATH
-	escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g")
-	sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py
-
-       mkdir -p ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/
-       echo '${SDKPATHNATIVE}${libdir_nativesdk}
-${SDKPATHNATIVE}${base_libdir_nativesdk}
-include /etc/ld.so.conf' > ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ld.so.conf
-}
-
-python check_sdk_sysroots() {
-    # Fails build if there are broken or dangling symlinks in SDK sysroots
-
-    if d.getVar('CHECK_SDK_SYSROOTS') != '1':
-        # disabled, bail out
-        return
-
-    def norm_path(path):
-        return os.path.abspath(path)
-
-    # Get scan root
-    SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'),
-                                               d.getVar('SDKPATH')))
-
-    bb.note('Checking SDK sysroots at ' + SCAN_ROOT)
-
-    def check_symlink(linkPath):
-        if not os.path.islink(linkPath):
-            return
-
-        linkDirPath = os.path.dirname(linkPath)
-
-        targetPath = os.readlink(linkPath)
-        if not os.path.isabs(targetPath):
-            targetPath = os.path.join(linkDirPath, targetPath)
-        targetPath = norm_path(targetPath)
-
-        if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ):
-            bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath))
-            return
-
-        if not os.path.exists(targetPath):
-            bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath))
-            return
-
-        if os.path.isdir(targetPath):
-            dir_walk(targetPath)
-
-    def walk_error_handler(e):
-        bb.error(str(e))
-
-    def dir_walk(rootDir):
-        for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler):
-            entries = subDirEntries + fileEntries
-            for e in entries:
-                ePath = os.path.join(dirPath, e)
-                check_symlink(ePath)
-
-    # start
-    dir_walk(SCAN_ROOT)
-}
-
-SDKTAROPTS = "--owner=root --group=root"
-
-fakeroot archive_sdk() {
-	# Package it up
-	mkdir -p ${SDKDEPLOYDIR}
-	${SDK_ARCHIVE_CMD}
-}
-
-TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh"
-TOOLCHAIN_SHAR_REL_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-relocate.sh"
-
-fakeroot create_shar() {
-	# copy in the template shar extractor script
-	cp ${TOOLCHAIN_SHAR_EXT_TMPL} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
-	rm -f ${T}/pre_install_command ${T}/post_install_command
-
-	if [ "${SDK_RELOCATE_AFTER_INSTALL}" = "1" ] ; then
-		cp ${TOOLCHAIN_SHAR_REL_TMPL} ${T}/post_install_command
-	fi
-	cat << "EOF" >> ${T}/pre_install_command
-${SDK_PRE_INSTALL_COMMAND}
-EOF
-
-	cat << "EOF" >> ${T}/post_install_command
-${SDK_POST_INSTALL_COMMAND}
-EOF
-	sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \
-		-e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \
-		${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
-	# substitute variables
-	sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \
-		-e 's#@SDKPATH@#${SDKPATH}#g' \
-		-e 's#@SDKPATHINSTALL@#${SDKPATHINSTALL}#g' \
-		-e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \
-		-e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \
-		-e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \
-		-e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\\&')}#g' \
-		-e 's#@SDK_VERSION@#${SDK_VERSION}#g' \
-		-e '/@SDK_PRE_INSTALL_COMMAND@/d' \
-		-e '/@SDK_POST_INSTALL_COMMAND@/d' \
-		-e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \
-		-e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \
-		${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
-	# add execution permission
-	chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
-	# append the SDK tarball
-	cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
-	# delete the old tarball, we don't need it anymore
-	rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}
-}
-
-populate_sdk_log_check() {
-	for target in $*
-	do
-		lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}"
-
-		echo "log_check: Using $lf_path as logfile"
-
-		if [ -e "$lf_path" ]; then
-			${IMAGE_PKGTYPE}_log_check $target $lf_path
-		else
-			echo "Cannot find logfile [$lf_path]"
-		fi
-		echo "Logfile is clean"
-	done
-}
-
-def sdk_command_variables(d):
-    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']
-
-def sdk_variables(d):
-    variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT',
-                 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS',
-                 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'IMAGE_INSTALL_DEBUGFS']
-    variables.extend(sdk_command_variables(d))
-    return " ".join(variables)
-
-do_populate_sdk[vardeps] += "${@sdk_variables(d)}"
-
-python () {
-    variables = sdk_command_variables(d)
-    for var in variables:
-        if d.getVar(var, False):
-            d.setVarFlag(var, 'func', '1')
-}
-
-do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \
-                                    ${TOOLCHAIN_SHAR_EXT_TMPL}:True"
-
-do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}"
-do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])}  ${@d.getVarFlag('do_rootfs', 'depends', False)}"
-do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}"
-do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb"
-do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
-addtask populate_sdk
diff --git a/poky/meta/classes/populate_sdk_ext.bbclass b/poky/meta/classes/populate_sdk_ext.bbclass
deleted file mode 100644
index d58b2ba..0000000
--- a/poky/meta/classes/populate_sdk_ext.bbclass
+++ /dev/null
@@ -1,836 +0,0 @@
-# Extensible SDK
-
-inherit populate_sdk_base
-
-# Used to override TOOLCHAIN_HOST_TASK in the eSDK case
-TOOLCHAIN_HOST_TASK_ESDK = " \
-    meta-environment-extsdk-${MACHINE} \
-    "
-
-SDK_RELOCATE_AFTER_INSTALL:task-populate-sdk-ext = "0"
-
-SDK_EXT = ""
-SDK_EXT:task-populate-sdk-ext = "-ext"
-
-# Options are full or minimal
-SDK_EXT_TYPE ?= "full"
-SDK_INCLUDE_PKGDATA ?= "0"
-SDK_INCLUDE_TOOLCHAIN ?= "${@'1' if d.getVar('SDK_EXT_TYPE') == 'full' else '0'}"
-SDK_INCLUDE_NATIVESDK ?= "0"
-SDK_INCLUDE_BUILDTOOLS ?= '1'
-
-SDK_RECRDEP_TASKS ?= ""
-SDK_CUSTOM_TEMPLATECONF ?= "0"
-
-ESDK_LOCALCONF_ALLOW ?= ""
-ESDK_LOCALCONF_REMOVE ?= "CONF_VERSION \
-                             BB_NUMBER_THREADS \
-                             BB_NUMBER_PARSE_THREADS \
-                             PARALLEL_MAKE \
-                             PRSERV_HOST \
-                             SSTATE_MIRRORS \
-                             DL_DIR \
-                             SSTATE_DIR \
-                             TMPDIR \
-                             BB_SERVER_TIMEOUT \
-                            "
-ESDK_CLASS_INHERIT_DISABLE ?= "buildhistory icecc"
-SDK_UPDATE_URL ?= ""
-
-SDK_TARGETS ?= "${PN}"
-
-def get_sdk_install_targets(d, images_only=False):
-    sdk_install_targets = ''
-    if images_only or d.getVar('SDK_EXT_TYPE') != 'minimal':
-        sdk_install_targets = d.getVar('SDK_TARGETS')
-
-        depd = d.getVar('BB_TASKDEPDATA', False)
-        tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d)
-        tasklist.remove('do_build')
-        for v in depd.values():
-            if v[1] in tasklist:
-                if v[0] not in sdk_install_targets:
-                    sdk_install_targets += ' {}'.format(v[0])
-
-    if not images_only:
-        if d.getVar('SDK_INCLUDE_PKGDATA') == '1':
-            sdk_install_targets += ' meta-world-pkgdata:do_allpackagedata'
-        if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1':
-            sdk_install_targets += ' meta-extsdk-toolchain:do_populate_sysroot'
-
-    return sdk_install_targets
-
-get_sdk_install_targets[vardepsexclude] = "BB_TASKDEPDATA"
-
-OE_INIT_ENV_SCRIPT ?= "oe-init-build-env"
-
-# The files from COREBASE that you want preserved in the COREBASE copied
-# into the sdk. This allows someone to have their own setup scripts in
-# COREBASE be preserved as well as untracked files.
-COREBASE_FILES ?= " \
-    oe-init-build-env \
-    scripts \
-    LICENSE \
-    .templateconf \
-"
-
-SDK_DIR:task-populate-sdk-ext = "${WORKDIR}/sdk-ext"
-B:task-populate-sdk-ext = "${SDK_DIR}"
-TOOLCHAINEXT_OUTPUTNAME ?= "${SDK_NAME}-toolchain-ext-${SDK_VERSION}"
-TOOLCHAIN_OUTPUTNAME:task-populate-sdk-ext = "${TOOLCHAINEXT_OUTPUTNAME}"
-
-SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"
-SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
-
-python write_target_sdk_ext_manifest () {
-    from oe.sdk import get_extra_sdkinfo
-    sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache')
-    extra_info = get_extra_sdkinfo(sstate_dir)
-
-    target = d.getVar('TARGET_SYS')
-    target_multimach = d.getVar('MULTIMACH_TARGET_SYS')
-    real_target_multimach = d.getVar('REAL_MULTIMACH_TARGET_SYS')
-
-    pkgs = {}
-    os.makedirs(os.path.dirname(d.getVar('SDK_EXT_TARGET_MANIFEST')), exist_ok=True)
-    with open(d.getVar('SDK_EXT_TARGET_MANIFEST'), 'w') as f:
-        for fn in extra_info['filesizes']:
-            info = fn.split(':')
-            if info[2] in (target, target_multimach, real_target_multimach) \
-                    or info[5] == 'allarch':
-                if not info[1] in pkgs:
-                    f.write("%s %s %s\n" % (info[1], info[2], info[3]))
-                    pkgs[info[1]] = {}
-}
-python write_host_sdk_ext_manifest () {
-    from oe.sdk import get_extra_sdkinfo
-    sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache')
-    extra_info = get_extra_sdkinfo(sstate_dir)
-    host = d.getVar('BUILD_SYS')
-    with open(d.getVar('SDK_EXT_HOST_MANIFEST'), 'w') as f:
-        for fn in extra_info['filesizes']:
-            info = fn.split(':')
-            if info[2] == host:
-                f.write("%s %s %s\n" % (info[1], info[2], info[3]))
-}
-
-SDK_POSTPROCESS_COMMAND:append:task-populate-sdk-ext = "write_target_sdk_ext_manifest; write_host_sdk_ext_manifest; "    
-
-SDK_TITLE:task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} Extensible SDK"
-
-def clean_esdk_builddir(d, sdkbasepath):
-    """Clean up traces of the fake build for create_filtered_tasklist()"""
-    import shutil
-    cleanpaths = ['cache', 'tmp']
-    for pth in cleanpaths:
-        fullpth = os.path.join(sdkbasepath, pth)
-        if os.path.isdir(fullpth):
-            shutil.rmtree(fullpth)
-        elif os.path.isfile(fullpth):
-            os.remove(fullpth)
-
-def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
-    """
-    Create a filtered list of tasks. Also double-checks that the build system
-    within the SDK basically works and required sstate artifacts are available.
-    """
-    import tempfile
-    import shutil
-    import oe.copy_buildsystem
-
-    # Create a temporary build directory that we can pass to the env setup script
-    shutil.copyfile(sdkbasepath + '/conf/local.conf', sdkbasepath + '/conf/local.conf.bak')
-    try:
-        with open(sdkbasepath + '/conf/local.conf', 'a') as f:
-            # Force the use of sstate from the build system
-            f.write('\nSSTATE_DIR:forcevariable = "%s"\n' % d.getVar('SSTATE_DIR'))
-            f.write('SSTATE_MIRRORS:forcevariable = "file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n')
-            # Ensure TMPDIR is the default so that clean_esdk_builddir() can delete it
-            f.write('TMPDIR:forcevariable = "${TOPDIR}/tmp"\n')
-            f.write('TCLIBCAPPEND:forcevariable = ""\n')
-            # Drop uninative if the build isn't using it (or else NATIVELSBSTRING will
-            # be different and we won't be able to find our native sstate)
-            if not bb.data.inherits_class('uninative', d):
-                f.write('INHERIT:remove = "uninative"\n')
-
-        # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake
-        # will not allow in its COREBASE path, so we need to rename the directory temporarily
-        temp_sdkbasepath = d.getVar('SDK_OUTPUT') + '/tmp-renamed-sdk'
-        # Delete any existing temp dir
-        try:
-            shutil.rmtree(temp_sdkbasepath)
-        except FileNotFoundError:
-            pass
-        bb.utils.rename(sdkbasepath, temp_sdkbasepath)
-        cmdprefix = '. %s .; ' % conf_initpath
-        logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt'
-        try:
-            oe.copy_buildsystem.check_sstate_task_list(d, get_sdk_install_targets(d), tasklistfile, cmdprefix=cmdprefix, cwd=temp_sdkbasepath, logfile=logfile)
-        except bb.process.ExecutionError as e:
-            msg = 'Failed to generate filtered task list for extensible SDK:\n%s' %  e.stdout.rstrip()
-            if 'attempted to execute unexpectedly and should have been setscened' in e.stdout:
-                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'
-            bb.fatal(msg)
-        bb.utils.rename(temp_sdkbasepath, sdkbasepath)
-        # Clean out residue of running bitbake, which check_sstate_task_list()
-        # will effectively do
-        clean_esdk_builddir(d, sdkbasepath)
-    finally:
-        localconf = sdkbasepath + '/conf/local.conf'
-        if os.path.exists(localconf + '.bak'):
-            os.replace(localconf + '.bak', localconf)
-
-python copy_buildsystem () {
-    import re
-    import shutil
-    import glob
-    import oe.copy_buildsystem
-
-    oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT')
-
-    conf_bbpath = ''
-    conf_initpath = ''
-    core_meta_subdir = ''
-
-    # Copy in all metadata layers + bitbake (as repositories)
-    buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
-    baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
-
-    #check if custome templateconf path is set
-    use_custom_templateconf = d.getVar('SDK_CUSTOM_TEMPLATECONF')
-
-    # Determine if we're building a derivative extensible SDK (from devtool build-sdk)
-    derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
-    if derivative:
-        workspace_name = 'orig-workspace'
-    else:
-        workspace_name = None
-
-    corebase, sdkbblayers = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers', workspace_name)
-    conf_bbpath = os.path.join('layers', corebase, 'bitbake')
-
-    for path in os.listdir(baseoutpath + '/layers'):
-        relpath = os.path.join('layers', path, oe_init_env_script)
-        if os.path.exists(os.path.join(baseoutpath, relpath)):
-            conf_initpath = relpath
-
-        relpath = os.path.join('layers', path, 'scripts', 'devtool')
-        if os.path.exists(os.path.join(baseoutpath, relpath)):
-            scriptrelpath = os.path.dirname(relpath)
-
-        relpath = os.path.join('layers', path, 'meta')
-        if os.path.exists(os.path.join(baseoutpath, relpath, 'lib', 'oe')):
-            core_meta_subdir = relpath
-
-    d.setVar('oe_init_build_env_path', conf_initpath)
-    d.setVar('scriptrelpath', scriptrelpath)
-
-    # Write out config file for devtool
-    import configparser
-    config = configparser.SafeConfigParser()
-    config.add_section('General')
-    config.set('General', 'bitbake_subdir', conf_bbpath)
-    config.set('General', 'init_path', conf_initpath)
-    config.set('General', 'core_meta_subdir', core_meta_subdir)
-    config.add_section('SDK')
-    config.set('SDK', 'sdk_targets', d.getVar('SDK_TARGETS'))
-    updateurl = d.getVar('SDK_UPDATE_URL')
-    if updateurl:
-        config.set('SDK', 'updateserver', updateurl)
-    bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf'))
-    with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f:
-        config.write(f)
-
-    unlockedsigs =  os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc')
-    with open(unlockedsigs, 'w') as f:
-        pass
-
-    # Create a layer for new recipes / appends
-    bbpath = d.getVar('BBPATH')
-    env = os.environ.copy()
-    env['PYTHONDONTWRITEBYTECODE'] = '1'
-    bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--create-only', os.path.join(baseoutpath, 'workspace')], env=env)
-
-    # Create bblayers.conf
-    bb.utils.mkdirhier(baseoutpath + '/conf')
-    with open(baseoutpath + '/conf/bblayers.conf', 'w') as f:
-        f.write('# WARNING: this configuration has been automatically generated and in\n')
-        f.write('# most cases should not be edited. If you need more flexibility than\n')
-        f.write('# this configuration provides, it is strongly suggested that you set\n')
-        f.write('# up a proper instance of the full build system and use that instead.\n\n')
-
-        # LCONF_VERSION may not be set, for example when using meta-poky
-        # so don't error if it isn't found
-        lconf_version = d.getVar('LCONF_VERSION', False)
-        if lconf_version is not None:
-            f.write('LCONF_VERSION = "%s"\n\n' % lconf_version)
-
-        f.write('BBPATH = "$' + '{TOPDIR}"\n')
-        f.write('SDKBASEMETAPATH = "$' + '{TOPDIR}"\n')
-        f.write('BBLAYERS := " \\\n')
-        for layerrelpath in sdkbblayers:
-            f.write('    $' + '{SDKBASEMETAPATH}/layers/%s \\\n' % layerrelpath)
-        f.write('    $' + '{SDKBASEMETAPATH}/workspace \\\n')
-        f.write('    "\n')
-
-    # Copy uninative tarball
-    # For now this is where uninative.bbclass expects the tarball
-    if bb.data.inherits_class('uninative', d):
-        uninative_file = d.expand('${UNINATIVE_DLDIR}/' + d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH")) + '/${UNINATIVE_TARBALL}')
-        uninative_checksum = bb.utils.sha256_file(uninative_file)
-        uninative_outdir = '%s/downloads/uninative/%s' % (baseoutpath, uninative_checksum)
-        bb.utils.mkdirhier(uninative_outdir)
-        shutil.copy(uninative_file, uninative_outdir)
-
-    env_passthrough = (d.getVar('BB_ENV_PASSTHROUGH_ADDITIONS') or '').split()
-    env_passthrough_values = {}
-
-    # Create local.conf
-    builddir = d.getVar('TOPDIR')
-    if derivative and os.path.exists(builddir + '/conf/site.conf'):
-        shutil.copyfile(builddir + '/conf/site.conf', baseoutpath + '/conf/site.conf')
-    if derivative and os.path.exists(builddir + '/conf/auto.conf'):
-        shutil.copyfile(builddir + '/conf/auto.conf', baseoutpath + '/conf/auto.conf')
-    if derivative:
-        shutil.copyfile(builddir + '/conf/local.conf', baseoutpath + '/conf/local.conf')
-    else:
-        local_conf_allowed = (d.getVar('ESDK_LOCALCONF_ALLOW') or '').split()
-        local_conf_remove = (d.getVar('ESDK_LOCALCONF_REMOVE') or '').split()
-        def handle_var(varname, origvalue, op, newlines):
-            if varname in local_conf_remove or (origvalue.strip().startswith('/') and not varname in local_conf_allowed):
-                newlines.append('# Removed original setting of %s\n' % varname)
-                return None, op, 0, True
-            else:
-                if varname in env_passthrough:
-                    env_passthrough_values[varname] = origvalue
-                return origvalue, op, 0, True
-        varlist = ['[^#=+ ]*']
-        oldlines = []
-        if os.path.exists(builddir + '/conf/site.conf'):
-            with open(builddir + '/conf/site.conf', 'r') as f:
-                oldlines += f.readlines()
-        if os.path.exists(builddir + '/conf/auto.conf'):
-            with open(builddir + '/conf/auto.conf', 'r') as f:
-                oldlines += f.readlines()
-        if os.path.exists(builddir + '/conf/local.conf'):
-            with open(builddir + '/conf/local.conf', 'r') as f:
-                oldlines += f.readlines()
-        (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var)
-
-        with open(baseoutpath + '/conf/local.conf', 'w') as f:
-            f.write('# WARNING: this configuration has been automatically generated and in\n')
-            f.write('# most cases should not be edited. If you need more flexibility than\n')
-            f.write('# this configuration provides, it is strongly suggested that you set\n')
-            f.write('# up a proper instance of the full build system and use that instead.\n\n')
-            for line in newlines:
-                if line.strip() and not line.startswith('#'):
-                    f.write(line)
-            # Write a newline just in case there's none at the end of the original
-            f.write('\n')
-
-            f.write('TMPDIR = "${TOPDIR}/tmp"\n')
-            f.write('TCLIBCAPPEND = ""\n')
-            f.write('DL_DIR = "${TOPDIR}/downloads"\n')
-
-            if bb.data.inherits_class('uninative', d):
-               f.write('INHERIT += "%s"\n' % 'uninative')
-               f.write('UNINATIVE_CHECKSUM[%s] = "%s"\n\n' % (d.getVar('BUILD_ARCH'), uninative_checksum))
-            f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False))
-
-            # Some classes are not suitable for SDK, remove them from INHERIT
-            f.write('INHERIT:remove = "%s"\n' % d.getVar('ESDK_CLASS_INHERIT_DISABLE', False))
-
-            # Bypass the default connectivity check if any
-            f.write('CONNECTIVITY_CHECK_URIS = ""\n\n')
-
-            # This warning will come out if reverse dependencies for a task
-            # don't have sstate as well as the task itself. We already know
-            # this will be the case for the extensible sdk, so turn off the
-            # warning.
-            f.write('SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK = "none"\n\n')
-
-            # Warn if the sigs in the locked-signature file don't match
-            # the sig computed from the metadata.
-            f.write('SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n\n')
-
-            # We want to be able to set this without a full reparse
-            f.write('BB_HASHCONFIG_IGNORE_VARS:append = " SIGGEN_UNLOCKED_RECIPES"\n\n')
-
-            # Set up which tasks are ignored for run on install
-            f.write('BB_SETSCENE_ENFORCE_IGNORE_TASKS = "%:* *:do_shared_workdir *:do_rm_work wic-tools:* *:do_addto_recipe_sysroot"\n\n')
-
-            # Hide the config information from bitbake output (since it's fixed within the SDK)
-            f.write('BUILDCFG_HEADER = ""\n\n')
-
-            # Write METADATA_REVISION
-            f.write('METADATA_REVISION = "%s"\n\n' % d.getVar('METADATA_REVISION'))
-
-            f.write('# Provide a flag to indicate we are in the EXT_SDK Context\n')
-            f.write('WITHIN_EXT_SDK = "1"\n\n')
-
-            # Map gcc-dependent uninative sstate cache for installer usage
-            f.write('SSTATE_MIRRORS += " file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n\n')
-
-            if d.getVar("PRSERV_HOST"):
-                # Override this, we now include PR data, so it should only point ot the local database
-                f.write('PRSERV_HOST = "localhost:0"\n\n')
-
-            # Allow additional config through sdk-extra.conf
-            fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d)
-            if fn:
-                with open(fn, 'r') as xf:
-                    for line in xf:
-                        f.write(line)
-
-            # If you define a sdk_extraconf() function then it can contain additional config
-            # (Though this is awkward; sdk-extra.conf should probably be used instead)
-            extraconf = (d.getVar('sdk_extraconf') or '').strip()
-            if extraconf:
-                # Strip off any leading / trailing spaces
-                for line in extraconf.splitlines():
-                    f.write(line.strip() + '\n')
-
-            f.write('require conf/locked-sigs.inc\n')
-            f.write('require conf/unlocked-sigs.inc\n')
-
-    # Copy multiple configurations if they exist in the users config directory
-    if d.getVar('BBMULTICONFIG') is not None:
-        bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf', 'multiconfig'))
-        for mc in d.getVar('BBMULTICONFIG').split():
-            dest_stub = "/conf/multiconfig/%s.conf" % (mc,)
-            if os.path.exists(builddir + dest_stub):
-                shutil.copyfile(builddir + dest_stub, baseoutpath + dest_stub)
-
-    cachedir = os.path.join(baseoutpath, 'cache')
-    bb.utils.mkdirhier(cachedir)
-    bb.parse.siggen.copy_unitaskhashes(cachedir)
-
-    # If PR Service is in use, we need to export this as well
-    bb.note('Do we have a pr database?')
-    if d.getVar("PRSERV_HOST"):
-        bb.note('Writing PR database...')
-        # Based on the code in classes/prexport.bbclass
-        import oe.prservice
-        #dump meta info of tables
-        localdata = d.createCopy()
-        localdata.setVar('PRSERV_DUMPOPT_COL', "1")
-        localdata.setVar('PRSERV_DUMPDIR', os.path.join(baseoutpath, 'conf'))
-        localdata.setVar('PRSERV_DUMPFILE', '${PRSERV_DUMPDIR}/prserv.inc')
-
-        bb.note('PR Database write to %s' % (localdata.getVar('PRSERV_DUMPFILE')))
-
-        retval = oe.prservice.prserv_dump_db(localdata)
-        if not retval:
-            bb.error("prexport_handler: export failed!")
-            return
-        (metainfo, datainfo) = retval
-        oe.prservice.prserv_export_tofile(localdata, metainfo, datainfo, True)
-
-    # Use templateconf.cfg file from builddir if exists
-    if os.path.exists(builddir + '/conf/templateconf.cfg') and use_custom_templateconf == '1':
-        shutil.copyfile(builddir + '/conf/templateconf.cfg', baseoutpath + '/conf/templateconf.cfg')
-    else:
-        # Write a templateconf.cfg
-        with open(baseoutpath + '/conf/templateconf.cfg', 'w') as f:
-            f.write('meta/conf\n')
-
-    # Ensure any variables set from the external environment (by way of
-    # BB_ENV_PASSTHROUGH_ADDITIONS) are set in the SDK's configuration
-    extralines = []
-    for name, value in env_passthrough_values.items():
-        actualvalue = d.getVar(name) or ''
-        if value != actualvalue:
-            extralines.append('%s = "%s"\n' % (name, actualvalue))
-    if extralines:
-        with open(baseoutpath + '/conf/local.conf', 'a') as f:
-            f.write('\n')
-            f.write('# Extra settings from environment:\n')
-            for line in extralines:
-                f.write(line)
-            f.write('\n')
-
-    # Filter the locked signatures file to just the sstate tasks we are interested in
-    excluded_targets = get_sdk_install_targets(d, images_only=True)
-    sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
-    lockedsigs_pruned = baseoutpath + '/conf/locked-sigs.inc'
-    #nativesdk-only sigfile to merge into locked-sigs.inc
-    sdk_include_nativesdk = (d.getVar("SDK_INCLUDE_NATIVESDK") == '1')
-    nativesigfile = d.getVar('WORKDIR') + '/locked-sigs_nativesdk.inc'
-    nativesigfile_pruned = d.getVar('WORKDIR') + '/locked-sigs_nativesdk_pruned.inc'
-
-    if sdk_include_nativesdk:
-        oe.copy_buildsystem.prune_lockedsigs([],
-                                             excluded_targets.split(),
-                                             nativesigfile,
-                                             True,
-                                             nativesigfile_pruned)
-
-        oe.copy_buildsystem.merge_lockedsigs([],
-                                             sigfile,
-                                             nativesigfile_pruned,
-                                             sigfile)
-
-    oe.copy_buildsystem.prune_lockedsigs([],
-                                         excluded_targets.split(),
-                                         sigfile,
-                                         False,
-                                         lockedsigs_pruned)
-
-    sstate_out = baseoutpath + '/sstate-cache'
-    bb.utils.remove(sstate_out, True)
-
-    # uninative.bbclass sets NATIVELSBSTRING to 'universal%s' % oe.utils.host_gcc_version(d)
-    fixedlsbstring = "universal%s" % oe.utils.host_gcc_version(d)
-
-    sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1')
-    sdk_ext_type = d.getVar('SDK_EXT_TYPE')
-    if (sdk_ext_type != 'minimal' or sdk_include_toolchain or derivative) and not sdk_include_nativesdk:
-        # Create the filtered task list used to generate the sstate cache shipped with the SDK
-        tasklistfn = d.getVar('WORKDIR') + '/tasklist.txt'
-        create_filtered_tasklist(d, baseoutpath, tasklistfn, conf_initpath)
-    else:
-        tasklistfn = None
-
-
-    cachedir = os.path.join(baseoutpath, 'cache')
-    bb.utils.mkdirhier(cachedir)
-    bb.parse.siggen.copy_unitaskhashes(cachedir)
-
-    # Add packagedata if enabled
-    if d.getVar('SDK_INCLUDE_PKGDATA') == '1':
-        lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base.inc'
-        lockedsigs_copy = d.getVar('WORKDIR') + '/locked-sigs-copy.inc'
-        shutil.move(lockedsigs_pruned, lockedsigs_base)
-        oe.copy_buildsystem.merge_lockedsigs(['do_packagedata'],
-                                             lockedsigs_base,
-                                             d.getVar('STAGING_DIR_HOST') + '/world-pkgdata/locked-sigs-pkgdata.inc',
-                                             lockedsigs_pruned,
-                                             lockedsigs_copy)
-
-    if sdk_include_toolchain:
-        lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base2.inc'
-        lockedsigs_toolchain = d.expand("${STAGING_DIR}/${TUNE_PKGARCH}/meta-extsdk-toolchain/locked-sigs/locked-sigs-extsdk-toolchain.inc")
-        shutil.move(lockedsigs_pruned, lockedsigs_base)
-        oe.copy_buildsystem.merge_lockedsigs([],
-                                             lockedsigs_base,
-                                             lockedsigs_toolchain,
-                                             lockedsigs_pruned)
-        oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_toolchain,
-                                                       d.getVar('SSTATE_DIR'),
-                                                       sstate_out, d,
-                                                       fixedlsbstring,
-                                                       filterfile=tasklistfn)
-
-    if sdk_ext_type == 'minimal':
-        if derivative:
-            # Assume the user is not going to set up an additional sstate
-            # mirror, thus we need to copy the additional artifacts (from
-            # workspace recipes) into the derivative SDK
-            lockedsigs_orig = d.getVar('TOPDIR') + '/conf/locked-sigs.inc'
-            if os.path.exists(lockedsigs_orig):
-                lockedsigs_extra = d.getVar('WORKDIR') + '/locked-sigs-extra.inc'
-                oe.copy_buildsystem.merge_lockedsigs(None,
-                                                     lockedsigs_orig,
-                                                     lockedsigs_pruned,
-                                                     None,
-                                                     lockedsigs_extra)
-                oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra,
-                                                               d.getVar('SSTATE_DIR'),
-                                                               sstate_out, d,
-                                                               fixedlsbstring,
-                                                               filterfile=tasklistfn)
-    else:
-        oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned,
-                                                       d.getVar('SSTATE_DIR'),
-                                                       sstate_out, d,
-                                                       fixedlsbstring,
-                                                       filterfile=tasklistfn)
-
-    # We don't need sstate do_package files
-    for root, dirs, files in os.walk(sstate_out):
-        for name in files:
-            if name.endswith("_package.tar.zst"):
-                f = os.path.join(root, name)
-                os.remove(f)
-
-    # Write manifest file
-    # Note: at the moment we cannot include the env setup script here to keep
-    # it updated, since it gets modified during SDK installation (see
-    # sdk_ext_postinst() below) thus the checksum we take here would always
-    # be different.
-    manifest_file_list = ['conf/*']
-    if d.getVar('BBMULTICONFIG') is not None:
-        manifest_file_list.append('conf/multiconfig/*')
-
-    esdk_manifest_excludes = (d.getVar('ESDK_MANIFEST_EXCLUDES') or '').split()
-    esdk_manifest_excludes_list = []
-    for exclude_item in esdk_manifest_excludes:
-        esdk_manifest_excludes_list += glob.glob(os.path.join(baseoutpath, exclude_item))
-    manifest_file = os.path.join(baseoutpath, 'conf', 'sdk-conf-manifest')
-    with open(manifest_file, 'w') as f:
-        for item in manifest_file_list:
-            for fn in glob.glob(os.path.join(baseoutpath, item)):
-                if fn == manifest_file or os.path.isdir(fn):
-                    continue
-                if fn in esdk_manifest_excludes_list:
-                    continue
-                chksum = bb.utils.sha256_file(fn)
-                f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath)))
-}
-
-def get_current_buildtools(d):
-    """Get the file name of the current buildtools installer"""
-    import glob
-    btfiles = glob.glob(os.path.join(d.getVar('SDK_DEPLOY'), '*-buildtools-nativesdk-standalone-*.sh'))
-    btfiles.sort(key=os.path.getctime)
-    return os.path.basename(btfiles[-1])
-
-def get_sdk_required_utilities(buildtools_fn, d):
-    """Find required utilities that aren't provided by the buildtools"""
-    sanity_required_utilities = (d.getVar('SANITY_REQUIRED_UTILITIES') or '').split()
-    sanity_required_utilities.append(d.expand('${BUILD_PREFIX}gcc'))
-    sanity_required_utilities.append(d.expand('${BUILD_PREFIX}g++'))
-    if buildtools_fn:
-        buildtools_installer = os.path.join(d.getVar('SDK_DEPLOY'), buildtools_fn)
-        filelist, _ = bb.process.run('%s -l' % buildtools_installer)
-    else:
-        buildtools_installer = None
-        filelist = ""
-    localdata = bb.data.createCopy(d)
-    localdata.setVar('SDKPATH', '.')
-    sdkpathnative = localdata.getVar('SDKPATHNATIVE')
-    sdkbindirs = [localdata.getVar('bindir_nativesdk'),
-                  localdata.getVar('sbindir_nativesdk'),
-                  localdata.getVar('base_bindir_nativesdk'),
-                  localdata.getVar('base_sbindir_nativesdk')]
-    for line in filelist.splitlines():
-        splitline = line.split()
-        if len(splitline) > 5:
-            fn = splitline[5]
-            if not fn.startswith('./'):
-                fn = './%s' % fn
-            if fn.startswith(sdkpathnative):
-                relpth = '/' + os.path.relpath(fn, sdkpathnative)
-                for bindir in sdkbindirs:
-                    if relpth.startswith(bindir):
-                        relpth = os.path.relpath(relpth, bindir)
-                        if relpth in sanity_required_utilities:
-                            sanity_required_utilities.remove(relpth)
-                        break
-    return ' '.join(sanity_required_utilities)
-
-install_tools() {
-	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}
-	scripts="devtool recipetool oe-find-native-sysroot runqemu* wic"
-	for script in $scripts; do
-		for scriptfn in `find ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath} -maxdepth 1 -executable -name "$script"`; do
-			targetscriptfn="${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/$(basename $scriptfn)"
-			test -e ${targetscriptfn} || ln -rs ${scriptfn} ${targetscriptfn}
-		done
-	done
-	# We can't use the same method as above because files in the sysroot won't exist at this point
-	# (they get populated from sstate on installation)
-	unfsd_path="${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/unfsd"
-	if [ "${SDK_INCLUDE_TOOLCHAIN}" = "1" -a ! -e $unfsd_path ] ; then
-		binrelpath=${@os.path.relpath(d.getVar('STAGING_BINDIR_NATIVE'), d.getVar('TMPDIR'))}
-		ln -rs ${SDK_OUTPUT}/${SDKPATH}/tmp/$binrelpath/unfsd $unfsd_path
-	fi
-	touch ${SDK_OUTPUT}/${SDKPATH}/.devtoolbase
-
-	# find latest buildtools-tarball and install it
-	if [ -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then
-		install ${SDK_DEPLOY}/${SDK_BUILDTOOLS_INSTALLER} ${SDK_OUTPUT}/${SDKPATH}
-	fi
-
-	install -m 0644 ${COREBASE}/meta/files/ext-sdk-prepare.py ${SDK_OUTPUT}/${SDKPATH}
-}
-do_populate_sdk_ext[file-checksums] += "${COREBASE}/meta/files/ext-sdk-prepare.py:True"
-
-sdk_ext_preinst() {
-	# Since bitbake won't run as root it doesn't make sense to try and install
-	# the extensible sdk as root.
-	if [ "`id -u`" = "0" ]; then
-		echo "ERROR: The extensible sdk cannot be installed as root."
-		exit 1
-	fi
-	if ! command -v locale > /dev/null; then
-		echo "ERROR: The installer requires the locale command, please install it first"
-		exit 1
-	fi
-        # Check setting of LC_ALL set above
-	canonicalised_locale=`echo $LC_ALL | sed 's/UTF-8/utf8/'`
-	if ! locale -a | grep -q $canonicalised_locale ; then
-		echo "ERROR: the installer requires the $LC_ALL locale to be installed (but not selected), please install it first"
-		exit 1
-	fi
-	# The relocation script used by buildtools installer requires python
-	if ! command -v python3 > /dev/null; then
-		echo "ERROR: The installer requires python3, please install it first"
-		exit 1
-	fi
-	missing_utils=""
-	for util in ${SDK_REQUIRED_UTILITIES}; do
-		if ! command -v $util > /dev/null; then
-			missing_utils="$missing_utils $util"
-		fi
-	done
-	if [ -n "$missing_utils" ] ; then
-		echo "ERROR: the SDK requires the following missing utilities, please install them: $missing_utils"
-		exit 1
-	fi
-	SDK_EXTENSIBLE="1"
-	if [ "$publish" = "1" ] && [ "${SDK_EXT_TYPE}" = "minimal" ] ; then
-		EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=sstate-cache"
-	fi
-}
-SDK_PRE_INSTALL_COMMAND:task-populate-sdk-ext = "${sdk_ext_preinst}"
-
-# FIXME this preparation should be done as part of the SDK construction
-sdk_ext_postinst() {
-	printf "\nExtracting buildtools...\n"
-	cd $target_sdk_dir
-	env_setup_script="$target_sdk_dir/environment-setup-${REAL_MULTIMACH_TARGET_SYS}"
-        if [ -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then
-		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 ; }
-
-		# Delete the buildtools tar file since it won't be used again
-		rm -f ./${SDK_BUILDTOOLS_INSTALLER}
-		# We don't need the log either since it succeeded
-		rm -f buildtools.log
-
-		# Make sure when the user sets up the environment, they also get
-		# the buildtools-tarball tools in their path.
-		echo "# Save and reset OECORE_NATIVE_SYSROOT as buildtools may change it" >> $env_setup_script
-		echo "SAVED=\"\$OECORE_NATIVE_SYSROOT\"" >> $env_setup_script
-		echo ". $target_sdk_dir/buildtools/environment-setup*" >> $env_setup_script
-		echo "OECORE_NATIVE_SYSROOT=\"\$SAVED\"" >> $env_setup_script
-	fi
-
-	# Allow bitbake environment setup to be ran as part of this sdk.
-	echo "export OE_SKIP_SDK_CHECK=1" >> $env_setup_script
-	# Work around runqemu not knowing how to get this information within the eSDK
-	echo "export DEPLOY_DIR_IMAGE=$target_sdk_dir/tmp/${@os.path.relpath(d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('TMPDIR'))}" >> $env_setup_script
-
-	# A bit of another hack, but we need this in the path only for devtool
-	# so put it at the end of $PATH.
-	echo "export PATH=$target_sdk_dir/sysroots/${SDK_SYS}${bindir_nativesdk}:\$PATH" >> $env_setup_script
-
-	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
-
-	# Warn if trying to use external bitbake and the ext SDK together
-	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
-
-	if [ "$prepare_buildsystem" != "no" -a -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then
-		printf "Preparing build system...\n"
-		# dash which is /bin/sh on Ubuntu will not preserve the
-		# current working directory when first ran, nor will it set $1 when
-		# sourcing a script. That is why this has to look so ugly.
-		LOGFILE="$target_sdk_dir/preparing_build_system.log"
-		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 && python3 $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 ; }
-	fi
-	if [ -e $target_sdk_dir/ext-sdk-prepare.py ]; then
-		rm $target_sdk_dir/ext-sdk-prepare.py
-	fi
-	echo done
-}
-
-SDK_POST_INSTALL_COMMAND:task-populate-sdk-ext = "${sdk_ext_postinst}"
-
-SDK_POSTPROCESS_COMMAND:prepend:task-populate-sdk-ext = "copy_buildsystem; install_tools; "
-
-SDK_INSTALL_TARGETS = ""
-fakeroot python do_populate_sdk_ext() {
-    # FIXME hopefully we can remove this restriction at some point, but uninative
-    # currently forces this upon us
-    if d.getVar('SDK_ARCH') != d.getVar('BUILD_ARCH'):
-        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')))
-
-    # FIXME hopefully we can remove this restriction at some point, but the eSDK
-    # can only be built for the primary (default) multiconfig
-    if d.getVar('BB_CURRENT_MC') != 'default':
-        bb.fatal('The extensible SDK can currently only be built for the default multiconfig.  Currently trying to build for %s.' % d.getVar('BB_CURRENT_MC'))
-
-    # eSDK dependencies don't use the traditional variables and things don't work properly if they are set
-    d.setVar("TOOLCHAIN_HOST_TASK", "${TOOLCHAIN_HOST_TASK_ESDK}")
-    d.setVar("TOOLCHAIN_TARGET_TASK", "")
-
-    d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d))
-    if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1':
-        buildtools_fn = get_current_buildtools(d)
-    else:
-        buildtools_fn = None
-    d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d))
-    d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn)
-    d.setVar('SDKDEPLOYDIR', '${SDKEXTDEPLOYDIR}')
-    # ESDKs have a libc from the buildtools so ensure we don't ship linguas twice
-    d.delVar('SDKIMAGE_LINGUAS')
-    if d.getVar("SDK_INCLUDE_NATIVESDK") == '1':
-        generate_nativesdk_lockedsigs(d)
-    populate_sdk_common(d)
-}
-
-def generate_nativesdk_lockedsigs(d):
-    import oe.copy_buildsystem
-    sigfile = d.getVar('WORKDIR') + '/locked-sigs_nativesdk.inc'
-    oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
-
-def get_ext_sdk_depends(d):
-    # Note: the deps varflag is a list not a string, so we need to specify expand=False
-    deps = d.getVarFlag('do_image_complete', 'deps', False)
-    pn = d.getVar('PN')
-    deplist = ['%s:%s' % (pn, dep) for dep in deps]
-    tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d)
-    tasklist.append('do_rootfs')
-    for task in tasklist:
-        deplist.extend((d.getVarFlag(task, 'depends') or '').split())
-    return ' '.join(deplist)
-
-python do_sdk_depends() {
-    # We have to do this separately in its own task so we avoid recursing into
-    # dependencies we don't need to (e.g. buildtools-tarball) and bringing those
-    # into the SDK's sstate-cache
-    import oe.copy_buildsystem
-    sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
-    oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
-}
-addtask sdk_depends
-
-do_sdk_depends[dirs] = "${WORKDIR}"
-do_sdk_depends[depends] = "${@get_ext_sdk_depends(d)} meta-extsdk-toolchain:do_populate_sysroot"
-do_sdk_depends[recrdeptask] = "${@d.getVarFlag('do_populate_sdk', 'recrdeptask', False)}"
-do_sdk_depends[recrdeptask] += "do_populate_lic do_package_qa do_populate_sysroot do_deploy ${SDK_RECRDEP_TASKS}"
-do_sdk_depends[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('TOOLCHAIN_HOST_TASK_ESDK').split()])}"
-
-do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}"
-
-do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \
-                                ${@'buildtools-tarball:do_populate_sdk' if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1' else ''} \
-                                ${@'meta-world-pkgdata:do_collect_packagedata' if d.getVar('SDK_INCLUDE_PKGDATA') == '1' else ''} \
-                                ${@'meta-extsdk-toolchain:do_locked_sigs' if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1' else ''}"
-
-# We must avoid depending on do_build here if rm_work.bbclass is active,
-# because otherwise do_rm_work may run before do_populate_sdk_ext itself.
-# We can't mark do_populate_sdk_ext and do_sdk_depends as having to
-# run before do_rm_work, because then they would also run as part
-# of normal builds.
-do_populate_sdk_ext[rdepends] += "${@' '.join([x + ':' + (d.getVar('RM_WORK_BUILD_WITHOUT') or 'do_build') for x in d.getVar('SDK_TARGETS').split()])}"
-
-# Make sure code changes can result in rebuild
-do_populate_sdk_ext[vardeps] += "copy_buildsystem \
-                                 sdk_ext_postinst"
-
-# Since any change in the metadata of any layer should cause a rebuild of the
-# sdk(since the layers are put in the sdk) set the task to nostamp so it
-# always runs.
-do_populate_sdk_ext[nostamp] = "1"
-
-SDKEXTDEPLOYDIR = "${WORKDIR}/deploy-${PN}-populate-sdk-ext"
-
-SSTATETASKS += "do_populate_sdk_ext"
-SSTATE_SKIP_CREATION:task-populate-sdk-ext = '1'
-do_populate_sdk_ext[cleandirs] = "${SDKEXTDEPLOYDIR}"
-do_populate_sdk_ext[sstate-inputdirs] = "${SDKEXTDEPLOYDIR}"
-do_populate_sdk_ext[sstate-outputdirs] = "${SDK_DEPLOY}"
-do_populate_sdk_ext[stamp-extra-info] = "${MACHINE_ARCH}"
-
-addtask populate_sdk_ext after do_sdk_depends
diff --git a/poky/meta/classes/prexport.bbclass b/poky/meta/classes/prexport.bbclass
index 6dcf99e..e5098e3 100644
--- a/poky/meta/classes/prexport.bbclass
+++ b/poky/meta/classes/prexport.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 PRSERV_DUMPOPT_VERSION = "${PRAUTOINX}"
 PRSERV_DUMPOPT_PKGARCH  = ""
 PRSERV_DUMPOPT_CHECKSUM = ""
diff --git a/poky/meta/classes/primport.bbclass b/poky/meta/classes/primport.bbclass
index 8ed45f0..0092417 100644
--- a/poky/meta/classes/primport.bbclass
+++ b/poky/meta/classes/primport.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 python primport_handler () {
     import bb.event
     if not e.data:
diff --git a/poky/meta/classes/ptest-gnome.bbclass b/poky/meta/classes/ptest-gnome.bbclass
deleted file mode 100644
index 18bd3db..0000000
--- a/poky/meta/classes/ptest-gnome.bbclass
+++ /dev/null
@@ -1,8 +0,0 @@
-inherit ptest
-
-EXTRA_OECONF:append = " ${@bb.utils.contains('PTEST_ENABLED', '1', '--enable-installed-tests', '--disable-installed-tests', d)}"
-
-FILES:${PN}-ptest += "${libexecdir}/installed-tests/ \
-                      ${datadir}/installed-tests/"
-
-RDEPENDS:${PN}-ptest += "gnome-desktop-testing"
diff --git a/poky/meta/classes/ptest-perl.bbclass b/poky/meta/classes/ptest-perl.bbclass
deleted file mode 100644
index 5dd72c9..0000000
--- a/poky/meta/classes/ptest-perl.bbclass
+++ /dev/null
@@ -1,30 +0,0 @@
-inherit ptest
-
-FILESEXTRAPATHS:prepend := "${COREBASE}/meta/files:"
-
-SRC_URI += "file://ptest-perl/run-ptest"
-
-do_install_ptest_perl() {
-	install -d ${D}${PTEST_PATH}
-	if [ ! -f ${D}${PTEST_PATH}/run-ptest ]; then
-		install -m 0755 ${WORKDIR}/ptest-perl/run-ptest ${D}${PTEST_PATH}
-	fi
-	cp -r ${B}/t ${D}${PTEST_PATH}
-	chown -R root:root ${D}${PTEST_PATH}
-}
-
-FILES:${PN}-ptest:prepend = "${PTEST_PATH}/t/* ${PTEST_PATH}/run-ptest "
-
-RDEPENDS:${PN}-ptest:prepend = "perl "
-
-addtask install_ptest_perl after do_install_ptest_base before do_package
-
-python () {
-    if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
-        d.setVarFlag('do_install_ptest_perl', 'fakeroot', '1')
-
-    # Remove all '*ptest_perl' tasks when ptest is not enabled
-    if not(d.getVar('PTEST_ENABLED') == "1"):
-        for i in ['do_install_ptest_perl']:
-            bb.build.deltask(i, d)
-}
diff --git a/poky/meta/classes/ptest.bbclass b/poky/meta/classes/ptest.bbclass
deleted file mode 100644
index c162f5d..0000000
--- a/poky/meta/classes/ptest.bbclass
+++ /dev/null
@@ -1,136 +0,0 @@
-SUMMARY:${PN}-ptest ?= "${SUMMARY} - Package test files"
-DESCRIPTION:${PN}-ptest ?= "${DESCRIPTION}  \
-This package contains a test directory ${PTEST_PATH} for package test purposes."
-
-PTEST_PATH ?= "${libdir}/${BPN}/ptest"
-PTEST_BUILD_HOST_FILES ?= "Makefile"
-PTEST_BUILD_HOST_PATTERN ?= ""
-PTEST_PARALLEL_MAKE ?= "${PARALLEL_MAKE}"
-PTEST_PARALLEL_MAKEINST ?= "${PARALLEL_MAKEINST}"
-EXTRA_OEMAKE:prepend:task-compile-ptest-base = "${PTEST_PARALLEL_MAKE} "
-EXTRA_OEMAKE:prepend:task-install-ptest-base = "${PTEST_PARALLEL_MAKEINST} "
-
-FILES:${PN}-ptest += "${PTEST_PATH}"
-SECTION:${PN}-ptest = "devel"
-ALLOW_EMPTY:${PN}-ptest = "1"
-PTEST_ENABLED = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}"
-PTEST_ENABLED:class-native = ""
-PTEST_ENABLED:class-nativesdk = ""
-PTEST_ENABLED:class-cross-canadian = ""
-RDEPENDS:${PN}-ptest += "${PN}"
-RDEPENDS:${PN}-ptest:class-native = ""
-RDEPENDS:${PN}-ptest:class-nativesdk = ""
-RRECOMMENDS:${PN}-ptest += "ptest-runner"
-
-PACKAGES =+ "${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}"
-
-require conf/distro/include/ptest-packagelists.inc
-
-do_configure_ptest() {
-    :
-}
-
-do_configure_ptest_base() {
-    do_configure_ptest
-}
-
-do_compile_ptest() {
-    :
-}
-
-do_compile_ptest_base() {
-    do_compile_ptest
-}
-
-do_install_ptest() {
-    :
-}
-
-do_install_ptest_base() {
-    if [ -f ${WORKDIR}/run-ptest ]; then
-        install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
-    fi
-    if grep -q install-ptest: Makefile; then
-        oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
-    fi
-    do_install_ptest
-    chown -R root:root ${D}${PTEST_PATH}
-
-    # Strip build host paths from any installed Makefile
-    for filename in ${PTEST_BUILD_HOST_FILES}; do
-        for installed_ptest_file in $(find ${D}${PTEST_PATH} -type f -name $filename); do
-            bbnote "Stripping host paths from: $installed_ptest_file"
-            sed -e 's#${HOSTTOOLS_DIR}/*##g' \
-                -e 's#${WORKDIR}/*=#.=#g' \
-                -e 's#${WORKDIR}/*##g' \
-                -i $installed_ptest_file
-            if [ -n "${PTEST_BUILD_HOST_PATTERN}" ]; then
-               sed -E '/${PTEST_BUILD_HOST_PATTERN}/d' \
-                   -i $installed_ptest_file
-            fi
-        done
-    done
-}
-
-PTEST_BINDIR_PKGD_PATH = "${PKGD}${PTEST_PATH}/bin"
-
-# This function needs to run after apply_update_alternative_renames because the
-# aforementioned function will update the ALTERNATIVE_LINK_NAME flag. Append is
-# used here to make this function to run as late as possible.
-PACKAGE_PREPROCESS_FUNCS:append = "${@bb.utils.contains('PTEST_BINDIR', '1', \
-                                    bb.utils.contains('PTEST_ENABLED', '1', ' ptest_update_alternatives', '', d), '', d)}"
-
-python ptest_update_alternatives() {
-    """
-    This function will generate the symlinks in the PTEST_BINDIR_PKGD_PATH
-    to match the renamed binaries by update-alternatives.
-    """
-
-    if not bb.data.inherits_class('update-alternatives', d) \
-           or not update_alternatives_enabled(d):
-        return
-
-    bb.note("Generating symlinks for ptest")
-    bin_paths = { d.getVar("bindir"), d.getVar("base_bindir"),
-                   d.getVar("sbindir"), d.getVar("base_sbindir") }
-    ptest_bindir = d.getVar("PTEST_BINDIR_PKGD_PATH")
-    os.mkdir(ptest_bindir)
-    for pkg in (d.getVar('PACKAGES') or "").split():
-        alternatives = update_alternatives_alt_targets(d, pkg)
-        for alt_name, alt_link, alt_target, _ in alternatives:
-            # Some alternatives are for man pages,
-            # check if the alternative is in PATH
-            if os.path.dirname(alt_link) in bin_paths:
-                os.symlink(alt_target, os.path.join(ptest_bindir, alt_name))
-}
-
-do_configure_ptest_base[dirs] = "${B}"
-do_compile_ptest_base[dirs] = "${B}"
-do_install_ptest_base[dirs] = "${B}"
-do_install_ptest_base[cleandirs] = "${D}${PTEST_PATH}"
-
-addtask configure_ptest_base after do_configure before do_compile
-addtask compile_ptest_base   after do_compile   before do_install
-addtask install_ptest_base   after do_install   before do_package do_populate_sysroot
-
-python () {
-    if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
-        d.setVarFlag('do_install_ptest_base', 'fakeroot', '1')
-        d.setVarFlag('do_install_ptest_base', 'umask', '022')
-
-    # Remove all '*ptest_base' tasks when ptest is not enabled
-    if not(d.getVar('PTEST_ENABLED') == "1"):
-        for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
-            bb.build.deltask(i, d)
-}
-
-QARECIPETEST[missing-ptest] = "package_qa_check_missing_ptest"
-def package_qa_check_missing_ptest(pn, d, messages):
-    # This checks that ptest package is actually included
-    # in standard oe-core ptest images - only for oe-core recipes
-    if not 'meta/recipes' in d.getVar('FILE') or not(d.getVar('PTEST_ENABLED') == "1"):
-        return
-
-    enabled_ptests = " ".join([d.getVar('PTESTS_FAST'), d.getVar('PTESTS_SLOW'), d.getVar('PTESTS_PROBLEMS')]).split()
-    if (pn + "-ptest").replace(d.getVar('MLPREFIX'), '') not in enabled_ptests:
-        oe.qa.handle_error("missing-ptest", "supports ptests but is not included in oe-core's ptest-packagelists.inc", d)
diff --git a/poky/meta/classes/pypi.bbclass b/poky/meta/classes/pypi.bbclass
deleted file mode 100644
index 5fa7b8a..0000000
--- a/poky/meta/classes/pypi.bbclass
+++ /dev/null
@@ -1,28 +0,0 @@
-def pypi_package(d):
-    bpn = d.getVar('BPN')
-    if bpn.startswith('python-'):
-        return bpn[7:]
-    elif bpn.startswith('python3-'):
-        return bpn[8:]
-    return bpn
-
-PYPI_PACKAGE ?= "${@pypi_package(d)}"
-PYPI_PACKAGE_EXT ?= "tar.gz"
-PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}"
-
-def pypi_src_uri(d):
-    package = d.getVar('PYPI_PACKAGE')
-    archive_name = d.getVar('PYPI_ARCHIVE_NAME')
-    return 'https://files.pythonhosted.org/packages/source/%s/%s/%s' % (package[0], package, archive_name)
-
-PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"
-
-HOMEPAGE ?= "https://pypi.python.org/pypi/${PYPI_PACKAGE}/"
-SECTION = "devel/python"
-SRC_URI:prepend = "${PYPI_SRC_URI} "
-S = "${WORKDIR}/${PYPI_PACKAGE}-${PV}"
-
-UPSTREAM_CHECK_URI ?= "https://pypi.org/project/${PYPI_PACKAGE}/"
-UPSTREAM_CHECK_REGEX ?= "/${PYPI_PACKAGE}/(?P<pver>(\d+[\.\-_]*)+)/"
-
-CVE_PRODUCT ?= "python:${PYPI_PACKAGE}"
diff --git a/poky/meta/classes/python3-dir.bbclass b/poky/meta/classes/python3-dir.bbclass
deleted file mode 100644
index ff03e58..0000000
--- a/poky/meta/classes/python3-dir.bbclass
+++ /dev/null
@@ -1,5 +0,0 @@
-PYTHON_BASEVERSION = "3.10"
-PYTHON_ABI = ""
-PYTHON_DIR = "python${PYTHON_BASEVERSION}"
-PYTHON_PN = "python3"
-PYTHON_SITEPACKAGES_DIR = "${libdir}/${PYTHON_DIR}/site-packages"
diff --git a/poky/meta/classes/python3native.bbclass b/poky/meta/classes/python3native.bbclass
deleted file mode 100644
index 3783c0c..0000000
--- a/poky/meta/classes/python3native.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-inherit python3-dir
-
-PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"
-EXTRANATIVEPATH += "python3-native"
-DEPENDS:append = " python3-native "
-
-# python-config and other scripts are using sysconfig modules
-# which we patch to access these variables
-export STAGING_INCDIR
-export STAGING_LIBDIR
-
-# Packages can use
-# find_package(PythonInterp REQUIRED)
-# find_package(PythonLibs REQUIRED)
-# which ends up using libs/includes from build host
-# Therefore pre-empt that effort
-export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
-export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
-
-# suppress host user's site-packages dirs.
-export PYTHONNOUSERSITE = "1"
-
-# autoconf macros will use their internal default preference otherwise
-export PYTHON
diff --git a/poky/meta/classes/python3targetconfig.bbclass b/poky/meta/classes/python3targetconfig.bbclass
deleted file mode 100644
index 2476858..0000000
--- a/poky/meta/classes/python3targetconfig.bbclass
+++ /dev/null
@@ -1,29 +0,0 @@
-inherit python3native
-
-EXTRA_PYTHON_DEPENDS ?= ""
-EXTRA_PYTHON_DEPENDS:class-target = "python3"
-DEPENDS:append = " ${EXTRA_PYTHON_DEPENDS}"
-
-do_configure:prepend:class-target() {
-        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_compile:prepend:class-target() {
-        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_install:prepend:class-target() {
-        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_configure:prepend:class-nativesdk() {
-        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_compile:prepend:class-nativesdk() {
-        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_install:prepend:class-nativesdk() {
-        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
diff --git a/poky/meta/classes/python_flit_core.bbclass b/poky/meta/classes/python_flit_core.bbclass
deleted file mode 100644
index 7109307..0000000
--- a/poky/meta/classes/python_flit_core.bbclass
+++ /dev/null
@@ -1,8 +0,0 @@
-inherit python_pep517 python3native python3-dir setuptools3-base
-
-DEPENDS += "python3 python3-flit-core-native"
-
-python_flit_core_do_manual_build () {
-    cd ${PEP517_SOURCE_PATH}
-    nativepython3 -m flit_core.wheel --outdir ${PEP517_WHEEL_PATH} .
-}
diff --git a/poky/meta/classes/python_hatchling.bbclass b/poky/meta/classes/python_hatchling.bbclass
deleted file mode 100644
index 984eb6b..0000000
--- a/poky/meta/classes/python_hatchling.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit python_pep517 python3native python3-dir setuptools3-base
-
-DEPENDS += "python3-hatchling-native"
diff --git a/poky/meta/classes/python_pep517.bbclass b/poky/meta/classes/python_pep517.bbclass
deleted file mode 100644
index 7cdb9c8..0000000
--- a/poky/meta/classes/python_pep517.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-# Common infrastructure for Python packages that use PEP-517 compliant packaging.
-# https://www.python.org/dev/peps/pep-0517/
-#
-# This class will build a wheel in do_compile, and use pypa/installer to install
-# it in do_install.
-
-DEPENDS:append = " python3-picobuild-native python3-installer-native"
-
-# Where to execute the build process from
-PEP517_SOURCE_PATH ?= "${S}"
-
-# The directory where wheels will be written
-PEP517_WHEEL_PATH ?= "${WORKDIR}/dist"
-
-PEP517_PICOBUILD_OPTS ?= ""
-
-# The interpreter to use for installed scripts
-PEP517_INSTALL_PYTHON = "python3"
-PEP517_INSTALL_PYTHON:class-native = "nativepython3"
-
-# pypa/installer option to control the bytecode compilation
-INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0"
-
-# PEP517 doesn't have a specific configure step, so set an empty do_configure to avoid
-# running base_do_configure.
-python_pep517_do_configure () {
-    :
-}
-
-# When we have Python 3.11 we can parse pyproject.toml to determine the build
-# API entry point directly
-python_pep517_do_compile () {
-    nativepython3 -m picobuild --source ${PEP517_SOURCE_PATH} --dest ${PEP517_WHEEL_PATH} --wheel ${PEP517_PICOBUILD_OPTS}
-}
-do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
-
-python_pep517_do_install () {
-    COUNT=$(find ${PEP517_WHEEL_PATH} -name '*.whl' | wc -l)
-    if test $COUNT -eq 0; then
-        bbfatal No wheels found in ${PEP517_WHEEL_PATH}
-    elif test $COUNT -gt 1; then
-        bbfatal More than one wheel found in ${PEP517_WHEEL_PATH}, this should not happen
-    fi
-
-    nativepython3 -m installer ${INSTALL_WHEEL_COMPILE_BYTECODE} --interpreter "${USRBINPATH}/env ${PEP517_INSTALL_PYTHON}" --destdir=${D} ${PEP517_WHEEL_PATH}/*.whl
-}
-
-# A manual do_install that just uses unzip for bootstrapping purposes. Callers should DEPEND on unzip-native.
-python_pep517_do_bootstrap_install () {
-    install -d ${D}${PYTHON_SITEPACKAGES_DIR}
-    unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PEP517_WHEEL_PATH}/*.whl
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/python_poetry_core.bbclass b/poky/meta/classes/python_poetry_core.bbclass
deleted file mode 100644
index 0aaf66b..0000000
--- a/poky/meta/classes/python_poetry_core.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit python_pep517 python3native setuptools3-base
-
-DEPENDS += "python3-poetry-core-native"
diff --git a/poky/meta/classes/python_pyo3.bbclass b/poky/meta/classes/python_pyo3.bbclass
deleted file mode 100644
index 10cc3a0..0000000
--- a/poky/meta/classes/python_pyo3.bbclass
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# This class helps make sure that Python extensions built with PyO3
-# and setuptools_rust properly set up the environment for cross compilation
-#
-
-inherit cargo python3-dir siteinfo
-
-export PYO3_CROSS="1"
-export PYO3_CROSS_PYTHON_VERSION="${PYTHON_BASEVERSION}"
-export PYO3_CROSS_LIB_DIR="${STAGING_LIBDIR}"
-export CARGO_BUILD_TARGET="${HOST_SYS}"
-export RUSTFLAGS
-export PYO3_PYTHON="${PYTHON}"
-export PYO3_CONFIG_FILE="${WORKDIR}/pyo3.config"
-
-python_pyo3_do_configure () {
-    cat > ${WORKDIR}/pyo3.config << EOF
-implementation=CPython
-version=${PYTHON_BASEVERSION}
-shared=true
-abi3=false
-lib_name=${PYTHON_DIR}
-lib_dir=${STAGING_LIBDIR}
-pointer_width=${SITEINFO_BITS}
-build_flags=WITH_THREAD
-suppress_build_script_link_lines=false
-EOF
-}
-
-EXPORT_FUNCTIONS do_configure
diff --git a/poky/meta/classes/python_setuptools3_rust.bbclass b/poky/meta/classes/python_setuptools3_rust.bbclass
deleted file mode 100644
index f12e5d0..0000000
--- a/poky/meta/classes/python_setuptools3_rust.bbclass
+++ /dev/null
@@ -1,11 +0,0 @@
-inherit python_pyo3 setuptools3
-
-DEPENDS += "python3-setuptools-rust-native"
-
-python_setuptools3_rust_do_configure() {
-    python_pyo3_do_configure
-    cargo_common_do_configure
-    setuptools3_do_configure
-}
-
-EXPORT_FUNCTIONS do_configure
diff --git a/poky/meta/classes/python_setuptools_build_meta.bbclass b/poky/meta/classes/python_setuptools_build_meta.bbclass
deleted file mode 100644
index 974054f..0000000
--- a/poky/meta/classes/python_setuptools_build_meta.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit setuptools3-base python_pep517
-
-DEPENDS += "python3-setuptools-native python3-wheel-native"
diff --git a/poky/meta/classes/qemu.bbclass b/poky/meta/classes/qemu.bbclass
deleted file mode 100644
index 7493ac3..0000000
--- a/poky/meta/classes/qemu.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# This class contains functions for recipes that need QEMU or test for its
-# existence.
-#
-
-def qemu_target_binary(data):
-    package_arch = data.getVar("PACKAGE_ARCH")
-    qemu_target_binary = (data.getVar("QEMU_TARGET_BINARY_%s" % package_arch) or "")
-    if qemu_target_binary:
-        return qemu_target_binary
-
-    target_arch = data.getVar("TARGET_ARCH")
-    if target_arch in ("i486", "i586", "i686"):
-        target_arch = "i386"
-    elif target_arch == "powerpc":
-        target_arch = "ppc"
-    elif target_arch == "powerpc64":
-        target_arch = "ppc64"
-    elif target_arch == "powerpc64le":
-        target_arch = "ppc64le"
-
-    return "qemu-" + target_arch
-
-def qemu_wrapper_cmdline(data, rootfs_path, library_paths):
-    import string
-
-    qemu_binary = qemu_target_binary(data)
-    if qemu_binary == "qemu-allarch":
-        qemu_binary = "qemuwrapper"
-
-    qemu_options = data.getVar("QEMU_OPTIONS")    
-
-    return "PSEUDO_UNLOAD=1 " + qemu_binary + " " + qemu_options + " -L " + rootfs_path\
-            + " -E LD_LIBRARY_PATH=" + ":".join(library_paths) + " "
-
-# Next function will return a string containing the command that is needed to
-# to run a certain binary through qemu. For example, in order to make a certain
-# postinstall scriptlet run at do_rootfs time and running the postinstall is
-# architecture dependent, we can run it through qemu. For example, in the
-# postinstall scriptlet, we could use the following:
-#
-# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments]
-#
-def qemu_run_binary(data, rootfs_path, binary):
-    libdir = rootfs_path + data.getVar("libdir", False)
-    base_libdir = rootfs_path + data.getVar("base_libdir", False)
-
-    return qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir]) + rootfs_path + binary
-
-# QEMU_EXTRAOPTIONS is not meant to be directly used, the extensions are
-# PACKAGE_ARCH, *NOT* overrides.
-# In some cases (e.g. ppc) simply being arch specific (apparently) isn't good
-# enough and a PACKAGE_ARCH specific -cpu option is needed (hence we have to do
-# this dance). For others (e.g. arm) a -cpu option is not necessary, since the
-# qemu-arm default CPU supports all required architecture levels.
-
-QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH')) or ""}"
-QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${PACKAGE_ARCH}"
-
-QEMU_EXTRAOPTIONS_ppce500v2 = " -cpu e500v2"
-QEMU_EXTRAOPTIONS_ppce500mc = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppce5500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppc64e5500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppce6500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppc64e6500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppc7400 = " -cpu 7400"
-QEMU_EXTRAOPTIONS_powerpc64le = " -cpu POWER9"
-# Some packages e.g. fwupd sets PACKAGE_ARCH = MACHINE_ARCH and uses meson which
-# needs right options to usermode qemu
-QEMU_EXTRAOPTIONS_qemuppc = " -cpu 7400"
-QEMU_EXTRAOPTIONS_qemuppc64 = " -cpu POWER9"
diff --git a/poky/meta/classes/qemuboot.bbclass b/poky/meta/classes/qemuboot.bbclass
deleted file mode 100644
index ad84899..0000000
--- a/poky/meta/classes/qemuboot.bbclass
+++ /dev/null
@@ -1,165 +0,0 @@
-# Help runqemu boot target board, "QB" means Qemu Boot, the following
-# vars can be set in conf files, such as <bsp.conf> to make it can be
-# boot by runqemu:
-#
-# QB_SYSTEM_NAME: qemu name, e.g., "qemu-system-i386"
-#
-# QB_OPT_APPEND: options to append to qemu, e.g., "-device usb-mouse"
-#
-# QB_DEFAULT_KERNEL: default kernel to boot, e.g., "bzImage"
-#
-# QB_DEFAULT_FSTYPE: default FSTYPE to boot, e.g., "ext4"
-#
-# QB_MEM: memory, e.g., "-m 512"
-#
-# QB_MACHINE: qemu machine, e.g., "-machine virt"
-#
-# QB_CPU: qemu cpu, e.g., "-cpu qemu32"
-#
-# QB_CPU_KVM: the similar to QB_CPU, but used when kvm, e.g., '-cpu kvm64',
-#             set it when support kvm.
-#
-# QB_SMP: amount of CPU cores inside qemu guest, each mapped to a thread on the host,
-#             e.g. "-smp 8".
-#
-# QB_KERNEL_CMDLINE_APPEND: options to append to kernel's -append
-#                           option, e.g., "console=ttyS0 console=tty"
-#
-# QB_DTB: qemu dtb name
-#
-# QB_AUDIO_DRV: qemu audio driver, e.g., "alsa", set it when support audio
-#
-# QB_AUDIO_OPT: qemu audio option, e.g., "-device AC97", used
-#               when QB_AUDIO_DRV is set.
-#
-# QB_RNG: Pass-through for host random number generator, it can speedup boot
-#         in system mode, where system is experiencing entropy starvation
-#
-# QB_KERNEL_ROOT: kernel's root, e.g., /dev/vda
-#                 By default "/dev/vda rw" gets passed to the kernel.
-#                 To mount the rootfs read-only QB_KERNEL_ROOT can be set to e.g. "/dev/vda ro".
-#
-# QB_NETWORK_DEVICE: network device, e.g., "-device virtio-net-pci,netdev=net0,mac=@MAC@",
-#                    it needs work with QB_TAP_OPT and QB_SLIRP_OPT.
-#                    Note, runqemu will replace @MAC@ with a predefined mac, you can set
-#                    a custom one, but that may cause conflicts when multiple qemus are
-#                    running on the same host.
-#                    Note: If more than one interface of type -device virtio-net-device gets added,
-#                          QB_NETWORK_DEVICE:prepend might be used, since Qemu enumerates the eth*
-#                          devices in reverse order to -device arguments.
-#
-# QB_TAP_OPT: network option for 'tap' mode, e.g.,
-#             "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
-#              Note, runqemu will replace "@TAP@" with the one which is used, such as tap0, tap1 ...
-#
-# QB_SLIRP_OPT: network option for SLIRP mode, e.g., -netdev user,id=net0"
-#
-# QB_CMDLINE_IP_SLIRP: If QB_NETWORK_DEVICE adds more than one network interface to qemu, usually the
-#                      ip= kernel comand line argument needs to be changed accordingly. Details are documented
-#                      in the kernel docuemntation https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
-#                      Example to configure only the first interface: "ip=eth0:dhcp"
-# QB_CMDLINE_IP_TAP: This parameter is similar to the QB_CMDLINE_IP_SLIRP parameter. Since the tap interface requires
-#                    static IP configuration @CLIENT@ and @GATEWAY@ place holders are replaced by the IP and the gateway
-#                    address of the qemu guest by runqemu.
-#                    Example: "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0::eth0"
-#
-# QB_ROOTFS_OPT: used as rootfs, e.g.,
-#               "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
-#              Note, runqemu will replace "@ROOTFS@" with the one which is used, such as core-image-minimal-qemuarm64.ext4.
-#
-# QB_SERIAL_OPT: serial port, e.g., "-serial mon:stdio"
-#
-# QB_TCPSERIAL_OPT: tcp serial port option, e.g.,
-#                   " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
-#                   Note, runqemu will replace "@PORT@" with the port number which is used.
-#
-# QB_ROOTFS_EXTRA_OPT: extra options to be appended to the rootfs device in case there is none specified by QB_ROOTFS_OPT.
-#                      Can be used to automatically determine the image from the other variables
-#                      but define things link 'bootindex' when booting from EFI or 'readonly' when using squashfs
-#                      without the need to specify a dedicated qemu configuration
-#
-# QB_GRAPHICS: QEMU video card type (e.g. "-vga std")
-#
-# Usage:
-# IMAGE_CLASSES += "qemuboot"
-# See "runqemu help" for more info
-
-QB_MEM ?= "-m 256"
-QB_SMP ?= ""
-QB_SERIAL_OPT ?= "-serial mon:stdio -serial null"
-QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}"
-QB_DEFAULT_FSTYPE ?= "ext4"
-QB_RNG ?= "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"
-QB_OPT_APPEND ?= ""
-QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
-QB_CMDLINE_IP_SLIRP ?= "ip=dhcp"
-QB_CMDLINE_IP_TAP ?= "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0::eth0:off:8.8.8.8"
-QB_ROOTFS_EXTRA_OPT ?= ""
-QB_GRAPHICS ?= ""
-
-# This should be kept align with ROOT_VM
-QB_DRIVE_TYPE ?= "/dev/sd"
-
-inherit image-artifact-names
-
-# Create qemuboot.conf
-addtask do_write_qemuboot_conf after do_rootfs before do_image
-
-def qemuboot_vars(d):
-    build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
-                'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME',
-                'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE',
-                'STAGING_DIR_HOST', 'SERIAL_CONSOLES', 'UNINATIVE_LOADER']
-    return build_vars + [k for k in d.keys() if k.startswith('QB_')]
-
-do_write_qemuboot_conf[vardeps] += "${@' '.join(qemuboot_vars(d))}"
-do_write_qemuboot_conf[vardepsexclude] += "TOPDIR"
-python do_write_qemuboot_conf() {
-    import configparser
-
-    qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_NAME'))
-    if d.getVar('IMAGE_LINK_NAME'):
-        qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME'))
-    else:
-        qemuboot_link = ""
-    finalpath = d.getVar("DEPLOY_DIR_IMAGE")
-    topdir = d.getVar('TOPDIR')
-    cf = configparser.ConfigParser()
-    cf.add_section('config_bsp')
-    for k in sorted(qemuboot_vars(d)):
-        if ":" in k:
-            continue
-        # qemu-helper-native sysroot is not removed by rm_work and
-        # contains all tools required by runqemu
-        if k == 'STAGING_BINDIR_NATIVE':
-            val = os.path.join(d.getVar('BASE_WORKDIR'), d.getVar('BUILD_SYS'),
-                               'qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/')
-        else:
-            val = d.getVar(k)
-        if val is None:
-            continue
-        # we only want to write out relative paths so that we can relocate images
-        # and still run them
-        if val.startswith(topdir):
-            val = os.path.relpath(val, finalpath)
-        cf.set('config_bsp', k, '%s' % val)
-
-    # QB_DEFAULT_KERNEL's value of KERNEL_IMAGETYPE is the name of a symlink
-    # to the kernel file, which hinders relocatability of the qb conf.
-    # Read the link and replace it with the full filename of the target.
-    kernel_link = os.path.join(d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('QB_DEFAULT_KERNEL'))
-    kernel = os.path.realpath(kernel_link)
-    # we only want to write out relative paths so that we can relocate images
-    # and still run them
-    kernel = os.path.relpath(kernel, finalpath)
-    cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel)
-
-    bb.utils.mkdirhier(os.path.dirname(qemuboot))
-    with open(qemuboot, 'w') as f:
-        cf.write(f)
-
-    if qemuboot_link and qemuboot_link != qemuboot:
-        if os.path.lexists(qemuboot_link):
-           os.remove(qemuboot_link)
-        os.symlink(os.path.basename(qemuboot), qemuboot_link)
-}
diff --git a/poky/meta/classes/recipe_sanity.bbclass b/poky/meta/classes/recipe_sanity.bbclass
index 7fa4a84..1c2e24c 100644
--- a/poky/meta/classes/recipe_sanity.bbclass
+++ b/poky/meta/classes/recipe_sanity.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 def __note(msg, d):
     bb.note("%s: recipe_sanity: %s" % (d.getVar("P"), msg))
 
diff --git a/poky/meta/classes/relative_symlinks.bbclass b/poky/meta/classes/relative_symlinks.bbclass
index 3157737..9ee20e0 100644
--- a/poky/meta/classes/relative_symlinks.bbclass
+++ b/poky/meta/classes/relative_symlinks.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 do_install[postfuncs] += "install_relative_symlinks"
 
 python install_relative_symlinks () {
diff --git a/poky/meta/classes/relocatable.bbclass b/poky/meta/classes/relocatable.bbclass
index af04be5..d0a623f 100644
--- a/poky/meta/classes/relocatable.bbclass
+++ b/poky/meta/classes/relocatable.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 inherit chrpath
 
 SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"
diff --git a/poky/meta/classes/remove-libtool.bbclass b/poky/meta/classes/remove-libtool.bbclass
index 3fd0cd5..8e98738 100644
--- a/poky/meta/classes/remove-libtool.bbclass
+++ b/poky/meta/classes/remove-libtool.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # This class removes libtool .la files after do_install
 
 REMOVE_LIBTOOL_LA ?= "1"
diff --git a/poky/meta/classes/report-error.bbclass b/poky/meta/classes/report-error.bbclass
index 6866d47..2f692fb 100644
--- a/poky/meta/classes/report-error.bbclass
+++ b/poky/meta/classes/report-error.bbclass
@@ -4,7 +4,8 @@
 # Copyright (C) 2013 Intel Corporation
 # Author: Andreea Brandusa Proca <andreea.b.proca@intel.com>
 #
-# Licensed under the MIT license, see COPYING.MIT for details
+# SPDX-License-Identifier: MIT
+#
 
 ERR_REPORT_DIR ?= "${LOG_DIR}/error-report"
 
diff --git a/poky/meta/classes/rm_work.bbclass b/poky/meta/classes/rm_work.bbclass
index 5f12d5a..c493eff 100644
--- a/poky/meta/classes/rm_work.bbclass
+++ b/poky/meta/classes/rm_work.bbclass
@@ -1,4 +1,10 @@
 #
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
 # Removes source after build
 #
 # To use it add that line to conf/local.conf:
diff --git a/poky/meta/classes/rm_work_and_downloads.bbclass b/poky/meta/classes/rm_work_and_downloads.bbclass
index 15e6091..2695a38 100644
--- a/poky/meta/classes/rm_work_and_downloads.bbclass
+++ b/poky/meta/classes/rm_work_and_downloads.bbclass
@@ -1,8 +1,7 @@
 # Author:       Patrick Ohly <patrick.ohly@intel.com>
 # Copyright:    Copyright (C) 2015 Intel Corporation
 #
-# This file is licensed under the MIT license, see COPYING.MIT in
-# this source distribution for the terms.
+# SPDX-License-Identifier: MIT
 
 # This class is used like rm_work:
 # INHERIT += "rm_work_and_downloads"
diff --git a/poky/meta/classes/rootfs-postcommands.bbclass b/poky/meta/classes/rootfs-postcommands.bbclass
deleted file mode 100644
index a8a952f..0000000
--- a/poky/meta/classes/rootfs-postcommands.bbclass
+++ /dev/null
@@ -1,435 +0,0 @@
-
-# Zap the root password if debug-tweaks and empty-root-password features are not enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'empty-root-password' ], "", "zap_empty_root_password; ",d)}'
-
-# Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks or allow-empty-password is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-empty-password' ], "ssh_allow_empty_password; ", "",d)}'
-
-# Allow dropbear/openssh to accept root logins if debug-tweaks or allow-root-login is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "ssh_allow_root_login; ", "",d)}'
-
-# Enable postinst logging if debug-tweaks or post-install-logging is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'post-install-logging' ], "postinst_enable_logging; ", "",d)}'
-
-# Create /etc/timestamp during image construction to give a reasonably sane default time setting
-ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp; "
-
-# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
-
-# We also need to do the same for the kernel boot parameters,
-# otherwise kernel or initramfs end up mounting the rootfs read/write
-# (the default) if supported by the underlying storage.
-#
-# We do this with :append because the default value might get set later with ?=
-# and we don't want to disable such a default that by setting a value here.
-APPEND:append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}'
-
-# Generates test data file with data store variables expanded in json format
-ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data; "
-
-# Write manifest
-IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.manifest"
-ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
-# Set default postinst log file
-POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
-# Set default target for systemd images
-SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains_any("IMAGE_FEATURES", [ "x11-base", "weston" ], "graphical.target", "multi-user.target", d)}'
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; systemd_create_users;", "", d)}'
-
-ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
-
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "overlayfs", "overlayfs_qa_check; overlayfs_postprocess;", "", d)}'
-
-inherit image-artifact-names
-
-# Sort the user and group entries in /etc by ID in order to make the content
-# deterministic. Package installs are not deterministic, causing the ordering
-# of entries to change between builds. In case that this isn't desired,
-# the command can be overridden.
-#
-# Note that useradd-staticids.bbclass has to be used to ensure that
-# the numeric IDs of dynamically created entries remain stable.
-#
-# We want this to run as late as possible, in particular after
-# systemd_sysusers_create and set_user_group. Using :append is not
-# enough for that, set_user_group is added that way and would end
-# up running after us.
-SORT_PASSWD_POSTPROCESS_COMMAND ??= " sort_passwd; "
-python () {
-    d.appendVar('ROOTFS_POSTPROCESS_COMMAND', '${SORT_PASSWD_POSTPROCESS_COMMAND}')
-    d.appendVar('ROOTFS_POSTPROCESS_COMMAND', 'rootfs_reproducible;')
-}
-
-systemd_create_users () {
-	for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/*.conf; do
-		[ -e $conffile ] || continue
-		grep -v "^#" $conffile | sed -e '/^$/d' | while read type name id comment; do
-		if [ "$type" = "u" ]; then
-			useradd_params="--shell /sbin/nologin"
-			[ "$id" != "-" ] && useradd_params="$useradd_params --uid $id"
-			[ "$comment" != "-" ] && useradd_params="$useradd_params --comment $comment"
-			useradd_params="$useradd_params --system $name"
-			eval useradd --root ${IMAGE_ROOTFS} $useradd_params || true
-		elif [ "$type" = "g" ]; then
-			groupadd_params=""
-			[ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id"
-			groupadd_params="$groupadd_params --system $name"
-			eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true
-		elif [ "$type" = "m" ]; then
-			group=$id
-			eval groupadd --root ${IMAGE_ROOTFS} --system $group || true
-			eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name --no-user-group || true
-			eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name
-		fi
-		done
-	done
-}
-
-#
-# A hook function to support read-only-rootfs IMAGE_FEATURES
-#
-read_only_rootfs_hook () {
-	# Tweak the mount option and fs_passno for rootfs in fstab
-	if [ -f ${IMAGE_ROOTFS}/etc/fstab ]; then
-		sed -i -e '/^[#[:space:]]*\/dev\/root/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab
-	fi
-
-	# Tweak the "mount -o remount,rw /" command in busybox-inittab inittab
-	if [ -f ${IMAGE_ROOTFS}/etc/inittab ]; then
-		sed -i 's|/bin/mount -o remount,rw /|/bin/mount -o remount,ro /|' ${IMAGE_ROOTFS}/etc/inittab
-	fi
-
-	# If we're using openssh and the /etc/ssh directory has no pre-generated keys,
-	# we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly
-	# and the keys under /var/run/ssh.
-	if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then
-		if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then
-			echo "SYSCONFDIR=\${SYSCONFDIR:-/etc/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh
-			echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh
-		else
-			echo "SYSCONFDIR=\${SYSCONFDIR:-/var/run/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh
-			echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh
-		fi
-	fi
-
-	# Also tweak the key location for dropbear in the same way.
-	if [ -d ${IMAGE_ROOTFS}/etc/dropbear ]; then
-		if [ ! -e ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ]; then
-			echo "DROPBEAR_RSAKEY_DIR=/var/lib/dropbear" >> ${IMAGE_ROOTFS}/etc/default/dropbear
-		fi
-	fi
-
-	if ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then
-		# Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes
-		if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then
-			sed -i 's/ROOTFS_READ_ONLY=no/ROOTFS_READ_ONLY=yes/' ${IMAGE_ROOTFS}/etc/default/rcS
-		fi
-		# Run populate-volatile.sh at rootfs time to set up basic files
-		# and directories to support read-only rootfs.
-		if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
-			${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
-		fi
-	fi
-
-	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
-	# Create machine-id
-	# 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
-		touch ${IMAGE_ROOTFS}${sysconfdir}/machine-id
-	fi
-}
-
-#
-# This function disallows empty root passwords
-#
-zap_empty_root_password () {
-	if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
-		sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow
-        fi
-	if [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
-		sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd
-	fi
-}
-
-#
-# allow dropbear/openssh to accept logins from accounts with an empty password string
-#
-ssh_allow_empty_password () {
-	for config in sshd_config sshd_config_readonly; do
-		if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then
-			sed -i 's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config
-		fi
-	done
-
-	if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
-		if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
-			if ! grep -q "DROPBEAR_EXTRA_ARGS=.*-B" ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear ; then
-				sed -i 's/^DROPBEAR_EXTRA_ARGS="*\([^"]*\)"*/DROPBEAR_EXTRA_ARGS="\1 -B"/' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
-			fi
-		else
-			printf '\nDROPBEAR_EXTRA_ARGS="-B"\n' >> ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
-		fi
-	fi
-
-	if [ -d ${IMAGE_ROOTFS}${sysconfdir}/pam.d ] ; then
-		for f in `find ${IMAGE_ROOTFS}${sysconfdir}/pam.d/* -type f -exec test -e {} \; -print`
-		do
-			sed -i 's/nullok_secure/nullok/' $f
-		done
-	fi
-}
-
-#
-# allow dropbear/openssh to accept root logins
-#
-ssh_allow_root_login () {
-	for config in sshd_config sshd_config_readonly; do
-		if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then
-			sed -i 's/^[#[:space:]]*PermitRootLogin.*/PermitRootLogin yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config
-		fi
-	done
-
-	if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
-		if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
-			sed -i '/^DROPBEAR_EXTRA_ARGS=/ s/-w//' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
-		fi
-	fi
-}
-
-python sort_passwd () {
-    import rootfspostcommands
-    rootfspostcommands.sort_passwd(d.expand('${IMAGE_ROOTFS}${sysconfdir}'))
-}
-
-#
-# Enable postinst logging
-#
-postinst_enable_logging () {
-	mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/default
-	echo "POSTINST_LOGGING=1" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
-	echo "LOGFILE=${POSTINST_LOGFILE}" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
-}
-
-#
-# Modify systemd default target
-#
-set_systemd_default_target () {
-	if [ -d ${IMAGE_ROOTFS}${sysconfdir}/systemd/system -a -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ]; then
-		ln -sf ${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${sysconfdir}/systemd/system/default.target
-	fi
-}
-
-# If /var/volatile is not empty, we have seen problems where programs such as the
-# journal make assumptions based on the contents of /var/volatile. The journal
-# would then write to /var/volatile before it was mounted, thus hiding the
-# items previously written.
-#
-# This change is to attempt to fix those types of issues in a way that doesn't
-# affect users that may not be using /var/volatile.
-empty_var_volatile () {
-	if [ -e ${IMAGE_ROOTFS}/etc/fstab ]; then
-		match=`awk '$1 !~ "#" && $2 ~ /\/var\/volatile/{print $2}' ${IMAGE_ROOTFS}/etc/fstab 2> /dev/null`
-		if [ -n "$match" ]; then
-			find ${IMAGE_ROOTFS}/var/volatile -mindepth 1 -delete
-		fi
-	fi
-}
-
-# Turn any symbolic /sbin/init link into a file
-remove_init_link () {
-	if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
-		LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init`
-		rm ${IMAGE_ROOTFS}/sbin/init
-		cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init
-	fi
-}
-
-make_zimage_symlink_relative () {
-	if [ -L ${IMAGE_ROOTFS}/boot/zImage ]; then
-		(cd ${IMAGE_ROOTFS}/boot/ && for i in `ls zImage-* | sort`; do ln -sf $i zImage; done)
-	fi
-}
-
-python write_image_manifest () {
-    from oe.rootfs import image_list_installed_packages
-    from oe.utils import format_pkg_list
-
-    deploy_dir = d.getVar('IMGDEPLOYDIR')
-    link_name = d.getVar('IMAGE_LINK_NAME')
-    manifest_name = d.getVar('IMAGE_MANIFEST')
-
-    if not manifest_name:
-        return
-
-    pkgs = image_list_installed_packages(d)
-    with open(manifest_name, 'w+') as image_manifest:
-        image_manifest.write(format_pkg_list(pkgs, "ver"))
-
-    if os.path.exists(manifest_name) and link_name:
-        manifest_link = deploy_dir + "/" + link_name + ".manifest"
-        if manifest_link != manifest_name:
-            if os.path.lexists(manifest_link):
-                os.remove(manifest_link)
-            os.symlink(os.path.basename(manifest_name), manifest_link)
-}
-
-# Can be used to create /etc/timestamp during image construction to give a reasonably
-# sane default time setting
-rootfs_update_timestamp () {
-	if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
-		# Convert UTC into %4Y%2m%2d%2H%2M%2S
-		sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
-	else
-		sformatted=`date -u +%4Y%2m%2d%2H%2M%2S`
-	fi
-	echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp
-	bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted"
-}
-
-# Prevent X from being started
-rootfs_no_x_startup () {
-	if [ -f ${IMAGE_ROOTFS}/etc/init.d/xserver-nodm ]; then
-		chmod a-x ${IMAGE_ROOTFS}/etc/init.d/xserver-nodm
-	fi
-}
-
-rootfs_trim_schemas () {
-	for schema in ${IMAGE_ROOTFS}/etc/gconf/schemas/*.schemas
-	do
-		# Need this in case no files exist
-		if [ -e $schema ]; then
-			oe-trim-schemas $schema > $schema.new
-			mv $schema.new $schema
-		fi
-	done
-}
-
-rootfs_check_host_user_contaminated () {
-	contaminated="${S}/host-user-contaminated.txt"
-	HOST_USER_UID="$(PSEUDO_UNLOAD=1 id -u)"
-	HOST_USER_GID="$(PSEUDO_UNLOAD=1 id -g)"
-
-	find "${IMAGE_ROOTFS}" -path "${IMAGE_ROOTFS}/home" -prune -o \
-	    -user "$HOST_USER_UID" -print -o -group "$HOST_USER_GID" -print >"$contaminated"
-
-	sed -e "s,${IMAGE_ROOTFS},," $contaminated | while read line; do
-		bbwarn "Path in the rootfs is owned by the same user or group as the user running bitbake:" $line `ls -lan ${IMAGE_ROOTFS}/$line`
-	done
-
-	if [ -s "$contaminated" ]; then
-		bbwarn "/etc/passwd:" `cat ${IMAGE_ROOTFS}/etc/passwd`
-		bbwarn "/etc/group:" `cat ${IMAGE_ROOTFS}/etc/group`
-	fi
-}
-
-# Make any absolute links in a sysroot relative
-rootfs_sysroot_relativelinks () {
-	sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
-}
-
-# Generated test data json file
-python write_image_test_data() {
-    from oe.data import export2json
-
-    deploy_dir = d.getVar('IMGDEPLOYDIR')
-    link_name = d.getVar('IMAGE_LINK_NAME')
-    testdata_name = os.path.join(deploy_dir, "%s.testdata.json" % d.getVar('IMAGE_NAME'))
-
-    searchString = "%s/"%(d.getVar("TOPDIR")).replace("//","/")
-    export2json(d, testdata_name, searchString=searchString, replaceString="")
-
-    if os.path.exists(testdata_name) and link_name:
-        testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name)
-        if testdata_link != testdata_name:
-            if os.path.lexists(testdata_link):
-                os.remove(testdata_link)
-            os.symlink(os.path.basename(testdata_name), testdata_link)
-}
-write_image_test_data[vardepsexclude] += "TOPDIR"
-
-# Check for unsatisfied recommendations (RRECOMMENDS)
-python rootfs_log_check_recommends() {
-    log_path = d.expand("${T}/log.do_rootfs")
-    with open(log_path, 'r') as log:
-        for line in log:
-            if 'log_check' in line:
-                continue
-
-            if 'unsatisfied recommendation for' in line:
-                bb.warn('[log_check] %s: %s' % (d.getVar('PN'), line))
-}
-
-# Perform any additional adjustments needed to make rootf binary reproducible
-rootfs_reproducible () {
-	if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
-		# Convert UTC into %4Y%2m%2d%2H%2M%2S
-		sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
-		echo $sformatted > ${IMAGE_ROOTFS}/etc/version
-		bbnote "rootfs_reproducible: set /etc/version to $sformatted"
-
-		if [ -d ${IMAGE_ROOTFS}${sysconfdir}/gconf ]; then
-			find ${IMAGE_ROOTFS}${sysconfdir}/gconf -name '%gconf.xml' -print0 | xargs -0r \
-			sed -i -e 's@\bmtime="[0-9][0-9]*"@mtime="'${REPRODUCIBLE_TIMESTAMP_ROOTFS}'"@g'
-		fi
-	fi
-}
-
-# Perform a dumb check for unit existence, not its validity
-python overlayfs_qa_check() {
-    from oe.overlayfs import mountUnitName
-
-    overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {}
-    imagepath = d.getVar("IMAGE_ROOTFS")
-    sysconfdir = d.getVar("sysconfdir")
-    searchpaths = [oe.path.join(imagepath, sysconfdir, "systemd", "system"),
-                   oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
-    fstabpath = oe.path.join(imagepath, sysconfdir, "fstab")
-
-    if not any(os.path.exists(path) for path in [*searchpaths, fstabpath]):
-        return
-
-    fstabDevices = []
-    if os.path.isfile(fstabpath):
-        with open(fstabpath, 'r') as f:
-            for line in f:
-                if line[0] == '#':
-                    continue
-                path = line.split(maxsplit=2)
-                if len(path) > 2:
-                    fstabDevices.append(path[1])
-
-    allUnitExist = True;
-    for mountPoint in overlayMountPoints:
-        qaSkip = (d.getVarFlag("OVERLAYFS_QA_SKIP", mountPoint) or "").split()
-        if "mount-configured" in qaSkip:
-            continue
-
-        mountPath = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
-        if mountPath in fstabDevices:
-            continue
-
-        mountUnit = mountUnitName(mountPath)
-        if any(os.path.isfile(oe.path.join(dirpath, mountUnit))
-               for dirpath in searchpaths):
-            continue
-
-        bb.warn(f'Mount path {mountPath} not found in fstab and unit '
-                f'{mountUnit} not found in systemd unit directories.')
-        bb.warn(f'Skip this check by setting OVERLAYFS_QA_SKIP[{mountPoint}] = '
-                '"mount-configured"')
-        allUnitExist = False;
-
-    if not allUnitExist:
-        bb.fatal('Not all mount paths and units are installed in the image')
-}
-
-python overlayfs_postprocess() {
-    import shutil
-
-    # install helper script
-    helperScriptName = "overlayfs-create-dirs.sh"
-    helperScriptSource = oe.path.join(d.getVar("COREBASE"), "meta/files", helperScriptName)
-    helperScriptDest = oe.path.join(d.getVar("IMAGE_ROOTFS"), "/usr/sbin/", helperScriptName)
-    shutil.copyfile(helperScriptSource, helperScriptDest)
-    os.chmod(helperScriptDest, 0o755)
-}
diff --git a/poky/meta/classes/rootfs_deb.bbclass b/poky/meta/classes/rootfs_deb.bbclass
deleted file mode 100644
index 0469ba7..0000000
--- a/poky/meta/classes/rootfs_deb.bbclass
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright 2006-2007 Openedhand Ltd.
-#
-
-ROOTFS_PKGMANAGE = "dpkg apt"
-
-do_rootfs[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot"
-do_populate_sdk[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot bzip2-native:do_populate_sysroot"
-do_rootfs[recrdeptask] += "do_package_write_deb do_package_qa"
-do_rootfs[vardeps] += "PACKAGE_FEED_URIS PACKAGE_FEED_BASE_PATHS PACKAGE_FEED_ARCHS"
-
-do_rootfs[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
-do_populate_sdk[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
-do_populate_sdk_ext[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
-
-python rootfs_deb_bad_recommendations() {
-    if d.getVar("BAD_RECOMMENDATIONS"):
-        bb.warn("Debian package install does not support BAD_RECOMMENDATIONS")
-}
-do_rootfs[prefuncs] += "rootfs_deb_bad_recommendations"
-
-DEB_POSTPROCESS_COMMANDS = ""
-
-opkglibdir = "${localstatedir}/lib/opkg"
-
-python () {
-    # Map TARGET_ARCH to Debian's ideas about architectures
-    darch = d.getVar('SDK_ARCH')
-    if darch in ["x86", "i486", "i586", "i686", "pentium"]:
-         d.setVar('DEB_SDK_ARCH', 'i386')
-    elif darch == "x86_64":
-         d.setVar('DEB_SDK_ARCH', 'amd64')
-    elif darch == "arm":
-         d.setVar('DEB_SDK_ARCH', 'armel')
-    elif darch == "aarch64":
-         d.setVar('DEB_SDK_ARCH', 'arm64')
-    else:
-         bb.fatal("Unhandled SDK_ARCH %s" % darch)
-}
diff --git a/poky/meta/classes/rootfs_ipk.bbclass b/poky/meta/classes/rootfs_ipk.bbclass
deleted file mode 100644
index 245c256..0000000
--- a/poky/meta/classes/rootfs_ipk.bbclass
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Creates a root filesystem out of IPKs
-#
-# This rootfs can be mounted via root-nfs or it can be put into an cramfs/jffs etc.
-# See image.bbclass for a usage of this.
-#
-
-EXTRAOPKGCONFIG ?= ""
-ROOTFS_PKGMANAGE = "opkg ${EXTRAOPKGCONFIG}"
-
-do_rootfs[depends] += "opkg-native:do_populate_sysroot opkg-utils-native:do_populate_sysroot"
-do_populate_sdk[depends] += "opkg-native:do_populate_sysroot opkg-utils-native:do_populate_sysroot"
-do_rootfs[recrdeptask] += "do_package_write_ipk do_package_qa"
-do_rootfs[vardeps] += "PACKAGE_FEED_URIS PACKAGE_FEED_BASE_PATHS PACKAGE_FEED_ARCHS"
-
-do_rootfs[lockfiles] += "${WORKDIR}/ipk.lock"
-do_populate_sdk[lockfiles] += "${WORKDIR}/sdk-ipk.lock"
-do_populate_sdk_ext[lockfiles] += "${WORKDIR}/sdk-ipk.lock"
-
-OPKG_PREPROCESS_COMMANDS = ""
-
-OPKG_POSTPROCESS_COMMANDS = ""
-
-OPKGLIBDIR ??= "${localstatedir}/lib"
-
-MULTILIBRE_ALLOW_REP = "${OPKGLIBDIR}/opkg|/usr/lib/opkg"
-
-python () {
-
-    if d.getVar('BUILD_IMAGES_FROM_FEEDS'):
-        flags = d.getVarFlag('do_rootfs', 'recrdeptask')
-        flags = flags.replace("do_package_write_ipk", "")
-        flags = flags.replace("do_deploy", "")
-        flags = flags.replace("do_populate_sysroot", "")
-        d.setVarFlag('do_rootfs', 'recrdeptask', flags)
-        d.setVar('OPKG_PREPROCESS_COMMANDS', "")
-        d.setVar('OPKG_POSTPROCESS_COMMANDS', '')
-}
diff --git a/poky/meta/classes/rootfs_rpm.bbclass b/poky/meta/classes/rootfs_rpm.bbclass
deleted file mode 100644
index bec4d63..0000000
--- a/poky/meta/classes/rootfs_rpm.bbclass
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Creates a root filesystem out of rpm packages
-#
-
-ROOTFS_PKGMANAGE = "rpm dnf"
-
-# dnf is using our custom sysconfig module, and so will fail without these
-export STAGING_INCDIR
-export STAGING_LIBDIR
-
-# Add 100Meg of extra space for dnf
-IMAGE_ROOTFS_EXTRA_SPACE:append = "${@bb.utils.contains("PACKAGE_INSTALL", "dnf", " + 102400", "", d)}"
-
-# Dnf is python based, so be sure python3-native is available to us.
-EXTRANATIVEPATH += "python3-native"
-
-# opkg is needed for update-alternatives
-RPMROOTFSDEPENDS = "rpm-native:do_populate_sysroot \
-    dnf-native:do_populate_sysroot \
-    createrepo-c-native:do_populate_sysroot \
-    opkg-native:do_populate_sysroot"
-
-do_rootfs[depends] += "${RPMROOTFSDEPENDS}"
-do_populate_sdk[depends] += "${RPMROOTFSDEPENDS}"
-
-do_rootfs[recrdeptask] += "do_package_write_rpm do_package_qa"
-do_rootfs[vardeps] += "PACKAGE_FEED_URIS PACKAGE_FEED_BASE_PATHS PACKAGE_FEED_ARCHS"
-
-python () {
-    if d.getVar('BUILD_IMAGES_FROM_FEEDS'):
-        flags = d.getVarFlag('do_rootfs', 'recrdeptask')
-        flags = flags.replace("do_package_write_rpm", "")
-        flags = flags.replace("do_deploy", "")
-        flags = flags.replace("do_populate_sysroot", "")
-        d.setVarFlag('do_rootfs', 'recrdeptask', flags)
-        d.setVar('RPM_PREPROCESS_COMMANDS', '')
-        d.setVar('RPM_POSTPROCESS_COMMANDS', '')
-
-}
diff --git a/poky/meta/classes/rootfsdebugfiles.bbclass b/poky/meta/classes/rootfsdebugfiles.bbclass
deleted file mode 100644
index 85c7ec7..0000000
--- a/poky/meta/classes/rootfsdebugfiles.bbclass
+++ /dev/null
@@ -1,41 +0,0 @@
-# This class installs additional files found on the build host
-# directly into the rootfs.
-#
-# One use case is to install a constant ssh host key in
-# an image that gets created for just one machine. This
-# solves two issues:
-# - host key generation on the device can stall when the
-#   kernel has not gathered enough entropy yet (seen in practice
-#   under qemu)
-# - ssh complains by default when the host key changes
-#
-# For dropbear, with the ssh host key store along side the local.conf:
-# 1. Extend local.conf:
-#    INHERIT += "rootfsdebugfiles"
-#    ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ;"
-# 2. Boot the image once, copy the dropbear_rsa_host_key from
-#    the device into your build conf directory.
-# 3. A optional parameter can be used to set file mode
-#    of the copied target, for instance:
-#    ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key 0600;"
-#    in case they might be required to have a specific mode. (Shoundn't be too open, for example)
-#
-# Do not use for production images! It bypasses several
-# core build mechanisms (updating the image when one
-# of the files changes, license tracking in the image
-# manifest, ...).
-
-ROOTFS_DEBUG_FILES ?= ""
-ROOTFS_DEBUG_FILES[doc] = "Lists additional files or directories to be installed with 'cp -a' in the format 'source1 target1;source2 target2;...'"
-
-ROOTFS_POSTPROCESS_COMMAND += "rootfs_debug_files;"
-rootfs_debug_files () {
-   #!/bin/sh -e
-   echo "${ROOTFS_DEBUG_FILES}" | sed -e 's/;/\n/g' | while read source target mode; do
-      if [ -e "$source" ]; then
-         mkdir -p $(dirname $target)
-         cp -a $source $target
-         [ -n "$mode" ] && chmod $mode $target
-      fi
-   done
-}
diff --git a/poky/meta/classes/rust-bin.bbclass b/poky/meta/classes/rust-bin.bbclass
deleted file mode 100644
index c87343b..0000000
--- a/poky/meta/classes/rust-bin.bbclass
+++ /dev/null
@@ -1,149 +0,0 @@
-inherit rust
-
-RDEPENDS:${PN}:append:class-target = " ${RUSTLIB_DEP}"
-
-RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir} -C linker=${RUST_TARGET_CCLD}"
-EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'
-
-# Some libraries alias with the standard library but libstd is configured to
-# make it difficult or imposisble to use its version. Unfortunately libstd
-# must be explicitly overridden using extern.
-OVERLAP_LIBS = "\
-    libc \
-    log \
-    getopts \
-    rand \
-"
-def get_overlap_deps(d):
-    deps = d.getVar("DEPENDS").split()
-    overlap_deps = []
-    for o in d.getVar("OVERLAP_LIBS").split():
-        l = len([o for dep in deps if (o + '-rs' in dep)])
-        if l > 0:
-            overlap_deps.append(o)
-    return " ".join(overlap_deps)
-OVERLAP_DEPS = "${@get_overlap_deps(d)}"
-
-# Prevents multiple static copies of standard library modules
-# See https://github.com/rust-lang/rust/issues/19680
-RUSTC_PREFER_DYNAMIC = "-C prefer-dynamic"
-RUSTC_FLAGS += "${RUSTC_PREFER_DYNAMIC}"
-
-CRATE_NAME ?= "${@d.getVar('BPN').replace('-rs', '').replace('-', '_')}"
-BINNAME ?= "${BPN}"
-LIBNAME ?= "lib${CRATE_NAME}-rs"
-CRATE_TYPE ?= "dylib"
-BIN_SRC ?= "${S}/src/main.rs"
-LIB_SRC ?= "${S}/src/lib.rs"
-
-rustbindest ?= "${bindir}"
-rustlibdest ?= "${rustlibdir}"
-RUST_RPATH_ABS ?= "${rustlibdir}:${rustlib}"
-
-def relative_rpaths(paths, base):
-    relpaths = set()
-    for p in paths.split(':'):
-        if p == base:
-            relpaths.add('$ORIGIN')
-            continue
-        relpaths.add(os.path.join('$ORIGIN', os.path.relpath(p, base)))
-    return '-rpath=' + ':'.join(relpaths) if len(relpaths) else ''
-
-RUST_LIB_RPATH_FLAGS ?= "${@relative_rpaths(d.getVar('RUST_RPATH_ABS', True), d.getVar('rustlibdest', True))}"
-RUST_BIN_RPATH_FLAGS ?= "${@relative_rpaths(d.getVar('RUST_RPATH_ABS', True), d.getVar('rustbindest', True))}"
-
-def libfilename(d):
-    if d.getVar('CRATE_TYPE', True) == 'dylib':
-        return d.getVar('LIBNAME', True) + '.so'
-    else:
-        return d.getVar('LIBNAME', True) + '.rlib'
-
-def link_args(d, bin):
-    linkargs = []
-    if bin:
-        rpaths = d.getVar('RUST_BIN_RPATH_FLAGS', False)
-    else:
-        rpaths = d.getVar('RUST_LIB_RPATH_FLAGS', False)
-        if d.getVar('CRATE_TYPE', True) == 'dylib':
-            linkargs.append('-soname')
-            linkargs.append(libfilename(d))
-    if len(rpaths):
-        linkargs.append(rpaths)
-    if len(linkargs):
-        return ' '.join(['-Wl,' + arg for arg in linkargs])
-    else:
-        return ''
-
-get_overlap_externs () {
-    externs=
-    for dep in ${OVERLAP_DEPS}; do
-        extern=$(ls ${STAGING_DIR_HOST}/${rustlibdir}/lib$dep-rs.{so,rlib} 2>/dev/null \
-                    | awk '{print $1}');
-        if [ -n "$extern" ]; then
-            externs="$externs --extern $dep=$extern"
-        else
-            echo "$dep in depends but no such library found in ${rustlibdir}!" >&2
-            exit 1
-        fi
-    done
-    echo "$externs"
-}
-
-do_configure () {
-}
-
-oe_runrustc () {
-	export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
-	bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@"
-	"${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@"
-}
-
-oe_compile_rust_lib () {
-    rm -rf ${LIBNAME}.{rlib,so}
-    local -a link_args
-    if [ -n '${@link_args(d, False)}' ]; then
-        link_args[0]='-C'
-        link_args[1]='link-args=${@link_args(d, False)}'
-    fi
-    oe_runrustc $(get_overlap_externs) \
-        "${link_args[@]}" \
-        ${LIB_SRC} \
-        -o ${@libfilename(d)} \
-        --crate-name=${CRATE_NAME} --crate-type=${CRATE_TYPE} \
-        "$@"
-}
-oe_compile_rust_lib[vardeps] += "get_overlap_externs"
-
-oe_compile_rust_bin () {
-    rm -rf ${BINNAME}
-    local -a link_args
-    if [ -n '${@link_args(d, True)}' ]; then
-        link_args[0]='-C'
-        link_args[1]='link-args=${@link_args(d, True)}'
-    fi
-    oe_runrustc $(get_overlap_externs) \
-        "${link_args[@]}" \
-        ${BIN_SRC} -o ${BINNAME} "$@"
-}
-oe_compile_rust_bin[vardeps] += "get_overlap_externs"
-
-oe_install_rust_lib () {
-    for lib in $(ls ${LIBNAME}.{so,rlib} 2>/dev/null); do
-        echo Installing $lib
-        install -D -m 755 $lib ${D}/${rustlibdest}/$lib
-    done
-}
-
-oe_install_rust_bin () {
-    echo Installing ${BINNAME}
-    install -D -m 755 ${BINNAME} ${D}/${rustbindest}/${BINNAME}
-}
-
-do_rust_bin_fixups() {
-    for f in `find ${PKGD} -name '*.so*'`; do
-        echo "Strip rust note: $f"
-        ${OBJCOPY} -R .note.rustc $f $f
-    done
-}
-PACKAGE_PREPROCESS_FUNCS += "do_rust_bin_fixups"
-
diff --git a/poky/meta/classes/rust-common.bbclass b/poky/meta/classes/rust-common.bbclass
deleted file mode 100644
index cb811ac..0000000
--- a/poky/meta/classes/rust-common.bbclass
+++ /dev/null
@@ -1,189 +0,0 @@
-inherit python3native
-
-# Common variables used by all Rust builds
-export rustlibdir = "${libdir}/rust"
-FILES:${PN} += "${rustlibdir}/*.so"
-FILES:${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta"
-FILES:${PN}-dbg += "${rustlibdir}/.debug"
-
-RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
-RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
-RUSTFLAGS += "${RUSTLIB} ${RUST_DEBUG_REMAP}"
-RUSTLIB_DEP ?= "libstd-rs"
-export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/rustlib"
-RUST_PANIC_STRATEGY ?= "unwind"
-
-# Native builds are not effected by TCLIBC. Without this, rust-native
-# thinks it's "target" (i.e. x86_64-linux) is a musl target.
-RUST_LIBC = "${TCLIBC}"
-RUST_LIBC:class-crosssdk = "glibc"
-RUST_LIBC:class-native = "glibc"
-
-def determine_libc(d, thing):
-    '''Determine which libc something should target'''
-
-    # BUILD is never musl, TARGET may be musl or glibc,
-    # HOST could be musl, but only if a compiler is built to be run on
-    # target in which case HOST_SYS != BUILD_SYS.
-    if thing == 'TARGET':
-        libc = d.getVar('RUST_LIBC')
-    elif thing == 'BUILD' and (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
-        libc = d.getVar('RUST_LIBC')
-    else:
-        libc = d.getVar('RUST_LIBC:class-native')
-
-    return libc
-
-def target_is_armv7(d):
-    '''Determine if target is armv7'''
-    # TUNE_FEATURES may include arm* even if the target is not arm
-    # in the case of *-native packages
-    if d.getVar('TARGET_ARCH') != 'arm':
-        return False
-
-    feat = d.getVar('TUNE_FEATURES')
-    feat = frozenset(feat.split())
-    mach_overrides = d.getVar('MACHINEOVERRIDES')
-    mach_overrides = frozenset(mach_overrides.split(':'))
-
-    v7=frozenset(['armv7a', 'armv7r', 'armv7m', 'armv7ve'])
-    if mach_overrides.isdisjoint(v7) and feat.isdisjoint(v7):
-        return False
-    else:
-        return True
-target_is_armv7[vardepvalue] = "${@target_is_armv7(d)}"
-
-# Responsible for taking Yocto triples and converting it to Rust triples
-def rust_base_triple(d, thing):
-    '''
-    Mangle bitbake's *_SYS into something that rust might support (see
-    rust/mk/cfg/* for a list)
-
-    Note that os is assumed to be some linux form
-    '''
-
-    # The llvm-target for armv7 is armv7-unknown-linux-gnueabihf
-    if thing == "TARGET" and target_is_armv7(d):
-        arch = "armv7"
-    else:
-        arch = oe.rust.arch_to_rust_arch(d.getVar('{}_ARCH'.format(thing)))
-
-    # All the Yocto targets are Linux and are 'unknown'
-    vendor = "-unknown"
-    os = d.getVar('{}_OS'.format(thing))
-    libc = determine_libc(d, thing)
-
-    # Prefix with a dash and convert glibc -> gnu
-    if libc == "glibc":
-        libc = "-gnu"
-    elif libc == "musl":
-        libc = "-musl"
-
-    # Don't double up musl (only appears to be the case on aarch64)
-    if os == "linux-musl":
-        if libc != "-musl":
-            bb.fatal("{}_OS was '{}' but TCLIBC was not 'musl'".format(thing, os))
-        os = "linux"
-
-    # This catches ARM targets and appends the necessary hard float bits
-    if os == "linux-gnueabi" or os == "linux-musleabi":
-        libc = bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
-    return arch + vendor + '-' + os + libc
-
-
-# In some cases uname and the toolchain differ on their idea of the arch name
-RUST_BUILD_ARCH = "${@oe.rust.arch_to_rust_arch(d.getVar('BUILD_ARCH'))}"
-
-# Naming explanation
-# Yocto
-# - BUILD_SYS - Yocto triple of the build environment
-# - HOST_SYS - What we're building for in Yocto
-# - TARGET_SYS - What we're building for in Yocto
-#
-# So when building '-native' packages BUILD_SYS == HOST_SYS == TARGET_SYS
-# When building packages for the image HOST_SYS == TARGET_SYS
-# This is a gross over simplification as there are other modes but
-# currently this is all that's supported.
-#
-# Rust
-# - TARGET - the system where the binary will run
-# - HOST - the system where the binary is being built
-#
-# Rust additionally will use two additional cases:
-# - undecorated (e.g. CC) - equivalent to TARGET
-# - triple suffix (e.g. CC:x86_64_unknown_linux_gnu) - both
-#   see: https://github.com/alexcrichton/gcc-rs
-# The way that Rust's internal triples and Yocto triples are mapped together
-# its likely best to not use the triple suffix due to potential confusion.
-
-RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}"
-RUST_BUILD_SYS[vardepvalue] = "${RUST_BUILD_SYS}"
-RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}"
-RUST_HOST_SYS[vardepvalue] = "${RUST_HOST_SYS}"
-RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}"
-RUST_TARGET_SYS[vardepvalue] = "${RUST_TARGET_SYS}"
-
-# wrappers to get around the fact that Rust needs a single
-# binary but Yocto's compiler and linker commands have
-# arguments. Technically the archiver is always one command but
-# this is necessary for builds that determine the prefix and then
-# use those commands based on the prefix.
-WRAPPER_DIR = "${WORKDIR}/wrapper"
-RUST_BUILD_CC = "${WRAPPER_DIR}/build-rust-cc"
-RUST_BUILD_CXX = "${WRAPPER_DIR}/build-rust-cxx"
-RUST_BUILD_CCLD = "${WRAPPER_DIR}/build-rust-ccld"
-RUST_BUILD_AR = "${WRAPPER_DIR}/build-rust-ar"
-RUST_TARGET_CC = "${WRAPPER_DIR}/target-rust-cc"
-RUST_TARGET_CXX = "${WRAPPER_DIR}/target-rust-cxx"
-RUST_TARGET_CCLD = "${WRAPPER_DIR}/target-rust-ccld"
-RUST_TARGET_AR = "${WRAPPER_DIR}/target-rust-ar"
-
-create_wrapper () {
-	file="$1"
-	shift
-
-	cat <<- EOF > "${file}"
-	#!/usr/bin/env python3
-	import os, sys
-	orig_binary = "$@"
-	binary = orig_binary.split()[0]
-	args = orig_binary.split() + sys.argv[1:]
-	os.execvp(binary, args)
-	EOF
-	chmod +x "${file}"
-}
-
-export WRAPPER_TARGET_CC = "${CC}"
-export WRAPPER_TARGET_CXX = "${CXX}"
-export WRAPPER_TARGET_CCLD = "${CCLD}"
-export WRAPPER_TARGET_LDFLAGS = "${LDFLAGS}"
-export WRAPPER_TARGET_AR = "${AR}"
-
-# compiler is used by gcc-rs
-# linker is used by rustc/cargo
-# archiver is used by the build of libstd-rs
-do_rust_create_wrappers () {
-	mkdir -p "${WRAPPER_DIR}"
-
-	# Yocto Build / Rust Host C compiler
-	create_wrapper "${RUST_BUILD_CC}" "${BUILD_CC}"
-	# Yocto Build / Rust Host C++ compiler
-	create_wrapper "${RUST_BUILD_CXX}" "${BUILD_CXX}"
-	# Yocto Build / Rust Host linker
-	create_wrapper "${RUST_BUILD_CCLD}" "${BUILD_CCLD}" "${BUILD_LDFLAGS}"
-	# Yocto Build / Rust Host archiver
-	create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}"
-
-	# Yocto Target / Rust Target C compiler
-	create_wrapper "${RUST_TARGET_CC}" "${WRAPPER_TARGET_CC}" "${WRAPPER_TARGET_LDFLAGS}"
-	# Yocto Target / Rust Target C++ compiler
-	create_wrapper "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_CXX}"
-	# Yocto Target / Rust Target linker
-	create_wrapper "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}"
-	# Yocto Target / Rust Target archiver
-	create_wrapper "${RUST_TARGET_AR}" "${WRAPPER_TARGET_AR}"
-
-}
-
-addtask rust_create_wrappers before do_configure after do_patch do_prepare_recipe_sysroot
-do_rust_create_wrappers[dirs] += "${WRAPPER_DIR}"
diff --git a/poky/meta/classes/rust-target-config.bbclass b/poky/meta/classes/rust-target-config.bbclass
deleted file mode 100644
index 87b7dee..0000000
--- a/poky/meta/classes/rust-target-config.bbclass
+++ /dev/null
@@ -1,374 +0,0 @@
-# Right now this is focused on arm-specific tune features.
-# We get away with this for now as one can only use x86-64 as the build host
-# (not arm).
-# Note that TUNE_FEATURES is _always_ refering to the target, so we really
-# don't want to use this for the host/build.
-def llvm_features_from_tune(d):
-    f = []
-    feat = d.getVar('TUNE_FEATURES')
-    if not feat:
-        return []
-    feat = frozenset(feat.split())
-
-    mach_overrides = d.getVar('MACHINEOVERRIDES')
-    mach_overrides = frozenset(mach_overrides.split(':'))
-
-    if 'vfpv4' in feat:
-        f.append("+vfp4")
-    if 'vfpv3' in feat:
-        f.append("+vfp3")
-    if 'vfpv3d16' in feat:
-        f.append("+d16")
-
-    if 'vfpv2' in feat or 'vfp' in feat:
-        f.append("+vfp2")
-
-    if 'neon' in feat:
-        f.append("+neon")
-
-    if 'mips32' in feat:
-        f.append("+mips32")
-
-    if 'mips32r2' in feat:
-        f.append("+mips32r2")
-
-    if target_is_armv7(d):
-        f.append('+v7')
-
-    if ('armv6' in mach_overrides) or ('armv6' in feat):
-        f.append("+v6")
-    if 'armv5te' in feat:
-        f.append("+strict-align")
-        f.append("+v5te")
-    elif 'armv5' in feat:
-        f.append("+strict-align")
-        f.append("+v5")
-
-    if ('armv4' in mach_overrides) or ('armv4' in feat):
-        f.append("+strict-align")
-
-    if 'dsp' in feat:
-        f.append("+dsp")
-
-    if 'thumb' in feat:
-        if d.getVar('ARM_THUMB_OPT') == "thumb":
-            if target_is_armv7(d):
-                f.append('+thumb2')
-            f.append("+thumb-mode")
-
-    if 'cortexa5' in feat:
-        f.append("+a5")
-    if 'cortexa7' in feat:
-        f.append("+a7")
-    if 'cortexa9' in feat:
-        f.append("+a9")
-    if 'cortexa15' in feat:
-        f.append("+a15")
-    if 'cortexa17' in feat:
-        f.append("+a17")
-    if ('riscv64' in feat) or ('riscv32' in feat):
-        f.append("+a,+c,+d,+f,+m")
-    return f
-llvm_features_from_tune[vardepvalue] = "${@llvm_features_from_tune(d)}"
-
-# TARGET_CC_ARCH changes from build/cross/target so it'll do the right thing
-# this should go away when https://github.com/rust-lang/rust/pull/31709 is
-# stable (1.9.0?)
-def llvm_features_from_cc_arch(d):
-    f = []
-    feat = d.getVar('TARGET_CC_ARCH')
-    if not feat:
-        return []
-    feat = frozenset(feat.split())
-
-    if '-mmmx' in feat:
-        f.append("+mmx")
-    if '-msse' in feat:
-        f.append("+sse")
-    if '-msse2' in feat:
-        f.append("+sse2")
-    if '-msse3' in feat:
-        f.append("+sse3")
-    if '-mssse3' in feat:
-        f.append("+ssse3")
-    if '-msse4.1' in feat:
-        f.append("+sse4.1")
-    if '-msse4.2' in feat:
-        f.append("+sse4.2")
-    if '-msse4a' in feat:
-        f.append("+sse4a")
-    if '-mavx' in feat:
-        f.append("+avx")
-    if '-mavx2' in feat:
-        f.append("+avx2")
-
-    return f
-
-def llvm_features_from_target_fpu(d):
-    # TARGET_FPU can be hard or soft. +soft-float tell llvm to use soft float
-    # ABI. There is no option for hard.
-
-    fpu = d.getVar('TARGET_FPU', True)
-    return ["+soft-float"] if fpu == "soft" else []
-
-def llvm_features(d):
-    return ','.join(llvm_features_from_tune(d) +
-                    llvm_features_from_cc_arch(d) +
-                    llvm_features_from_target_fpu(d))
-
-llvm_features[vardepvalue] = "${@llvm_features(d)}"
-
-## arm-unknown-linux-gnueabihf
-DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-TARGET_ENDIAN[arm-eabi] = "little"
-TARGET_POINTER_WIDTH[arm-eabi] = "32"
-TARGET_C_INT_WIDTH[arm-eabi] = "32"
-MAX_ATOMIC_WIDTH[arm-eabi] = "64"
-FEATURES[arm-eabi] = "+v6,+vfp2"
-
-## armv7-unknown-linux-gnueabihf
-DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-TARGET_ENDIAN[armv7-eabi] = "little"
-TARGET_POINTER_WIDTH[armv7-eabi] = "32"
-TARGET_C_INT_WIDTH[armv7-eabi] = "32"
-MAX_ATOMIC_WIDTH[armv7-eabi] = "64"
-FEATURES[armv7-eabi] = "+v7,+vfp2,+thumb2"
-
-## aarch64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[aarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
-TARGET_ENDIAN[aarch64] = "little"
-TARGET_POINTER_WIDTH[aarch64] = "64"
-TARGET_C_INT_WIDTH[aarch64] = "32"
-MAX_ATOMIC_WIDTH[aarch64] = "128"
-
-## x86_64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-TARGET_ENDIAN[x86_64] = "little"
-TARGET_POINTER_WIDTH[x86_64] = "64"
-TARGET_C_INT_WIDTH[x86_64] = "32"
-MAX_ATOMIC_WIDTH[x86_64] = "64"
-
-## x86_64-unknown-linux-gnux32
-DATA_LAYOUT[x86_64-x32] = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-TARGET_ENDIAN[x86_64-x32] = "little"
-TARGET_POINTER_WIDTH[x86_64-x32] = "32"
-TARGET_C_INT_WIDTH[x86_64-x32] = "32"
-MAX_ATOMIC_WIDTH[x86_64-x32] = "64"
-
-## i686-unknown-linux-{gnu, musl}
-DATA_LAYOUT[i686] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
-TARGET_ENDIAN[i686] = "little"
-TARGET_POINTER_WIDTH[i686] = "32"
-TARGET_C_INT_WIDTH[i686] = "32"
-MAX_ATOMIC_WIDTH[i686] = "64"
-
-## XXX: a bit of a hack so qemux86 builds, clone of i686-unknown-linux-{gnu, musl} above
-DATA_LAYOUT[i586] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
-TARGET_ENDIAN[i586] = "little"
-TARGET_POINTER_WIDTH[i586] = "32"
-TARGET_C_INT_WIDTH[i586] = "32"
-MAX_ATOMIC_WIDTH[i586] = "64"
-
-## mips-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mips] = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
-TARGET_ENDIAN[mips] = "big"
-TARGET_POINTER_WIDTH[mips] = "32"
-TARGET_C_INT_WIDTH[mips] = "32"
-MAX_ATOMIC_WIDTH[mips] = "32"
-
-## mipsel-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mipsel] = "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
-TARGET_ENDIAN[mipsel] = "little"
-TARGET_POINTER_WIDTH[mipsel] = "32"
-TARGET_C_INT_WIDTH[mipsel] = "32"
-MAX_ATOMIC_WIDTH[mipsel] = "32"
-
-## mips64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mips64] = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
-TARGET_ENDIAN[mips64] = "big"
-TARGET_POINTER_WIDTH[mips64] = "64"
-TARGET_C_INT_WIDTH[mips64] = "64"
-MAX_ATOMIC_WIDTH[mips64] = "64"
-
-## mips64el-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mips64el] = "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
-TARGET_ENDIAN[mips64el] = "little"
-TARGET_POINTER_WIDTH[mips64el] = "64"
-TARGET_C_INT_WIDTH[mips64el] = "64"
-MAX_ATOMIC_WIDTH[mips64el] = "64"
-
-## powerpc-unknown-linux-{gnu, musl}
-DATA_LAYOUT[powerpc] = "E-m:e-p:32:32-i64:64-n32"
-TARGET_ENDIAN[powerpc] = "big"
-TARGET_POINTER_WIDTH[powerpc] = "32"
-TARGET_C_INT_WIDTH[powerpc] = "32"
-MAX_ATOMIC_WIDTH[powerpc] = "32"
-
-## powerpc64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[powerpc64] = "E-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"
-TARGET_ENDIAN[powerpc64] = "big"
-TARGET_POINTER_WIDTH[powerpc64] = "64"
-TARGET_C_INT_WIDTH[powerpc64] = "64"
-MAX_ATOMIC_WIDTH[powerpc64] = "64"
-
-## powerpc64le-unknown-linux-{gnu, musl}
-DATA_LAYOUT[powerpc64le] = "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512"
-TARGET_ENDIAN[powerpc64le] = "little"
-TARGET_POINTER_WIDTH[powerpc64le] = "64"
-TARGET_C_INT_WIDTH[powerpc64le] = "64"
-MAX_ATOMIC_WIDTH[powerpc64le] = "64"
-
-## riscv32-unknown-linux-{gnu, musl}
-DATA_LAYOUT[riscv32] = "e-m:e-p:32:32-i64:64-n32-S128"
-TARGET_ENDIAN[riscv32] = "little"
-TARGET_POINTER_WIDTH[riscv32] = "32"
-TARGET_C_INT_WIDTH[riscv32] = "32"
-MAX_ATOMIC_WIDTH[riscv32] = "32"
-
-## riscv64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[riscv64] = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
-TARGET_ENDIAN[riscv64] = "little"
-TARGET_POINTER_WIDTH[riscv64] = "64"
-TARGET_C_INT_WIDTH[riscv64] = "64"
-MAX_ATOMIC_WIDTH[riscv64] = "64"
-
-# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something
-# rust's internals won't choke on.
-def arch_to_rust_target_arch(arch):
-    if arch == "i586" or arch == "i686":
-        return "x86"
-    elif arch == "mipsel":
-        return "mips"
-    elif arch == "mip64sel":
-        return "mips64"
-    elif arch == "armv7":
-        return "arm"
-    elif arch == "powerpc64le":
-        return "powerpc64"
-    else:
-        return arch
-
-# generates our target CPU value
-def llvm_cpu(d):
-    cpu = d.getVar('PACKAGE_ARCH')
-    target = d.getVar('TRANSLATED_TARGET_ARCH')
-
-    trans = {}
-    trans['corei7-64'] = "corei7"
-    trans['core2-32'] = "core2"
-    trans['x86-64'] = "x86-64"
-    trans['i686'] = "i686"
-    trans['i586'] = "i586"
-    trans['powerpc'] = "powerpc"
-    trans['mips64'] = "mips64"
-    trans['mips64el'] = "mips64"
-    trans['riscv64'] = "generic-rv64"
-    trans['riscv32'] = "generic-rv32"
-
-    if target in ["mips", "mipsel"]:
-        feat = frozenset(d.getVar('TUNE_FEATURES').split())
-        if "mips32r2" in feat:
-            trans['mipsel'] = "mips32r2"
-            trans['mips'] = "mips32r2"
-        elif "mips32" in feat:
-            trans['mipsel'] = "mips32"
-            trans['mips'] = "mips32"
-
-    try:
-        return trans[cpu]
-    except:
-        return trans.get(target, "generic")
-
-llvm_cpu[vardepvalue] = "${@llvm_cpu(d)}"
-
-def rust_gen_target(d, thing, wd, arch):
-    import json
-    sys = d.getVar('{}_SYS'.format(thing))
-    prefix = d.getVar('{}_PREFIX'.format(thing))
-
-    abi = None
-    cpu = "generic"
-    features = ""
-
-    if thing == "TARGET":
-        abi = d.getVar('ABIEXTENSION')
-        cpu = llvm_cpu(d)
-        if bb.data.inherits_class('native', d):
-            features = ','.join(llvm_features_from_cc_arch(d))
-        else:
-            features = llvm_features(d) or ""
-        # arm and armv7 have different targets in llvm
-        if arch == "arm" and target_is_armv7(d):
-            arch = 'armv7'
-
-    rust_arch = oe.rust.arch_to_rust_arch(arch)
-
-    if abi:
-        arch_abi = "{}-{}".format(rust_arch, abi)
-    else:
-        arch_abi = rust_arch
-
-    features = features or d.getVarFlag('FEATURES', arch_abi) or ""
-    features = features.strip()
-
-    llvm_target = d.getVar('RUST_TARGET_SYS')
-    if thing == "BUILD":
-        llvm_target = d.getVar('RUST_HOST_SYS')
-
-    # build tspec
-    tspec = {}
-    tspec['llvm-target'] = llvm_target
-    tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi)
-    tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch_abi))
-    tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)
-    tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
-    tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
-    tspec['arch'] = arch_to_rust_target_arch(rust_arch)
-    tspec['os'] = "linux"
-    if "musl" in tspec['llvm-target']:
-        tspec['env'] = "musl"
-    else:
-        tspec['env'] = "gnu"
-    if "riscv64" in tspec['llvm-target']:
-        tspec['llvm-abiname'] = "lp64d"
-    if "riscv32" in tspec['llvm-target']:
-        tspec['llvm-abiname'] = "ilp32d"
-    tspec['vendor'] = "unknown"
-    tspec['target-family'] = "unix"
-    tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix)
-    tspec['cpu'] = cpu
-    if features != "":
-        tspec['features'] = features
-    tspec['dynamic-linking'] = True
-    tspec['executables'] = True
-    tspec['linker-is-gnu'] = True
-    tspec['linker-flavor'] = "gcc"
-    tspec['has-rpath'] = True
-    tspec['has-elf-tls'] = True
-    tspec['position-independent-executables'] = True
-    tspec['panic-strategy'] = d.getVar("RUST_PANIC_STRATEGY")
-
-    # write out the target spec json file
-    with open(wd + sys + '.json', 'w') as f:
-        json.dump(tspec, f, indent=4)
-
-# These are accounted for in tmpdir path names so don't need to be in the task sig
-rust_gen_target[vardepsexclude] += "RUST_HOST_SYS RUST_TARGET_SYS ABIEXTENSION llvm_cpu"
-
-do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES"
-
-RUST_TARGETGENS = "BUILD"
-
-python do_rust_gen_targets () {
-    wd = d.getVar('WORKDIR') + '/targets/'
-    # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
-    rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH'))
-    if "HOST" in d.getVar("RUST_TARGETGENS"):
-        rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH'))
-    if "TARGET" in d.getVar("RUST_TARGETGENS"):
-        rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH'))
-}
-
-addtask rust_gen_targets after do_patch before do_compile
-do_rust_gen_targets[dirs] += "${WORKDIR}/targets"
-
diff --git a/poky/meta/classes/rust.bbclass b/poky/meta/classes/rust.bbclass
deleted file mode 100644
index 5c8938d..0000000
--- a/poky/meta/classes/rust.bbclass
+++ /dev/null
@@ -1,45 +0,0 @@
-inherit rust-common
-
-RUSTC = "rustc"
-
-RUSTC_ARCHFLAGS += "--target=${HOST_SYS} ${RUSTFLAGS}"
-
-def rust_base_dep(d):
-    # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to
-    # use rust instead of gcc
-    deps = ""
-    if not d.getVar('INHIBIT_DEFAULT_RUST_DEPS'):
-        if (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
-            deps += " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
-        else:
-            deps += " rust-native"
-    return deps
-
-DEPENDS:append = " ${@rust_base_dep(d)}"
-
-# BUILD_LDFLAGS
-# 	${STAGING_LIBDIR_NATIVE}
-# 	${STAGING_BASE_LIBDIR_NATIVE}
-# BUILDSDK_LDFLAGS
-# 	${STAGING_LIBDIR}
-# 	#{STAGING_DIR_HOST}
-# TARGET_LDFLAGS ?????
-#RUSTC_BUILD_LDFLAGS = "\
-#	--sysroot ${STAGING_DIR_NATIVE} \
-#	-L${STAGING_LIBDIR_NATIVE}	\
-#	-L${STAGING_BASE_LIBDIR_NATIVE}	\
-#"
-
-# XXX: for some reason bitbake sets BUILD_* & TARGET_* but uses the bare
-# variables for HOST. Alias things to make it easier for us.
-HOST_LDFLAGS  ?= "${LDFLAGS}"
-HOST_CFLAGS   ?= "${CFLAGS}"
-HOST_CXXFLAGS ?= "${CXXFLAGS}"
-HOST_CPPFLAGS ?= "${CPPFLAGS}"
-
-rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
-# Native sysroot standard library path
-rustlib_src="${prefix}/lib/${rustlib_suffix}"
-# Host sysroot standard library path
-rustlib="${libdir}/${rustlib_suffix}"
-rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib"
diff --git a/poky/meta/classes/sanity.bbclass b/poky/meta/classes/sanity.bbclass
deleted file mode 100644
index b1fac10..0000000
--- a/poky/meta/classes/sanity.bbclass
+++ /dev/null
@@ -1,1022 +0,0 @@
-#
-# Sanity check the users setup for common misconfigurations
-#
-
-SANITY_REQUIRED_UTILITIES ?= "patch diffstat git bzip2 tar \
-    gzip gawk chrpath wget cpio perl file which"
-
-def bblayers_conf_file(d):
-    return os.path.join(d.getVar('TOPDIR'), 'conf/bblayers.conf')
-
-def sanity_conf_read(fn):
-    with open(fn, 'r') as f:
-        lines = f.readlines()
-    return lines
-
-def sanity_conf_find_line(pattern, lines):
-    import re
-    return next(((index, line)
-        for index, line in enumerate(lines)
-        if re.search(pattern, line)), (None, None))
-
-def sanity_conf_update(fn, lines, version_var_name, new_version):
-    index, line = sanity_conf_find_line(r"^%s" % version_var_name, lines)
-    lines[index] = '%s = "%d"\n' % (version_var_name, new_version)
-    with open(fn, "w") as f:
-        f.write(''.join(lines))
-
-# Functions added to this variable MUST throw a NotImplementedError exception unless 
-# they successfully changed the config version in the config file. Exceptions
-# are used since exec_func doesn't handle return values.
-BBLAYERS_CONF_UPDATE_FUNCS += " \
-    conf/bblayers.conf:LCONF_VERSION:LAYER_CONF_VERSION:oecore_update_bblayers \
-    conf/local.conf:CONF_VERSION:LOCALCONF_VERSION:oecore_update_localconf \
-    conf/site.conf:SCONF_VERSION:SITE_CONF_VERSION:oecore_update_siteconf \
-"
-
-SANITY_DIFF_TOOL ?= "meld"
-
-SANITY_LOCALCONF_SAMPLE ?= "${COREBASE}/meta*/conf/local.conf.sample"
-python oecore_update_localconf() {
-    # Check we are using a valid local.conf
-    current_conf  = d.getVar('CONF_VERSION')
-    conf_version =  d.getVar('LOCALCONF_VERSION')
-
-    failmsg = """Your version of local.conf was generated from an older/newer version of 
-local.conf.sample and there have been updates made to this file. Please compare the two 
-files and merge any changes before continuing.
-
-Matching the version numbers will remove this message.
-
-\"${SANITY_DIFF_TOOL} conf/local.conf ${SANITY_LOCALCONF_SAMPLE}\" 
-
-is a good way to visualise the changes."""
-    failmsg = d.expand(failmsg)
-
-    raise NotImplementedError(failmsg)
-}
-
-SANITY_SITECONF_SAMPLE ?= "${COREBASE}/meta*/conf/site.conf.sample"
-python oecore_update_siteconf() {
-    # If we have a site.conf, check it's valid
-    current_sconf = d.getVar('SCONF_VERSION')
-    sconf_version = d.getVar('SITE_CONF_VERSION')
-
-    failmsg = """Your version of site.conf was generated from an older version of 
-site.conf.sample and there have been updates made to this file. Please compare the two 
-files and merge any changes before continuing.
-
-Matching the version numbers will remove this message.
-
-\"${SANITY_DIFF_TOOL} conf/site.conf ${SANITY_SITECONF_SAMPLE}\" 
-
-is a good way to visualise the changes."""
-    failmsg = d.expand(failmsg)
-
-    raise NotImplementedError(failmsg)
-}
-
-SANITY_BBLAYERCONF_SAMPLE ?= "${COREBASE}/meta*/conf/bblayers.conf.sample"
-python oecore_update_bblayers() {
-    # bblayers.conf is out of date, so see if we can resolve that
-
-    current_lconf = int(d.getVar('LCONF_VERSION'))
-    lconf_version = int(d.getVar('LAYER_CONF_VERSION'))
-
-    failmsg = """Your version of bblayers.conf has the wrong LCONF_VERSION (has ${LCONF_VERSION}, expecting ${LAYER_CONF_VERSION}).
-Please compare your file against bblayers.conf.sample and merge any changes before continuing.
-"${SANITY_DIFF_TOOL} conf/bblayers.conf ${SANITY_BBLAYERCONF_SAMPLE}" 
-
-is a good way to visualise the changes."""
-    failmsg = d.expand(failmsg)
-
-    if not current_lconf:
-        raise NotImplementedError(failmsg)
-
-    lines = []
-
-    if current_lconf < 4:
-        raise NotImplementedError(failmsg)
-
-    bblayers_fn = bblayers_conf_file(d)
-    lines = sanity_conf_read(bblayers_fn)
-
-    if current_lconf == 4 and lconf_version > 4:
-        topdir_var = '$' + '{TOPDIR}'
-        index, bbpath_line = sanity_conf_find_line('BBPATH', lines)
-        if bbpath_line:
-            start = bbpath_line.find('"')
-            if start != -1 and (len(bbpath_line) != (start + 1)):
-                if bbpath_line[start + 1] == '"':
-                    lines[index] = (bbpath_line[:start + 1] +
-                                    topdir_var + bbpath_line[start + 1:])
-                else:
-                    if not topdir_var in bbpath_line:
-                        lines[index] = (bbpath_line[:start + 1] +
-                                    topdir_var + ':' + bbpath_line[start + 1:])
-            else:
-                raise NotImplementedError(failmsg)
-        else:
-            index, bbfiles_line = sanity_conf_find_line('BBFILES', lines)
-            if bbfiles_line:
-                lines.insert(index, 'BBPATH = "' + topdir_var + '"\n')
-            else:
-                raise NotImplementedError(failmsg)
-
-        current_lconf += 1
-        sanity_conf_update(bblayers_fn, lines, 'LCONF_VERSION', current_lconf)
-        bb.note("Your conf/bblayers.conf has been automatically updated.")
-        return
-
-    elif current_lconf == 5 and lconf_version > 5:
-        # Null update, to avoid issues with people switching between poky and other distros
-        current_lconf = 6
-        sanity_conf_update(bblayers_fn, lines, 'LCONF_VERSION', current_lconf)
-        bb.note("Your conf/bblayers.conf has been automatically updated.")
-        return
-
-        status.addresult()
-
-    elif current_lconf == 6 and lconf_version > 6:
-        # Handle rename of meta-yocto -> meta-poky
-        # This marks the start of separate version numbers but code is needed in OE-Core
-        # for the migration, one last time.
-        layers = d.getVar('BBLAYERS').split()
-        layers = [ os.path.basename(path) for path in layers ]
-        if 'meta-yocto' in layers:
-            found = False
-            while True:
-                index, meta_yocto_line = sanity_conf_find_line(r'.*meta-yocto[\'"\s\n]', lines)
-                if meta_yocto_line:
-                    lines[index] = meta_yocto_line.replace('meta-yocto', 'meta-poky')
-                    found = True
-                else:
-                    break
-            if not found:
-                raise NotImplementedError(failmsg)
-            index, meta_yocto_line = sanity_conf_find_line('LCONF_VERSION.*\n', lines)
-            if meta_yocto_line:
-                lines[index] = 'POKY_BBLAYERS_CONF_VERSION = "1"\n'
-            else:
-                raise NotImplementedError(failmsg)
-            with open(bblayers_fn, "w") as f:
-                f.write(''.join(lines))
-            bb.note("Your conf/bblayers.conf has been automatically updated.")
-            return
-        current_lconf += 1
-        sanity_conf_update(bblayers_fn, lines, 'LCONF_VERSION', current_lconf)
-        bb.note("Your conf/bblayers.conf has been automatically updated.")
-        return
-
-    raise NotImplementedError(failmsg)
-}
-
-def raise_sanity_error(msg, d, network_error=False):
-    if d.getVar("SANITY_USE_EVENTS") == "1":
-        try:
-            bb.event.fire(bb.event.SanityCheckFailed(msg, network_error), d)
-        except TypeError:
-            bb.event.fire(bb.event.SanityCheckFailed(msg), d)
-        return
-
-    bb.fatal(""" OE-core's config sanity checker detected a potential misconfiguration.
-    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
-    Following is the list of potential problems / advisories:
-    
-    %s""" % msg)
-
-# Check a single tune for validity.
-def check_toolchain_tune(data, tune, multilib):
-    tune_errors = []
-    if not tune:
-        return "No tuning found for %s multilib." % multilib
-    localdata = bb.data.createCopy(data)
-    if multilib != "default":
-        # Apply the overrides so we can look at the details.
-        overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + multilib
-        localdata.setVar("OVERRIDES", overrides)
-    bb.debug(2, "Sanity-checking tuning '%s' (%s) features:" % (tune, multilib))
-    features = (localdata.getVar("TUNE_FEATURES:tune-%s" % tune) or "").split()
-    if not features:
-        return "Tuning '%s' has no defined features, and cannot be used." % tune
-    valid_tunes = localdata.getVarFlags('TUNEVALID') or {}
-    conflicts = localdata.getVarFlags('TUNECONFLICTS') or {}
-    # [doc] is the documentation for the variable, not a real feature
-    if 'doc' in valid_tunes:
-        del valid_tunes['doc']
-    if 'doc' in conflicts:
-        del conflicts['doc']
-    for feature in features:
-        if feature in conflicts:
-            for conflict in conflicts[feature].split():
-                if conflict in features:
-                    tune_errors.append("Feature '%s' conflicts with '%s'." %
-                        (feature, conflict))
-        if feature in valid_tunes:
-            bb.debug(2, "  %s: %s" % (feature, valid_tunes[feature]))
-        else:
-            tune_errors.append("Feature '%s' is not defined." % feature)
-    if tune_errors:
-        return "Tuning '%s' has the following errors:\n" % tune + '\n'.join(tune_errors)
-
-def check_toolchain(data):
-    tune_error_set = []
-    deftune = data.getVar("DEFAULTTUNE")
-    tune_errors = check_toolchain_tune(data, deftune, 'default')
-    if tune_errors:
-        tune_error_set.append(tune_errors)
-
-    multilibs = (data.getVar("MULTILIB_VARIANTS") or "").split()
-    global_multilibs = (data.getVar("MULTILIB_GLOBAL_VARIANTS") or "").split()
-
-    if multilibs:
-        seen_libs = []
-        seen_tunes = []
-        for lib in multilibs:
-            if lib in seen_libs:
-                tune_error_set.append("The multilib '%s' appears more than once." % lib)
-            else:
-                seen_libs.append(lib)
-            if not lib in global_multilibs:
-                tune_error_set.append("Multilib %s is not present in MULTILIB_GLOBAL_VARIANTS" % lib)
-            tune = data.getVar("DEFAULTTUNE:virtclass-multilib-%s" % lib)
-            if tune in seen_tunes:
-                tune_error_set.append("The tuning '%s' appears in more than one multilib." % tune)
-            else:
-                seen_libs.append(tune)
-            if tune == deftune:
-                tune_error_set.append("Multilib '%s' (%s) is also the default tuning." % (lib, deftune))
-            else:
-                tune_errors = check_toolchain_tune(data, tune, lib)
-            if tune_errors:
-                tune_error_set.append(tune_errors)
-    if tune_error_set:
-        return "Toolchain tunings invalid:\n" + '\n'.join(tune_error_set) + "\n"
-
-    return ""
-
-def check_conf_exists(fn, data):
-    bbpath = []
-    fn = data.expand(fn)
-    vbbpath = data.getVar("BBPATH", False)
-    if vbbpath:
-        bbpath += vbbpath.split(":")
-    for p in bbpath:
-        currname = os.path.join(data.expand(p), fn)
-        if os.access(currname, os.R_OK):
-            return True
-    return False
-
-def check_create_long_filename(filepath, pathname):
-    import string, random
-    testfile = os.path.join(filepath, ''.join(random.choice(string.ascii_letters) for x in range(200)))
-    try:
-        if not os.path.exists(filepath):
-            bb.utils.mkdirhier(filepath)
-        f = open(testfile, "w")
-        f.close()
-        os.remove(testfile)
-    except IOError as e:
-        import errno
-        err, strerror = e.args
-        if err == errno.ENAMETOOLONG:
-            return "Failed to create a file with a long name in %s. Please use a filesystem that does not unreasonably limit filename length.\n" % pathname
-        else:
-            return "Failed to create a file in %s: %s.\n" % (pathname, strerror)
-    except OSError as e:
-        errno, strerror = e.args
-        return "Failed to create %s directory in which to run long name sanity check: %s.\n" % (pathname, strerror)
-    return ""
-
-def check_path_length(filepath, pathname, limit):
-    if len(filepath) > limit:
-        return "The length of %s is longer than %s, this would cause unexpected errors, please use a shorter path.\n" % (pathname, limit)
-    return ""
-
-def get_filesystem_id(path):
-    import subprocess
-    try:
-        return subprocess.check_output(["stat", "-f", "-c", "%t", path]).decode('utf-8').strip()
-    except subprocess.CalledProcessError:
-        bb.warn("Can't get filesystem id of: %s" % path)
-        return None
-
-# Check that the path isn't located on nfs.
-def check_not_nfs(path, name):
-    # The nfs' filesystem id is 6969
-    if get_filesystem_id(path) == "6969":
-        return "The %s: %s can't be located on nfs.\n" % (name, path)
-    return ""
-
-# Check that the path is on a case-sensitive file system
-def check_case_sensitive(path, name):
-    import tempfile
-    with tempfile.NamedTemporaryFile(prefix='TmP', dir=path) as tmp_file:
-        if os.path.exists(tmp_file.name.lower()):
-            return "The %s (%s) can't be on a case-insensitive file system.\n" % (name, path)
-        return ""
-
-# Check that path isn't a broken symlink
-def check_symlink(lnk, data):
-    if os.path.islink(lnk) and not os.path.exists(lnk):
-        raise_sanity_error("%s is a broken symlink." % lnk, data)
-
-def check_connectivity(d):
-    # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable
-    # using the same syntax as for SRC_URI. If the variable is not set
-    # the check is skipped
-    test_uris = (d.getVar('CONNECTIVITY_CHECK_URIS') or "").split()
-    retval = ""
-
-    bbn = d.getVar('BB_NO_NETWORK')
-    if bbn not in (None, '0', '1'):
-        return 'BB_NO_NETWORK should be "0" or "1", but it is "%s"' % bbn
-
-    # Only check connectivity if network enabled and the
-    # CONNECTIVITY_CHECK_URIS are set
-    network_enabled = not (bbn == '1')
-    check_enabled = len(test_uris)
-    if check_enabled and network_enabled:
-        # Take a copy of the data store and unset MIRRORS and PREMIRRORS
-        data = bb.data.createCopy(d)
-        data.delVar('PREMIRRORS')
-        data.delVar('MIRRORS')
-        try:
-            fetcher = bb.fetch2.Fetch(test_uris, data)
-            fetcher.checkstatus()
-        except Exception as err:
-            # Allow the message to be configured so that users can be
-            # pointed to a support mechanism.
-            msg = data.getVar('CONNECTIVITY_CHECK_MSG') or ""
-            if len(msg) == 0:
-                msg = "%s.\n" % err
-                msg += "    Please ensure your host's network is configured correctly.\n"
-                msg += "    If your ISP or network is blocking the above URL,\n"
-                msg += "    try with another domain name, for example by setting:\n"
-                msg += "    CONNECTIVITY_CHECK_URIS = \"https://www.example.com/\""
-                msg += "    You could also set BB_NO_NETWORK = \"1\" to disable network\n"
-                msg += "    access if all required sources are on local disk.\n"
-            retval = msg
-
-    return retval
-
-def check_supported_distro(sanity_data):
-    from fnmatch import fnmatch
-
-    tested_distros = sanity_data.getVar('SANITY_TESTED_DISTROS')
-    if not tested_distros:
-        return
-
-    try:
-        distro = oe.lsb.distro_identifier()
-    except Exception:
-        distro = None
-
-    if not distro:
-        bb.warn('Host distribution could not be determined; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.')
-
-    for supported in [x.strip() for x in tested_distros.split('\\n')]:
-        if fnmatch(distro, supported):
-            return
-
-    bb.warn('Host distribution "%s" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.' % distro)
-
-# Checks we should only make if MACHINE is set correctly
-def check_sanity_validmachine(sanity_data):
-    messages = ""
-
-    # Check TUNE_ARCH is set
-    if sanity_data.getVar('TUNE_ARCH') == 'INVALID':
-        messages = messages + 'TUNE_ARCH is unset. Please ensure your MACHINE configuration includes a valid tune configuration file which will set this correctly.\n'
-
-    # Check TARGET_OS is set
-    if sanity_data.getVar('TARGET_OS') == 'INVALID':
-        messages = messages + 'Please set TARGET_OS directly, or choose a MACHINE or DISTRO that does so.\n'
-
-    # Check that we don't have duplicate entries in PACKAGE_ARCHS & that TUNE_PKGARCH is in PACKAGE_ARCHS
-    pkgarchs = sanity_data.getVar('PACKAGE_ARCHS')
-    tunepkg = sanity_data.getVar('TUNE_PKGARCH')
-    defaulttune = sanity_data.getVar('DEFAULTTUNE')
-    tunefound = False
-    seen = {}
-    dups = []
-
-    for pa in pkgarchs.split():
-        if seen.get(pa, 0) == 1:
-            dups.append(pa)
-        else:
-            seen[pa] = 1
-        if pa == tunepkg:
-            tunefound = True
-
-    if len(dups):
-        messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
-
-    if tunefound == False:
-        messages = messages + "Error, the PACKAGE_ARCHS variable (%s) for DEFAULTTUNE (%s) does not contain TUNE_PKGARCH (%s)." % (pkgarchs, defaulttune, tunepkg)
-
-    return messages
-
-# Patch before 2.7 can't handle all the features in git-style diffs.  Some
-# patches may incorrectly apply, and others won't apply at all.
-def check_patch_version(sanity_data):
-    import re, subprocess
-
-    try:
-        result = subprocess.check_output(["patch", "--version"], stderr=subprocess.STDOUT).decode('utf-8')
-        version = re.search(r"[0-9.]+", result.splitlines()[0]).group()
-        if bb.utils.vercmp_string_op(version, "2.7", "<"):
-            return "Your version of patch is older than 2.7 and has bugs which will break builds. Please install a newer version of patch.\n"
-        else:
-            return None
-    except subprocess.CalledProcessError as e:
-        return "Unable to execute patch --version, exit code %d:\n%s\n" % (e.returncode, e.output)
-
-# Glibc needs make 4.0 or later, we may as well match at this point
-def check_make_version(sanity_data):
-    import subprocess
-
-    try:
-        result = subprocess.check_output(['make', '--version'], stderr=subprocess.STDOUT).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        return "Unable to execute make --version, exit code %d\n%s\n" % (e.returncode, e.output)
-    version = result.split()[2]
-    if bb.utils.vercmp_string_op(version, "4.0", "<"):
-        return "Please install a make version of 4.0 or later.\n"
-
-    if bb.utils.vercmp_string_op(version, "4.2.1", "=="):
-        distro = oe.lsb.distro_identifier()
-        if "ubuntu" in distro or "debian" in distro or "linuxmint" in distro:
-            return None
-        return "make version 4.2.1 is known to have issues on Centos/OpenSUSE and other non-Ubuntu systems. Please use a buildtools-make-tarball or a newer version of make.\n"
-    return None
-
-
-# Check if we're running on WSL (Windows Subsystem for Linux).
-# WSLv1 is known not to work but WSLv2 should work properly as
-# long as the VHDX file is optimized often, let the user know
-# upfront.
-# More information on installing WSLv2 at:
-# https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
-def check_wsl(d):
-    with open("/proc/version", "r") as f:
-        verdata = f.readlines()
-    for l in verdata:
-        if "Microsoft" in l:
-            return "OpenEmbedded doesn't work under WSLv1, please upgrade to WSLv2 if you want to run builds on Windows"
-        elif "microsoft" in l:
-            bb.warn("You are running bitbake under WSLv2, this works properly but you should optimize your VHDX file eventually to avoid running out of storage space")
-    return None
-
-# Require at least gcc version 7.5.
-#
-# This can be fixed on CentOS-7 with devtoolset-6+
-# https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/
-#
-# A less invasive fix is with scripts/install-buildtools (or with user
-# built buildtools-extended-tarball)
-#
-def check_gcc_version(sanity_data):
-    import subprocess
-    
-    build_cc, version = oe.utils.get_host_compiler_version(sanity_data)
-    if build_cc.strip() == "gcc":
-        if bb.utils.vercmp_string_op(version, "7.5", "<"):
-            return "Your version of gcc is older than 7.5 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n"
-    return None
-
-# Tar version 1.24 and onwards handle overwriting symlinks correctly
-# but earlier versions do not; this needs to work properly for sstate
-# Version 1.28 is needed so opkg-build works correctly when reproducibile builds are enabled
-def check_tar_version(sanity_data):
-    import subprocess
-    try:
-        result = subprocess.check_output(["tar", "--version"], stderr=subprocess.STDOUT).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        return "Unable to execute tar --version, exit code %d\n%s\n" % (e.returncode, e.output)
-    version = result.split()[3]
-    if bb.utils.vercmp_string_op(version, "1.28", "<"):
-        return "Your version of tar is older than 1.28 and does not have the support needed to enable reproducible builds. Please install a newer version of tar (you could use the project's buildtools-tarball from our last release or use scripts/install-buildtools).\n"
-    return None
-
-# We use git parameters and functionality only found in 1.7.8 or later
-# The kernel tools assume git >= 1.8.3.1 (verified needed > 1.7.9.5) see #6162 
-# The git fetcher also had workarounds for git < 1.7.9.2 which we've dropped
-def check_git_version(sanity_data):
-    import subprocess
-    try:
-        result = subprocess.check_output(["git", "--version"], stderr=subprocess.DEVNULL).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        return "Unable to execute git --version, exit code %d\n%s\n" % (e.returncode, e.output)
-    version = result.split()[2]
-    if bb.utils.vercmp_string_op(version, "1.8.3.1", "<"):
-        return "Your version of git is older than 1.8.3.1 and has bugs which will break builds. Please install a newer version of git.\n"
-    return None
-
-# Check the required perl modules which may not be installed by default
-def check_perl_modules(sanity_data):
-    import subprocess
-    ret = ""
-    modules = ( "Text::ParseWords", "Thread::Queue", "Data::Dumper" )
-    errresult = ''
-    for m in modules:
-        try:
-            subprocess.check_output(["perl", "-e", "use %s" % m])
-        except subprocess.CalledProcessError as e:
-            errresult += bytes.decode(e.output)
-            ret += "%s " % m
-    if ret:
-        return "Required perl module(s) not found: %s\n\n%s\n" % (ret, errresult)
-    return None
-
-def sanity_check_conffiles(d):
-    funcs = d.getVar('BBLAYERS_CONF_UPDATE_FUNCS').split()
-    for func in funcs:
-        conffile, current_version, required_version, func = func.split(":")
-        if check_conf_exists(conffile, d) and d.getVar(current_version) is not None and \
-                d.getVar(current_version) != d.getVar(required_version):
-            try:
-                bb.build.exec_func(func, d)
-            except NotImplementedError as e:
-                bb.fatal(str(e))
-            d.setVar("BB_INVALIDCONF", True)
-
-def drop_v14_cross_builds(d):
-    import glob
-    indexes = glob.glob(d.expand("${SSTATE_MANIFESTS}/index-${BUILD_ARCH}_*"))
-    for i in indexes:
-        with open(i, "r") as f:
-            lines = f.readlines()
-            for l in reversed(lines):
-                try:
-                    (stamp, manifest, workdir) = l.split()
-                except ValueError:
-                    bb.fatal("Invalid line '%s' in sstate manifest '%s'" % (l, i))
-                for m in glob.glob(manifest + ".*"):
-                    if m.endswith(".postrm"):
-                        continue
-                    sstate_clean_manifest(m, d)
-                bb.utils.remove(stamp + "*")
-                bb.utils.remove(workdir, recurse = True)
-
-def sanity_handle_abichanges(status, d):
-    #
-    # Check the 'ABI' of TMPDIR
-    #
-    import subprocess
-
-    current_abi = d.getVar('OELAYOUT_ABI')
-    abifile = d.getVar('SANITY_ABIFILE')
-    if os.path.exists(abifile):
-        with open(abifile, "r") as f:
-            abi = f.read().strip()
-        if not abi.isdigit():
-            with open(abifile, "w") as f:
-                f.write(current_abi)
-        elif int(abi) <= 11 and current_abi == "12":
-            status.addresult("The layout of TMPDIR changed for Recipe Specific Sysroots.\nConversion doesn't make sense and this change will rebuild everything so please delete TMPDIR (%s).\n" % d.getVar("TMPDIR"))
-        elif int(abi) <= 13 and current_abi == "14":
-            status.addresult("TMPDIR changed to include path filtering from the pseudo database.\nIt is recommended to use a clean TMPDIR with the new pseudo path filtering so TMPDIR (%s) would need to be removed to continue.\n" % d.getVar("TMPDIR"))
-        elif int(abi) == 14 and current_abi == "15":
-            drop_v14_cross_builds(d)
-            with open(abifile, "w") as f:
-                f.write(current_abi)
-        elif (abi != current_abi):
-            # Code to convert from one ABI to another could go here if possible.
-            status.addresult("Error, TMPDIR has changed its layout version number (%s to %s) and you need to either rebuild, revert or adjust it at your own risk.\n" % (abi, current_abi))
-    else:
-        with open(abifile, "w") as f:
-            f.write(current_abi)
-
-def check_sanity_sstate_dir_change(sstate_dir, data):
-    # Sanity checks to be done when the value of SSTATE_DIR changes
-
-    # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
-    testmsg = ""
-    if sstate_dir != "":
-        testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
-        # If we don't have permissions to SSTATE_DIR, suggest the user set it as an SSTATE_MIRRORS
-        try:
-            err = testmsg.split(': ')[1].strip()
-            if err == "Permission denied.":
-                testmsg = testmsg + "You could try using %s in SSTATE_MIRRORS rather than as an SSTATE_CACHE.\n" % (sstate_dir)
-        except IndexError:
-            pass
-    return testmsg
-
-def check_sanity_version_change(status, d):
-    # Sanity checks to be done when SANITY_VERSION or NATIVELSBSTRING changes
-    # In other words, these tests run once in a given build directory and then 
-    # never again until the sanity version or host distrubution id/version changes.
-
-    # Check the python install is complete. Examples that are often removed in
-    # minimal installations: glib-2.0-natives requries # xml.parsers.expat and icu
-    # requires distutils.sysconfig.
-    try:
-        import xml.parsers.expat
-        import distutils.sysconfig
-    except ImportError as e:
-        status.addresult('Your Python 3 is not a full install. Please install the module %s (see the Getting Started guide for further information).\n' % e.name)
-
-    status.addresult(check_gcc_version(d))
-    status.addresult(check_make_version(d))
-    status.addresult(check_patch_version(d))
-    status.addresult(check_tar_version(d))
-    status.addresult(check_git_version(d))
-    status.addresult(check_perl_modules(d))
-    status.addresult(check_wsl(d))
-
-    missing = ""
-
-    if not check_app_exists("${MAKE}", d):
-        missing = missing + "GNU make,"
-
-    if not check_app_exists('${BUILD_CC}', d):
-        missing = missing + "C Compiler (%s)," % d.getVar("BUILD_CC")
-
-    if not check_app_exists('${BUILD_CXX}', d):
-        missing = missing + "C++ Compiler (%s)," % d.getVar("BUILD_CXX")
-
-    required_utilities = d.getVar('SANITY_REQUIRED_UTILITIES')
-
-    for util in required_utilities.split():
-        if not check_app_exists(util, d):
-            missing = missing + "%s," % util
-
-    if missing:
-        missing = missing.rstrip(',')
-        status.addresult("Please install the following missing utilities: %s\n" % missing)
-
-    assume_provided = d.getVar('ASSUME_PROVIDED').split()
-    # Check user doesn't have ASSUME_PROVIDED = instead of += in local.conf
-    if "diffstat-native" not in assume_provided:
-        status.addresult('Please use ASSUME_PROVIDED +=, not ASSUME_PROVIDED = in your local.conf\n')
-
-    # Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
-    import stat
-    tmpdir = d.getVar('TMPDIR')
-    status.addresult(check_create_long_filename(tmpdir, "TMPDIR"))
-    tmpdirmode = os.stat(tmpdir).st_mode
-    if (tmpdirmode & stat.S_ISGID):
-        status.addresult("TMPDIR is setgid, please don't build in a setgid directory")
-    if (tmpdirmode & stat.S_ISUID):
-        status.addresult("TMPDIR is setuid, please don't build in a setuid directory")
-
-    # Check that a user isn't building in a path in PSEUDO_IGNORE_PATHS
-    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
-    workdir = d.getVar('WORKDIR', expand=True)
-    for i in pseudoignorepaths:
-        if i and workdir.startswith(i):
-            status.addresult("You are building in a path included in PSEUDO_IGNORE_PATHS " + str(i) + " please locate the build outside this path.\n")
-
-    # Check if PSEUDO_IGNORE_PATHS and and paths under pseudo control overlap
-    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
-    pseudo_control_dir = "${D},${PKGD},${PKGDEST},${IMAGEROOTFS},${SDK_OUTPUT}"
-    pseudocontroldir = d.expand(pseudo_control_dir).split(",")
-    for i in pseudoignorepaths:
-        for j in pseudocontroldir:
-            if i and j:
-                if j.startswith(i):
-                    status.addresult("A path included in PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " overlap and this will break pseudo permission and ownership tracking. Please set the path " + str(j) + " to a different directory which does not overlap with pseudo controlled directories. \n")
-
-    # Some third-party software apparently relies on chmod etc. being suid root (!!)
-    import stat
-    suid_check_bins = "chown chmod mknod".split()
-    for bin_cmd in suid_check_bins:
-        bin_path = bb.utils.which(os.environ["PATH"], bin_cmd)
-        if bin_path:
-            bin_stat = os.stat(bin_path)
-            if bin_stat.st_uid == 0 and bin_stat.st_mode & stat.S_ISUID:
-                status.addresult('%s has the setuid bit set. This interferes with pseudo and may cause other issues that break the build process.\n' % bin_path)
-
-    # Check that we can fetch from various network transports
-    netcheck = check_connectivity(d)
-    status.addresult(netcheck)
-    if netcheck:
-        status.network_error = True
-
-    nolibs = d.getVar('NO32LIBS')
-    if not nolibs:
-        lib32path = '/lib'
-        if os.path.exists('/lib64') and ( os.path.islink('/lib64') or os.path.islink('/lib') ):
-           lib32path = '/lib32'
-
-        if os.path.exists('%s/libc.so.6' % lib32path) and not os.path.exists('/usr/include/gnu/stubs-32.h'):
-            status.addresult("You have a 32-bit libc, but no 32-bit headers.  You must install the 32-bit libc headers.\n")
-
-    bbpaths = d.getVar('BBPATH').split(":")
-    if ("." in bbpaths or "./" in bbpaths or "" in bbpaths):
-        status.addresult("BBPATH references the current directory, either through "    \
-                "an empty entry, a './' or a '.'.\n\t This is unsafe and means your "\
-                "layer configuration is adding empty elements to BBPATH.\n\t "\
-                "Please check your layer.conf files and other BBPATH "        \
-                "settings to remove the current working directory "           \
-                "references.\n" \
-                "Parsed BBPATH is" + str(bbpaths));
-
-    oes_bb_conf = d.getVar( 'OES_BITBAKE_CONF')
-    if not oes_bb_conf:
-        status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n')
-
-    # The length of TMPDIR can't be longer than 410
-    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
-
-    # Check that TMPDIR isn't located on nfs
-    status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
-
-    # Check for case-insensitive file systems (such as Linux in Docker on
-    # macOS with default HFS+ file system)
-    status.addresult(check_case_sensitive(tmpdir, "TMPDIR"))
-
-def sanity_check_locale(d):
-    """
-    Currently bitbake switches locale to en_US.UTF-8 so check that this locale actually exists.
-    """
-    import locale
-    try:
-        locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
-    except locale.Error:
-        raise_sanity_error("Your system needs to support the en_US.UTF-8 locale.", d)
-
-def check_sanity_everybuild(status, d):
-    import os, stat
-    # Sanity tests which test the users environment so need to run at each build (or are so cheap
-    # it makes sense to always run them.
-
-    if 0 == os.getuid():
-        raise_sanity_error("Do not use Bitbake as root.", d)
-
-    # Check the Python version, we now have a minimum of Python 3.6
-    import sys
-    if sys.hexversion < 0x030600F0:
-        status.addresult('The system requires at least Python 3.6 to run. Please update your Python interpreter.\n')
-
-    # Check the bitbake version meets minimum requirements
-    minversion = d.getVar('BB_MIN_VERSION')
-    if bb.utils.vercmp_string_op(bb.__version__, minversion, "<"):
-        status.addresult('Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__))
-
-    sanity_check_locale(d)
-
-    paths = d.getVar('PATH').split(":")
-    if "." in paths or "./" in paths or "" in paths:
-        status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n")
-
-    #Check if bitbake is present in PATH environment variable
-    bb_check = bb.utils.which(d.getVar('PATH'), 'bitbake')
-    if not bb_check:
-        bb.warn("bitbake binary is not found in PATH, did you source the script?")
-
-    # Check whether 'inherit' directive is found (used for a class to inherit)
-    # in conf file it's supposed to be uppercase INHERIT
-    inherit = d.getVar('inherit')
-    if inherit:
-        status.addresult("Please don't use inherit directive in your local.conf. The directive is supposed to be used in classes and recipes only to inherit of bbclasses. Here INHERIT should be used.\n")
-
-    # Check that the DISTRO is valid, if set
-    # need to take into account DISTRO renaming DISTRO
-    distro = d.getVar('DISTRO')
-    if distro and distro != "nodistro":
-        if not ( check_conf_exists("conf/distro/${DISTRO}.conf", d) or check_conf_exists("conf/distro/include/${DISTRO}.inc", d) ):
-            status.addresult("DISTRO '%s' not found. Please set a valid DISTRO in your local.conf\n" % d.getVar("DISTRO"))
-
-    # Check that these variables don't use tilde-expansion as we don't do that
-    for v in ("TMPDIR", "DL_DIR", "SSTATE_DIR"):
-        if d.getVar(v).startswith("~"):
-            status.addresult("%s uses ~ but Bitbake will not expand this, use an absolute path or variables." % v)
-
-    # Check that DL_DIR is set, exists and is writable. In theory, we should never even hit the check if DL_DIR isn't 
-    # set, since so much relies on it being set.
-    dldir = d.getVar('DL_DIR')
-    if not dldir:
-        status.addresult("DL_DIR is not set. Your environment is misconfigured, check that DL_DIR is set, and if the directory exists, that it is writable. \n")
-    if os.path.exists(dldir) and not os.access(dldir, os.W_OK):
-        status.addresult("DL_DIR: %s exists but you do not appear to have write access to it. \n" % dldir)
-    check_symlink(dldir, d)
-
-    # Check that the MACHINE is valid, if it is set
-    machinevalid = True
-    if d.getVar('MACHINE'):
-        if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
-            status.addresult('MACHINE=%s is invalid. Please set a valid MACHINE in your local.conf, environment or other configuration file.\n' % (d.getVar('MACHINE')))
-            machinevalid = False
-        else:
-            status.addresult(check_sanity_validmachine(d))
-    else:
-        status.addresult('Please set a MACHINE in your local.conf or environment\n')
-        machinevalid = False
-    if machinevalid:
-        status.addresult(check_toolchain(d))
-
-    # Check that the SDKMACHINE is valid, if it is set
-    if d.getVar('SDKMACHINE'):
-        if not check_conf_exists("conf/machine-sdk/${SDKMACHINE}.conf", d):
-            status.addresult('Specified SDKMACHINE value is not valid\n')
-        elif d.getVar('SDK_ARCH', False) == "${BUILD_ARCH}":
-            status.addresult('SDKMACHINE is set, but SDK_ARCH has not been changed as a result - SDKMACHINE may have been set too late (e.g. in the distro configuration)\n')
-
-    # If SDK_VENDOR looks like "-my-sdk" then the triples are badly formed so fail early
-    sdkvendor = d.getVar("SDK_VENDOR")
-    if not (sdkvendor.startswith("-") and sdkvendor.count("-") == 1):
-        status.addresult("SDK_VENDOR should be of the form '-foosdk' with a single dash; found '%s'\n" % sdkvendor)
-
-    check_supported_distro(d)
-
-    omask = os.umask(0o022)
-    if omask & 0o755:
-        status.addresult("Please use a umask which allows a+rx and u+rwx\n")
-    os.umask(omask)
-
-    if d.getVar('TARGET_ARCH') == "arm":
-        # This path is no longer user-readable in modern (very recent) Linux
-        try:
-            if os.path.exists("/proc/sys/vm/mmap_min_addr"):
-                f = open("/proc/sys/vm/mmap_min_addr", "r")
-                try:
-                    if (int(f.read().strip()) > 65536):
-                        status.addresult("/proc/sys/vm/mmap_min_addr is not <= 65536. This will cause problems with qemu so please fix the value (as root).\n\nTo fix this in later reboots, set vm.mmap_min_addr = 65536 in /etc/sysctl.conf.\n")
-                finally:
-                    f.close()
-        except:
-            pass
-
-    for checkdir in ['COREBASE', 'TMPDIR']:
-        val = d.getVar(checkdir)
-        if val.find('..') != -1:
-            status.addresult("Error, you have '..' in your %s directory path. Please ensure the variable contains an absolute path as this can break some recipe builds in obtuse ways." % checkdir)
-        if val.find('+') != -1:
-            status.addresult("Error, you have an invalid character (+) in your %s directory path. Please move the installation to a directory which doesn't include any + characters." % checkdir)
-        if val.find('@') != -1:
-            status.addresult("Error, you have an invalid character (@) in your %s directory path. Please move the installation to a directory which doesn't include any @ characters." % checkdir)
-        if val.find(' ') != -1:
-            status.addresult("Error, you have a space in your %s directory path. Please move the installation to a directory which doesn't include a space since autotools doesn't support this." % checkdir)
-        if val.find('%') != -1:
-            status.addresult("Error, you have an invalid character (%) in your %s directory path which causes problems with python string formatting. Please move the installation to a directory which doesn't include any % characters." % checkdir)
-
-    # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS
-    import re
-    mirror_vars = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']
-    protocols = ['http', 'ftp', 'file', 'https', \
-                 'git', 'gitsm', 'hg', 'osc', 'p4', 'svn', \
-                 'bzr', 'cvs', 'npm', 'sftp', 'ssh', 's3', 'az', 'ftps']
-    for mirror_var in mirror_vars:
-        mirrors = (d.getVar(mirror_var) or '').replace('\\n', ' ').split()
-
-        # Split into pairs
-        if len(mirrors) % 2 != 0:
-            bb.warn('Invalid mirror variable value for %s: %s, should contain paired members.' % (mirror_var, str(mirrors)))
-            continue
-        mirrors = list(zip(*[iter(mirrors)]*2))
-
-        for mirror_entry in mirrors:
-            pattern, mirror = mirror_entry
-
-            decoded = bb.fetch2.decodeurl(pattern)
-            try:
-                pattern_scheme = re.compile(decoded[0])
-            except re.error as exc:
-                bb.warn('Invalid scheme regex (%s) in %s; %s' % (pattern, mirror_var, mirror_entry))
-                continue
-
-            if not any(pattern_scheme.match(protocol) for protocol in protocols):
-                bb.warn('Invalid protocol (%s) in %s: %s' % (decoded[0], mirror_var, mirror_entry))
-                continue
-
-            if not any(mirror.startswith(protocol + '://') for protocol in protocols):
-                bb.warn('Invalid protocol in %s: %s' % (mirror_var, mirror_entry))
-                continue
-
-            if mirror.startswith('file://'):
-                import urllib
-                check_symlink(urllib.parse.urlparse(mirror).path, d)
-                # SSTATE_MIRROR ends with a /PATH string
-                if mirror.endswith('/PATH'):
-                    # remove /PATH$ from SSTATE_MIRROR to get a working
-                    # base directory path
-                    mirror_base = urllib.parse.urlparse(mirror[:-1*len('/PATH')]).path
-                    check_symlink(mirror_base, d)
-
-    # Check sstate mirrors aren't being used with a local hash server and no remote
-    hashserv = d.getVar("BB_HASHSERVE")
-    if d.getVar("SSTATE_MIRRORS") and hashserv and hashserv.startswith("unix://") and not d.getVar("BB_HASHSERVE_UPSTREAM"):
-        bb.warn("You are using a local hash equivalence server but have configured an sstate mirror. This will likely mean no sstate will match from the mirror. You may wish to disable the hash equivalence use (BB_HASHSERVE), or use a hash equivalence server alongside the sstate mirror.")
-
-    # Check that TMPDIR hasn't changed location since the last time we were run
-    tmpdir = d.getVar('TMPDIR')
-    checkfile = os.path.join(tmpdir, "saved_tmpdir")
-    if os.path.exists(checkfile):
-        with open(checkfile, "r") as f:
-            saved_tmpdir = f.read().strip()
-            if (saved_tmpdir != tmpdir):
-                status.addresult("Error, TMPDIR has changed location. You need to either move it back to %s or delete it and rebuild\n" % saved_tmpdir)
-    else:
-        bb.utils.mkdirhier(tmpdir)
-        # Remove setuid, setgid and sticky bits from TMPDIR
-        try:
-            os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISUID)
-            os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISGID)
-            os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISVTX)
-        except OSError as exc:
-            bb.warn("Unable to chmod TMPDIR: %s" % exc)
-        with open(checkfile, "w") as f:
-            f.write(tmpdir)
-
-    # If /bin/sh is a symlink, check that it points to dash or bash
-    if os.path.islink('/bin/sh'):
-        real_sh = os.path.realpath('/bin/sh')
-        # Due to update-alternatives, the shell name may take various
-        # forms, such as /bin/dash, bin/bash, /bin/bash.bash ...
-        if '/dash' not in real_sh and '/bash' not in real_sh:
-            status.addresult("Error, /bin/sh links to %s, must be dash or bash\n" % real_sh)
-
-def check_sanity(sanity_data):
-    class SanityStatus(object):
-        def __init__(self):
-            self.messages = ""
-            self.network_error = False
-
-        def addresult(self, message):
-            if message:
-                self.messages = self.messages + message
-
-    status = SanityStatus()
-
-    tmpdir = sanity_data.getVar('TMPDIR')
-    sstate_dir = sanity_data.getVar('SSTATE_DIR')
-
-    check_symlink(sstate_dir, sanity_data)
-
-    # Check saved sanity info
-    last_sanity_version = 0
-    last_tmpdir = ""
-    last_sstate_dir = ""
-    last_nativelsbstr = ""
-    sanityverfile = sanity_data.expand("${TOPDIR}/cache/sanity_info")
-    if os.path.exists(sanityverfile):
-        with open(sanityverfile, 'r') as f:
-            for line in f:
-                if line.startswith('SANITY_VERSION'):
-                    last_sanity_version = int(line.split()[1])
-                if line.startswith('TMPDIR'):
-                    last_tmpdir = line.split()[1]
-                if line.startswith('SSTATE_DIR'):
-                    last_sstate_dir = line.split()[1]
-                if line.startswith('NATIVELSBSTRING'):
-                    last_nativelsbstr = line.split()[1]
-
-    check_sanity_everybuild(status, sanity_data)
-    
-    sanity_version = int(sanity_data.getVar('SANITY_VERSION') or 1)
-    network_error = False
-    # NATIVELSBSTRING var may have been overridden with "universal", so
-    # get actual host distribution id and version
-    nativelsbstr = lsb_distro_identifier(sanity_data)
-    if last_sanity_version < sanity_version or last_nativelsbstr != nativelsbstr: 
-        check_sanity_version_change(status, sanity_data)
-        status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
-    else: 
-        if last_sstate_dir != sstate_dir:
-            status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
-
-    if os.path.exists(os.path.dirname(sanityverfile)) and not status.messages:
-        with open(sanityverfile, 'w') as f:
-            f.write("SANITY_VERSION %s\n" % sanity_version) 
-            f.write("TMPDIR %s\n" % tmpdir) 
-            f.write("SSTATE_DIR %s\n" % sstate_dir) 
-            f.write("NATIVELSBSTRING %s\n" % nativelsbstr) 
-
-    sanity_handle_abichanges(status, sanity_data)
-
-    if status.messages != "":
-        raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error)
-
-# Create a copy of the datastore and finalise it to ensure appends and 
-# overrides are set - the datastore has yet to be finalised at ConfigParsed
-def copy_data(e):
-    sanity_data = bb.data.createCopy(e.data)
-    sanity_data.finalize()
-    return sanity_data
-
-addhandler config_reparse_eventhandler
-config_reparse_eventhandler[eventmask] = "bb.event.ConfigParsed"
-python config_reparse_eventhandler() {
-    sanity_check_conffiles(e.data)
-}
-
-addhandler check_sanity_eventhandler
-check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
-python check_sanity_eventhandler() {
-    if bb.event.getName(e) == "SanityCheck":
-        sanity_data = copy_data(e)
-        check_sanity(sanity_data)
-        if e.generateevents:
-            sanity_data.setVar("SANITY_USE_EVENTS", "1")
-        bb.event.fire(bb.event.SanityCheckPassed(), e.data)
-    elif bb.event.getName(e) == "NetworkTest":
-        sanity_data = copy_data(e)
-        if e.generateevents:
-            sanity_data.setVar("SANITY_USE_EVENTS", "1")
-        bb.event.fire(bb.event.NetworkTestFailed() if check_connectivity(sanity_data) else bb.event.NetworkTestPassed(), e.data)
-
-    return
-}
diff --git a/poky/meta/classes/scons.bbclass b/poky/meta/classes/scons.bbclass
deleted file mode 100644
index 80f8382..0000000
--- a/poky/meta/classes/scons.bbclass
+++ /dev/null
@@ -1,28 +0,0 @@
-inherit python3native
-
-DEPENDS += "python3-scons-native"
-
-EXTRA_OESCONS ?= ""
-
-do_configure() {
-	if [ -n "${CONFIGURESTAMPFILE}" -a "${S}" = "${B}" ]; then
-		if [ -e "${CONFIGURESTAMPFILE}" -a "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ]; then
-			${STAGING_BINDIR_NATIVE}/scons --directory=${S} --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS}
-		fi
-
-		mkdir -p `dirname ${CONFIGURESTAMPFILE}`
-		echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
-	fi
-}
-
-scons_do_compile() {
-	${STAGING_BINDIR_NATIVE}/scons --directory=${S} ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \
-	die "scons build execution failed."
-}
-
-scons_do_install() {
-	${STAGING_BINDIR_NATIVE}/scons --directory=${S} install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} install || \
-	die "scons install execution failed."
-}
-
-EXPORT_FUNCTIONS do_compile do_install
diff --git a/poky/meta/classes/setuptools3-base.bbclass b/poky/meta/classes/setuptools3-base.bbclass
deleted file mode 100644
index 15abe1d..0000000
--- a/poky/meta/classes/setuptools3-base.bbclass
+++ /dev/null
@@ -1,31 +0,0 @@
-DEPENDS:append:class-target = " ${PYTHON_PN}-native ${PYTHON_PN}"
-DEPENDS:append:class-nativesdk = " ${PYTHON_PN}-native ${PYTHON_PN}"
-RDEPENDS:${PN}:append:class-target = " ${PYTHON_PN}-core"
-
-export STAGING_INCDIR
-export STAGING_LIBDIR
-
-# LDSHARED is the ld *command* used to create shared library
-export LDSHARED  = "${CCLD} -shared"
-# LDXXSHARED is the ld *command* used to create shared library of C++
-# objects
-export LDCXXSHARED  = "${CXX} -shared"
-# CCSHARED are the C *flags* used to create objects to go into a shared
-# library (module)
-export CCSHARED  = "-fPIC -DPIC"
-# LINKFORSHARED are the flags passed to the $(CC) command that links
-# the python executable
-export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic"
-
-FILES:${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*"
-
-FILES:${PN}-staticdev += "\
-  ${PYTHON_SITEPACKAGES_DIR}/*.a \
-"
-FILES:${PN}-dev += "\
-  ${datadir}/pkgconfig \
-  ${libdir}/pkgconfig \
-  ${PYTHON_SITEPACKAGES_DIR}/*.la \
-"
-inherit python3native python3targetconfig
-
diff --git a/poky/meta/classes/setuptools3.bbclass b/poky/meta/classes/setuptools3.bbclass
deleted file mode 100644
index 66c9466..0000000
--- a/poky/meta/classes/setuptools3.bbclass
+++ /dev/null
@@ -1,32 +0,0 @@
-inherit setuptools3-base python_pep517
-
-DEPENDS += "python3-setuptools-native python3-wheel-native"
-
-SETUPTOOLS_BUILD_ARGS ?= ""
-
-SETUPTOOLS_SETUP_PATH ?= "${S}"
-
-setuptools3_do_configure() {
-    :
-}
-
-setuptools3_do_compile() {
-        cd ${SETUPTOOLS_SETUP_PATH}
-        NO_FETCH_BUILD=1 \
-        STAGING_INCDIR=${STAGING_INCDIR} \
-        STAGING_LIBDIR=${STAGING_LIBDIR} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
-        bdist_wheel --verbose --dist-dir ${PEP517_WHEEL_PATH} ${SETUPTOOLS_BUILD_ARGS} || \
-        bbfatal_log "'${PYTHON_PN} setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed."
-}
-setuptools3_do_compile[vardepsexclude] = "MACHINE"
-do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
-
-# This could be removed in the future but some recipes in meta-oe still use it
-setuptools3_do_install() {
-        python_pep517_do_install
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
-
-export LDSHARED="${CCLD} -shared"
diff --git a/poky/meta/classes/setuptools3_legacy.bbclass b/poky/meta/classes/setuptools3_legacy.bbclass
deleted file mode 100644
index 5a99daa..0000000
--- a/poky/meta/classes/setuptools3_legacy.bbclass
+++ /dev/null
@@ -1,78 +0,0 @@
-# This class is for packages which use the deprecated setuptools behaviour,
-# specifically custom install tasks which don't work correctly with bdist_wheel.
-# This behaviour is deprecated in setuptools[1] and won't work in the future, so
-# all users of this should consider their options: pure Python modules can use a
-# modern Python tool such as build[2], or packages which are doing more (such as
-# installing init scripts) should use a fully-featured build system such as Meson.
-#
-# [1] https://setuptools.pypa.io/en/latest/history.html#id142
-# [2] https://pypi.org/project/build/
-
-inherit setuptools3-base
-
-B = "${WORKDIR}/build"
-
-SETUPTOOLS_BUILD_ARGS ?= ""
-SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \
-    --prefix=${prefix} \
-    --install-lib=${PYTHON_SITEPACKAGES_DIR} \
-    --install-data=${datadir}"
-
-SETUPTOOLS_PYTHON = "python3"
-SETUPTOOLS_PYTHON:class-native = "nativepython3"
-
-SETUPTOOLS_SETUP_PATH ?= "${S}"
-
-setuptools3_legacy_do_configure() {
-    :
-}
-
-setuptools3_legacy_do_compile() {
-        cd ${SETUPTOOLS_SETUP_PATH}
-        NO_FETCH_BUILD=1 \
-        STAGING_INCDIR=${STAGING_INCDIR} \
-        STAGING_LIBDIR=${STAGING_LIBDIR} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
-        build --build-base=${B} ${SETUPTOOLS_BUILD_ARGS} || \
-        bbfatal_log "'${PYTHON_PN} setup.py build ${SETUPTOOLS_BUILD_ARGS}' execution failed."
-}
-setuptools3_legacy_do_compile[vardepsexclude] = "MACHINE"
-
-setuptools3_legacy_do_install() {
-        cd ${SETUPTOOLS_SETUP_PATH}
-        install -d ${D}${PYTHON_SITEPACKAGES_DIR}
-        STAGING_INCDIR=${STAGING_INCDIR} \
-        STAGING_LIBDIR=${STAGING_LIBDIR} \
-        PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
-        build --build-base=${B} install --skip-build ${SETUPTOOLS_INSTALL_ARGS} || \
-        bbfatal_log "'${PYTHON_PN} setup.py install ${SETUPTOOLS_INSTALL_ARGS}' execution failed."
-
-        # support filenames with *spaces*
-        find ${D} -name "*.py" -exec grep -q ${D} {} \; \
-                               -exec sed -i -e s:${D}::g {} \;
-
-        for i in ${D}${bindir}/* ${D}${sbindir}/*; do
-            if [ -f "$i" ]; then
-                sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${SETUPTOOLS_PYTHON}:g $i
-                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
-            fi
-        done
-
-        rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
-
-        #
-        # FIXME: Bandaid against wrong datadir computation
-        #
-        if [ -e ${D}${datadir}/share ]; then
-            mv -f ${D}${datadir}/share/* ${D}${datadir}/
-            rmdir ${D}${datadir}/share
-        fi
-}
-setuptools3_legacy_do_install[vardepsexclude] = "MACHINE"
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
-
-export LDSHARED="${CCLD} -shared"
-DEPENDS += "python3-setuptools-native"
-
diff --git a/poky/meta/classes/sign_ipk.bbclass b/poky/meta/classes/sign_ipk.bbclass
index e5057b7..51c24b3 100644
--- a/poky/meta/classes/sign_ipk.bbclass
+++ b/poky/meta/classes/sign_ipk.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Class for generating signed IPK packages.
 #
 # Configuration variables used by this class:
diff --git a/poky/meta/classes/sign_package_feed.bbclass b/poky/meta/classes/sign_package_feed.bbclass
index f1504c2..e9d6647 100644
--- a/poky/meta/classes/sign_package_feed.bbclass
+++ b/poky/meta/classes/sign_package_feed.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Class for signing package feeds
 #
 # Related configuration variables that will be used after this class is
diff --git a/poky/meta/classes/sign_rpm.bbclass b/poky/meta/classes/sign_rpm.bbclass
index 73a55a5..ee0c480 100644
--- a/poky/meta/classes/sign_rpm.bbclass
+++ b/poky/meta/classes/sign_rpm.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Class for generating signed RPM packages.
 #
 # Configuration variables used by this class:
diff --git a/poky/meta/classes/siteconfig.bbclass b/poky/meta/classes/siteconfig.bbclass
index 0cfa5a6..953cafd 100644
--- a/poky/meta/classes/siteconfig.bbclass
+++ b/poky/meta/classes/siteconfig.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 python siteconfig_do_siteconfig () {
     shared_state = sstate_state_fromvars(d)
     if shared_state['task'] != 'populate_sysroot':
diff --git a/poky/meta/classes/siteinfo.bbclass b/poky/meta/classes/siteinfo.bbclass
deleted file mode 100644
index 3555d5a..0000000
--- a/poky/meta/classes/siteinfo.bbclass
+++ /dev/null
@@ -1,226 +0,0 @@
-# This class exists to provide information about the targets that
-# may be needed by other classes and/or recipes. If you add a new
-# target this will probably need to be updated.
-
-#
-# Returns information about 'what' for the named target 'target'
-# where 'target' == "<arch>-<os>"
-#
-# 'what' can be one of
-# * target: Returns the target name ("<arch>-<os>")
-# * endianness: Return "be" for big endian targets, "le" for little endian
-# * bits: Returns the bit size of the target, either "32" or "64"
-# * libc: Returns the name of the c library used by the target
-#
-# It is an error for the target not to exist.
-# If 'what' doesn't exist then an empty value is returned
-#
-def siteinfo_data_for_machine(arch, os, d):
-    archinfo = {
-        "allarch": "endian-little bit-32", # bogus, but better than special-casing the checks below for allarch
-        "aarch64": "endian-little bit-64 arm-common arm-64",
-        "aarch64_be": "endian-big bit-64 arm-common arm-64",
-        "arc": "endian-little bit-32 arc-common",
-        "arceb": "endian-big bit-32 arc-common",
-        "arm": "endian-little bit-32 arm-common arm-32",
-        "armeb": "endian-big bit-32 arm-common arm-32",
-        "avr32": "endian-big bit-32 avr32-common",
-        "bfin": "endian-little bit-32 bfin-common",
-        "epiphany": "endian-little bit-32",
-        "i386": "endian-little bit-32 ix86-common",
-        "i486": "endian-little bit-32 ix86-common",
-        "i586": "endian-little bit-32 ix86-common",
-        "i686": "endian-little bit-32 ix86-common",
-        "ia64": "endian-little bit-64",
-        "lm32": "endian-big bit-32",
-        "m68k": "endian-big bit-32",
-        "microblaze": "endian-big bit-32 microblaze-common",
-        "microblazeel": "endian-little bit-32 microblaze-common",
-        "mips": "endian-big bit-32 mips-common",
-        "mips64": "endian-big bit-64 mips-common",
-        "mips64el": "endian-little bit-64 mips-common",
-        "mipsisa64r6": "endian-big bit-64 mips-common",
-        "mipsisa64r6el": "endian-little bit-64 mips-common",
-        "mipsel": "endian-little bit-32 mips-common",
-        "mipsisa32r6": "endian-big bit-32 mips-common",
-        "mipsisa32r6el": "endian-little bit-32 mips-common",
-        "powerpc": "endian-big bit-32 powerpc-common",
-        "powerpcle": "endian-little bit-32 powerpc-common",
-        "nios2": "endian-little bit-32 nios2-common",
-        "powerpc64": "endian-big bit-64 powerpc-common",
-        "powerpc64le": "endian-little bit-64 powerpc-common",
-        "ppc": "endian-big bit-32 powerpc-common",
-        "ppc64": "endian-big bit-64 powerpc-common",
-        "ppc64le" : "endian-little bit-64 powerpc-common",
-        "riscv32": "endian-little bit-32 riscv-common",
-        "riscv64": "endian-little bit-64 riscv-common",
-        "sh3": "endian-little bit-32 sh-common",
-        "sh3eb": "endian-big bit-32 sh-common",
-        "sh4": "endian-little bit-32 sh-common",
-        "sh4eb": "endian-big bit-32 sh-common",
-        "sparc": "endian-big bit-32",
-        "viac3": "endian-little bit-32 ix86-common",
-        "x86_64": "endian-little", # bitinfo specified in targetinfo
-    }
-    osinfo = {
-        "darwin": "common-darwin",
-        "darwin9": "common-darwin",
-        "linux": "common-linux common-glibc",
-        "linux-gnu": "common-linux common-glibc",
-        "linux-gnu_ilp32": "common-linux common-glibc",
-        "linux-gnux32": "common-linux common-glibc",
-        "linux-gnun32": "common-linux common-glibc",
-        "linux-gnueabi": "common-linux common-glibc",
-        "linux-gnuspe": "common-linux common-glibc",
-        "linux-musl": "common-linux common-musl",
-        "linux-muslx32": "common-linux common-musl",
-        "linux-musleabi": "common-linux common-musl",
-        "linux-muslspe": "common-linux common-musl",
-        "uclinux-uclibc": "common-uclibc",
-        "cygwin": "common-cygwin",
-        "mingw32": "common-mingw",
-    }
-    targetinfo = {
-        "aarch64-linux-gnu": "aarch64-linux",
-        "aarch64_be-linux-gnu": "aarch64_be-linux",
-        "aarch64-linux-gnu_ilp32": "bit-32 aarch64_be-linux arm-32",
-        "aarch64_be-linux-gnu_ilp32": "bit-32 aarch64_be-linux arm-32",
-        "aarch64-linux-musl": "aarch64-linux",
-        "aarch64_be-linux-musl": "aarch64_be-linux",
-        "arm-linux-gnueabi": "arm-linux",
-        "arm-linux-musleabi": "arm-linux",
-        "armeb-linux-gnueabi": "armeb-linux",
-        "armeb-linux-musleabi": "armeb-linux",
-        "microblazeel-linux" : "microblaze-linux",
-        "microblazeel-linux-musl" : "microblaze-linux",
-        "mips-linux-musl": "mips-linux",
-        "mipsel-linux-musl": "mipsel-linux",
-        "mips64-linux-musl": "mips64-linux",
-        "mips64el-linux-musl": "mips64el-linux",
-        "mips64-linux-gnun32": "mips-linux bit-32",
-        "mips64el-linux-gnun32": "mipsel-linux bit-32",
-        "mipsisa64r6-linux-gnun32": "mipsisa32r6-linux bit-32",
-        "mipsisa64r6el-linux-gnun32": "mipsisa32r6el-linux bit-32",
-        "powerpc-linux": "powerpc32-linux powerpc32-linux-glibc",
-        "powerpc-linux-musl": "powerpc-linux powerpc32-linux powerpc32-linux-musl",
-        "powerpcle-linux": "powerpc32-linux powerpc32-linux-glibc",
-        "powerpcle-linux-musl": "powerpc-linux powerpc32-linux powerpc32-linux-musl",
-        "powerpc-linux-gnuspe": "powerpc-linux powerpc32-linux powerpc32-linux-glibc",
-        "powerpc-linux-muslspe": "powerpc-linux powerpc32-linux powerpc32-linux-musl",
-        "powerpc64-linux-gnuspe": "powerpc-linux powerpc64-linux powerpc64-linux-glibc",
-        "powerpc64-linux-muslspe": "powerpc-linux powerpc64-linux powerpc64-linux-musl",
-        "powerpc64-linux": "powerpc-linux powerpc64-linux powerpc64-linux-glibc",
-        "powerpc64-linux-musl": "powerpc-linux powerpc64-linux powerpc64-linux-musl",
-        "powerpc64le-linux": "powerpc-linux powerpc64-linux powerpc64-linux-glibc",
-        "powerpc64le-linux-musl": "powerpc-linux powerpc64-linux powerpc64-linux-musl",
-        "riscv32-linux": "riscv32-linux",
-        "riscv32-linux-musl": "riscv32-linux",
-        "riscv64-linux": "riscv64-linux",
-        "riscv64-linux-musl": "riscv64-linux",
-        "x86_64-cygwin": "bit-64",
-        "x86_64-darwin": "bit-64",
-        "x86_64-darwin9": "bit-64",
-        "x86_64-linux": "bit-64",
-        "x86_64-linux-musl": "x86_64-linux bit-64",
-        "x86_64-linux-muslx32": "bit-32 ix86-common x32-linux",
-        "x86_64-elf": "bit-64",
-        "x86_64-linux-gnu": "bit-64 x86_64-linux",
-        "x86_64-linux-gnux32": "bit-32 ix86-common x32-linux",
-        "x86_64-mingw32": "bit-64",
-    }
-
-    # Add in any extra user supplied data which may come from a BSP layer, removing the
-    # need to always change this class directly
-    extra_siteinfo = (d.getVar("SITEINFO_EXTRA_DATAFUNCS") or "").split()
-    for m in extra_siteinfo:
-        call = m + "(archinfo, osinfo, targetinfo, d)"
-        locs = { "archinfo" : archinfo, "osinfo" : osinfo, "targetinfo" : targetinfo, "d" : d}
-        archinfo, osinfo, targetinfo = bb.utils.better_eval(call, locs)
-
-    target = "%s-%s" % (arch, os)
-
-    sitedata = []
-    if arch in archinfo:
-        sitedata.extend(archinfo[arch].split())
-    if os in osinfo:
-        sitedata.extend(osinfo[os].split())
-    if target in targetinfo:
-        sitedata.extend(targetinfo[target].split())
-    sitedata.append(target)
-    sitedata.append("common")
-
-    bb.debug(1, "SITE files %s" % sitedata);
-    return sitedata
-
-def siteinfo_data(d):
-    return siteinfo_data_for_machine(d.getVar("HOST_ARCH"), d.getVar("HOST_OS"), d)
-
-python () {
-    sitedata = set(siteinfo_data(d))
-    if "endian-little" in sitedata:
-        d.setVar("SITEINFO_ENDIANNESS", "le")
-    elif "endian-big" in sitedata:
-        d.setVar("SITEINFO_ENDIANNESS", "be")
-    else:
-        bb.error("Unable to determine endianness for architecture '%s'" %
-                 d.getVar("HOST_ARCH"))
-        bb.fatal("Please add your architecture to siteinfo.bbclass")
-
-    if "bit-32" in sitedata:
-        d.setVar("SITEINFO_BITS", "32")
-    elif "bit-64" in sitedata:
-        d.setVar("SITEINFO_BITS", "64")
-    else:
-        bb.error("Unable to determine bit size for architecture '%s'" %
-                 d.getVar("HOST_ARCH"))
-        bb.fatal("Please add your architecture to siteinfo.bbclass")
-}
-
-# Layers with siteconfig need to add a replacement path to this variable so the
-# sstate isn't path specific
-SITEINFO_PATHVARS = "COREBASE"
-
-def siteinfo_get_files(d, sysrootcache=False):
-    sitedata = siteinfo_data(d)
-    sitefiles = []
-    searched = []
-    for path in d.getVar("BBPATH").split(":"):
-        for element in sitedata:
-            filename = os.path.join(path, "site", element)
-            if os.path.exists(filename):
-                searched.append(filename + ":True")
-                sitefiles.append(filename)
-            else:
-                searched.append(filename + ":False")
-
-    # Have to parameterise out hardcoded paths such as COREBASE for the main site files
-    for var in d.getVar("SITEINFO_PATHVARS").split():
-        searched2 = []
-        replace = os.path.normpath(d.getVar(var))
-        for s in searched:
-            searched2.append(s.replace(replace, "${" + var + "}"))
-        searched = searched2
-
-    if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
-        # We need sstate sigs for native/cross not to vary upon arch so we can't depend on the site files.
-        # In future we may want to depend upon all site files?
-        # This would show up as breaking sstatetests.SStateTests.test_sstate_32_64_same_hash for example
-        searched = []
-
-    if not sysrootcache:
-        return sitefiles, searched
-
-    # Now check for siteconfig cache files in sysroots
-    path_siteconfig = d.getVar('SITECONFIG_SYSROOTCACHE')
-    if path_siteconfig and os.path.isdir(path_siteconfig):
-        for i in os.listdir(path_siteconfig):
-            if not i.endswith("_config"):
-                continue
-            filename = os.path.join(path_siteconfig, i)
-            sitefiles.append(filename)
-    return sitefiles, searched
-
-#
-# Make some information available via variables
-#
-SITECONFIG_SYSROOTCACHE = "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d"
diff --git a/poky/meta/classes/sstate.bbclass b/poky/meta/classes/sstate.bbclass
deleted file mode 100644
index 0aa901f..0000000
--- a/poky/meta/classes/sstate.bbclass
+++ /dev/null
@@ -1,1358 +0,0 @@
-SSTATE_VERSION = "10"
-
-SSTATE_ZSTD_CLEVEL ??= "8"
-
-SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
-SSTATE_MANFILEPREFIX = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-${PN}"
-
-def generate_sstatefn(spec, hash, taskname, siginfo, d):
-    if taskname is None:
-       return ""
-    extension = ".tar.zst"
-    # 8 chars reserved for siginfo
-    limit = 254 - 8
-    if siginfo:
-        limit = 254
-        extension = ".tar.zst.siginfo"
-    if not hash:
-        hash = "INVALID"
-    fn = spec + hash + "_" + taskname + extension
-    # If the filename is too long, attempt to reduce it
-    if len(fn) > limit:
-        components = spec.split(":")
-        # Fields 0,5,6 are mandatory, 1 is most useful, 2,3,4 are just for information
-        # 7 is for the separators
-        avail = (limit - len(hash + "_" + taskname + extension) - len(components[0]) - len(components[1]) - len(components[5]) - len(components[6]) - 7) // 3
-        components[2] = components[2][:avail]
-        components[3] = components[3][:avail]
-        components[4] = components[4][:avail]
-        spec = ":".join(components)
-        fn = spec + hash + "_" + taskname + extension
-        if len(fn) > limit:
-            bb.fatal("Unable to reduce sstate name to less than 255 chararacters")
-    return hash[:2] + "/" + hash[2:4] + "/" + fn
-
-SSTATE_PKGARCH    = "${PACKAGE_ARCH}"
-SSTATE_PKGSPEC    = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"
-SSTATE_SWSPEC     = "sstate:${PN}::${PV}:${PR}::${SSTATE_VERSION}:"
-SSTATE_PKGNAME    = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC'), d.getVar('BB_UNIHASH'), d.getVar('SSTATE_CURRTASK'), False, d)}"
-SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
-SSTATE_EXTRAPATH   = ""
-SSTATE_EXTRAPATHWILDCARD = ""
-SSTATE_PATHSPEC   = "${SSTATE_DIR}/${SSTATE_EXTRAPATHWILDCARD}*/*/${SSTATE_PKGSPEC}*_${SSTATE_PATH_CURRTASK}.tar.zst*"
-
-# explicitly make PV to depend on evaluated value of PV variable
-PV[vardepvalue] = "${PV}"
-
-# We don't want the sstate to depend on things like the distro string
-# of the system, we let the sstate paths take care of this.
-SSTATE_EXTRAPATH[vardepvalue] = ""
-SSTATE_EXTRAPATHWILDCARD[vardepvalue] = ""
-
-# For multilib rpm the allarch packagegroup files can overwrite (in theory they're identical)
-SSTATE_ALLOW_OVERLAP_FILES = "${DEPLOY_DIR}/licenses/"
-# Avoid docbook/sgml catalog warnings for now
-SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_ETCDIR_NATIVE}/sgml ${STAGING_DATADIR_NATIVE}/sgml"
-# sdk-provides-dummy-nativesdk and nativesdk-buildtools-perl-dummy overlap for different SDKMACHINE
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_RPM}/sdk_provides_dummy_nativesdk/ ${DEPLOY_DIR_IPK}/sdk-provides-dummy-nativesdk/"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_RPM}/buildtools_dummy_nativesdk/ ${DEPLOY_DIR_IPK}/buildtools-dummy-nativesdk/"
-# target-sdk-provides-dummy overlaps that allarch is disabled when multilib is used
-SSTATE_ALLOW_OVERLAP_FILES += "${COMPONENTS_DIR}/sdk-provides-dummy-target/ ${DEPLOY_DIR_RPM}/sdk_provides_dummy_target/ ${DEPLOY_DIR_IPK}/sdk-provides-dummy-target/"
-# Archive the sources for many architectures in one deploy folder
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_SRC}"
-# ovmf/grub-efi/systemd-boot/intel-microcode multilib recipes can generate identical overlapping files
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/ovmf"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/grub-efi"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/systemd-boot"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/microcode"
-
-SSTATE_SCAN_FILES ?= "*.la *-config *_config postinst-*"
-SSTATE_SCAN_CMD ??= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES").split())}" \) -type f'
-SSTATE_SCAN_CMD_NATIVE ??= 'grep -Irl -e ${RECIPE_SYSROOT} -e ${RECIPE_SYSROOT_NATIVE} -e ${HOSTTOOLS_DIR} ${SSTATE_BUILDDIR}'
-SSTATE_HASHEQUIV_FILEMAP ?= " \
-    populate_sysroot:*/postinst-useradd-*:${TMPDIR} \
-    populate_sysroot:*/postinst-useradd-*:${COREBASE} \
-    populate_sysroot:*/postinst-useradd-*:regex-\s(PATH|PSEUDO_IGNORE_PATHS|HOME|LOGNAME|OMP_NUM_THREADS|USER)=.*\s \
-    populate_sysroot:*/crossscripts/*:${TMPDIR} \
-    populate_sysroot:*/crossscripts/*:${COREBASE} \
-    "
-
-BB_HASHFILENAME = "False ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}"
-
-SSTATE_ARCHS = " \
-    ${BUILD_ARCH} \
-    ${BUILD_ARCH}_${ORIGNATIVELSBSTRING} \
-    ${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS} \
-    ${SDK_ARCH}_${SDK_OS} \
-    ${SDK_ARCH}_${PACKAGE_ARCH} \
-    allarch \
-    ${PACKAGE_ARCH} \
-    ${PACKAGE_EXTRA_ARCHS} \
-    ${MACHINE_ARCH}"
-SSTATE_ARCHS[vardepsexclude] = "ORIGNATIVELSBSTRING"
-
-SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
-
-SSTATECREATEFUNCS += "sstate_hardcode_path"
-SSTATECREATEFUNCS[vardeps] = "SSTATE_SCAN_FILES"
-SSTATEPOSTCREATEFUNCS = ""
-SSTATEPREINSTFUNCS = ""
-SSTATEPOSTUNPACKFUNCS = "sstate_hardcode_path_unpack"
-SSTATEPOSTINSTFUNCS = ""
-EXTRA_STAGING_FIXMES ?= "HOSTTOOLS_DIR"
-
-# Check whether sstate exists for tasks that support sstate and are in the
-# locked signatures file.
-SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK ?= 'error'
-
-# Check whether the task's computed hash matches the task's hash in the
-# locked signatures file.
-SIGGEN_LOCKEDSIGS_TASKSIG_CHECK ?= "error"
-
-# The GnuPG key ID and passphrase to use to sign sstate archives (or unset to
-# not sign)
-SSTATE_SIG_KEY ?= ""
-SSTATE_SIG_PASSPHRASE ?= ""
-# Whether to verify the GnUPG signatures when extracting sstate archives
-SSTATE_VERIFY_SIG ?= "0"
-# List of signatures to consider valid.
-SSTATE_VALID_SIGS ??= ""
-SSTATE_VALID_SIGS[vardepvalue] = ""
-
-SSTATE_HASHEQUIV_METHOD ?= "oe.sstatesig.OEOuthashBasic"
-SSTATE_HASHEQUIV_METHOD[doc] = "The fully-qualified function used to calculate \
-    the output hash for a task, which in turn is used to determine equivalency. \
-    "
-
-SSTATE_HASHEQUIV_REPORT_TASKDATA ?= "0"
-SSTATE_HASHEQUIV_REPORT_TASKDATA[doc] = "Report additional useful data to the \
-    hash equivalency server, such as PN, PV, taskname, etc. This information \
-    is very useful for developers looking at task data, but may leak sensitive \
-    data if the equivalence server is public. \
-    "
-
-python () {
-    if bb.data.inherits_class('native', d):
-        d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False))
-    elif bb.data.inherits_class('crosssdk', d):
-        d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}"))
-    elif bb.data.inherits_class('cross', d):
-        d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}"))
-    elif bb.data.inherits_class('nativesdk', d):
-        d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${SDK_OS}"))
-    elif bb.data.inherits_class('cross-canadian', d):
-        d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${PACKAGE_ARCH}"))
-    elif bb.data.inherits_class('allarch', d) and d.getVar("PACKAGE_ARCH") == "all":
-        d.setVar('SSTATE_PKGARCH', "allarch")
-    else:
-        d.setVar('SSTATE_MANMACH', d.expand("${PACKAGE_ARCH}"))
-
-    if bb.data.inherits_class('native', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross', d):
-        d.setVar('SSTATE_EXTRAPATH', "${NATIVELSBSTRING}/")
-        d.setVar('BB_HASHFILENAME', "True ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}")
-        d.setVar('SSTATE_EXTRAPATHWILDCARD', "${NATIVELSBSTRING}/")
-
-    unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split()))
-    d.setVar('SSTATETASKS', " ".join(unique_tasks))
-    for task in unique_tasks:
-        d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ")
-        d.appendVarFlag(task, 'postfuncs', " sstate_task_postfunc")
-        d.setVarFlag(task, 'network', '1')
-        d.setVarFlag(task + "_setscene", 'network', '1')
-}
-
-def sstate_init(task, d):
-    ss = {}
-    ss['task'] = task
-    ss['dirs'] = []
-    ss['plaindirs'] = []
-    ss['lockfiles'] = []
-    ss['lockfiles-shared'] = []
-    return ss
-
-def sstate_state_fromvars(d, task = None):
-    if task is None:
-        task = d.getVar('BB_CURRENTTASK')
-        if not task:
-            bb.fatal("sstate code running without task context?!")
-        task = task.replace("_setscene", "")
-
-    if task.startswith("do_"):
-        task = task[3:]
-    inputs = (d.getVarFlag("do_" + task, 'sstate-inputdirs') or "").split()
-    outputs = (d.getVarFlag("do_" + task, 'sstate-outputdirs') or "").split()
-    plaindirs = (d.getVarFlag("do_" + task, 'sstate-plaindirs') or "").split()
-    lockfiles = (d.getVarFlag("do_" + task, 'sstate-lockfile') or "").split()
-    lockfilesshared = (d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "").split()
-    interceptfuncs = (d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "").split()
-    fixmedir = d.getVarFlag("do_" + task, 'sstate-fixmedir') or ""
-    if not task or len(inputs) != len(outputs):
-        bb.fatal("sstate variables not setup correctly?!")
-
-    if task == "populate_lic":
-        d.setVar("SSTATE_PKGSPEC", "${SSTATE_SWSPEC}")
-        d.setVar("SSTATE_EXTRAPATH", "")
-        d.setVar('SSTATE_EXTRAPATHWILDCARD', "")
-
-    ss = sstate_init(task, d)
-    for i in range(len(inputs)):
-        sstate_add(ss, inputs[i], outputs[i], d)
-    ss['lockfiles'] = lockfiles
-    ss['lockfiles-shared'] = lockfilesshared
-    ss['plaindirs'] = plaindirs
-    ss['interceptfuncs'] = interceptfuncs
-    ss['fixmedir'] = fixmedir
-    return ss
-
-def sstate_add(ss, source, dest, d):
-    if not source.endswith("/"):
-         source = source + "/"
-    if not dest.endswith("/"):
-         dest = dest + "/"
-    source = os.path.normpath(source)
-    dest = os.path.normpath(dest)
-    srcbase = os.path.basename(source)
-    ss['dirs'].append([srcbase, source, dest])
-    return ss
-
-def sstate_install(ss, d):
-    import oe.path
-    import oe.sstatesig
-    import subprocess
-
-    sharedfiles = []
-    shareddirs = []
-    bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
-
-    sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
-
-    manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d)
-
-    if os.access(manifest, os.R_OK):
-        bb.fatal("Package already staged (%s)?!" % manifest)
-
-    d.setVar("SSTATE_INST_POSTRM", manifest + ".postrm")
-
-    locks = []
-    for lock in ss['lockfiles-shared']:
-        locks.append(bb.utils.lockfile(lock, True))
-    for lock in ss['lockfiles']:
-        locks.append(bb.utils.lockfile(lock))
-
-    for state in ss['dirs']:
-        bb.debug(2, "Staging files from %s to %s" % (state[1], state[2]))
-        for walkroot, dirs, files in os.walk(state[1]):
-            for file in files:
-                srcpath = os.path.join(walkroot, file)
-                dstpath = srcpath.replace(state[1], state[2])
-                #bb.debug(2, "Staging %s to %s" % (srcpath, dstpath))
-                sharedfiles.append(dstpath)
-            for dir in dirs:
-                srcdir = os.path.join(walkroot, dir)
-                dstdir = srcdir.replace(state[1], state[2])
-                #bb.debug(2, "Staging %s to %s" % (srcdir, dstdir))
-                if os.path.islink(srcdir):
-                    sharedfiles.append(dstdir)
-                    continue
-                if not dstdir.endswith("/"):
-                    dstdir = dstdir + "/"
-                shareddirs.append(dstdir)
-
-    # Check the file list for conflicts against files which already exist
-    overlap_allowed = (d.getVar("SSTATE_ALLOW_OVERLAP_FILES") or "").split()
-    match = []
-    for f in sharedfiles:
-        if os.path.exists(f) and not os.path.islink(f):
-            f = os.path.normpath(f)
-            realmatch = True
-            for w in overlap_allowed:
-                w = os.path.normpath(w)
-                if f.startswith(w):
-                    realmatch = False
-                    break
-            if realmatch:
-                match.append(f)
-                sstate_search_cmd = "grep -rlF '%s' %s --exclude=master.list | sed -e 's:^.*/::'" % (f, d.expand("${SSTATE_MANIFESTS}"))
-                search_output = subprocess.Popen(sstate_search_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
-                if search_output:
-                    match.append("  (matched in %s)" % search_output.decode('utf-8').rstrip())
-                else:
-                    match.append("  (not matched to any task)")
-    if match:
-        bb.error("The recipe %s is trying to install files into a shared " \
-          "area when those files already exist. Those files and their manifest " \
-          "location are:\n  %s\nPlease verify which recipe should provide the " \
-          "above files.\n\nThe build has stopped, as continuing in this scenario WILL " \
-          "break things - if not now, possibly in the future (we've seen builds fail " \
-          "several months later). If the system knew how to recover from this " \
-          "automatically it would, however there are several different scenarios " \
-          "which can result in this and we don't know which one this is. It may be " \
-          "you have switched providers of something like virtual/kernel (e.g. from " \
-          "linux-yocto to linux-yocto-dev), in that case you need to execute the " \
-          "clean task for both recipes and it will resolve this error. It may be " \
-          "you changed DISTRO_FEATURES from systemd to udev or vice versa. Cleaning " \
-          "those recipes should again resolve this error, however switching " \
-          "DISTRO_FEATURES on an existing build directory is not supported - you " \
-          "should really clean out tmp and rebuild (reusing sstate should be safe). " \
-          "It could be the overlapping files detected are harmless in which case " \
-          "adding them to SSTATE_ALLOW_OVERLAP_FILES may be the correct solution. It could " \
-          "also be your build is including two different conflicting versions of " \
-          "things (e.g. bluez 4 and bluez 5 and the correct solution for that would " \
-          "be to resolve the conflict. If in doubt, please ask on the mailing list, " \
-          "sharing the error and filelist above." % \
-          (d.getVar('PN'), "\n  ".join(match)))
-        bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.")
-
-    if ss['fixmedir'] and os.path.exists(ss['fixmedir'] + "/fixmepath.cmd"):
-        sharedfiles.append(ss['fixmedir'] + "/fixmepath.cmd")
-        sharedfiles.append(ss['fixmedir'] + "/fixmepath")
-
-    # Write out the manifest
-    f = open(manifest, "w")
-    for file in sharedfiles:
-        f.write(file + "\n")
-
-    # We want to ensure that directories appear at the end of the manifest
-    # so that when we test to see if they should be deleted any contents
-    # added by the task will have been removed first.
-    dirs = sorted(shareddirs, key=len)
-    # Must remove children first, which will have a longer path than the parent
-    for di in reversed(dirs):
-        f.write(di + "\n")
-    f.close()
-
-    # Append to the list of manifests for this PACKAGE_ARCH
-
-    i = d2.expand("${SSTATE_MANIFESTS}/index-${SSTATE_MANMACH}")
-    l = bb.utils.lockfile(i + ".lock")
-    filedata = d.getVar("STAMP") + " " + d2.getVar("SSTATE_MANFILEPREFIX") + " " + d.getVar("WORKDIR") + "\n"
-    manifests = []
-    if os.path.exists(i):
-        with open(i, "r") as f:
-            manifests = f.readlines()
-    # We append new entries, we don't remove older entries which may have the same
-    # manifest name but different versions from stamp/workdir. See below.
-    if filedata not in manifests:
-        with open(i, "a+") as f:
-            f.write(filedata)
-    bb.utils.unlockfile(l)
-
-    # Run the actual file install
-    for state in ss['dirs']:
-        if os.path.exists(state[1]):
-            oe.path.copyhardlinktree(state[1], state[2])
-
-    for postinst in (d.getVar('SSTATEPOSTINSTFUNCS') or '').split():
-        # All hooks should run in the SSTATE_INSTDIR
-        bb.build.exec_func(postinst, d, (sstateinst,))
-
-    for lock in locks:
-        bb.utils.unlockfile(lock)
-
-sstate_install[vardepsexclude] += "SSTATE_ALLOW_OVERLAP_FILES STATE_MANMACH SSTATE_MANFILEPREFIX"
-sstate_install[vardeps] += "${SSTATEPOSTINSTFUNCS}"
-
-def sstate_installpkg(ss, d):
-    from oe.gpg_sign import get_signer
-
-    sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
-    d.setVar("SSTATE_CURRTASK", ss['task'])
-    sstatefetch = d.getVar('SSTATE_PKGNAME')
-    sstatepkg = d.getVar('SSTATE_PKG')
-
-    if not os.path.exists(sstatepkg):
-        pstaging_fetch(sstatefetch, d)
-
-    if not os.path.isfile(sstatepkg):
-        bb.note("Sstate package %s does not exist" % sstatepkg)
-        return False
-
-    sstate_clean(ss, d)
-
-    d.setVar('SSTATE_INSTDIR', sstateinst)
-
-    if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
-        if not os.path.isfile(sstatepkg + '.sig'):
-            bb.warn("No signature file for sstate package %s, skipping acceleration..." % sstatepkg)
-            return False
-        signer = get_signer(d, 'local')
-        if not signer.verify(sstatepkg + '.sig', d.getVar("SSTATE_VALID_SIGS")):
-            bb.warn("Cannot verify signature on sstate package %s, skipping acceleration..." % sstatepkg)
-            return False
-
-    # Empty sstateinst directory, ensure its clean
-    if os.path.exists(sstateinst):
-        oe.path.remove(sstateinst)
-    bb.utils.mkdirhier(sstateinst)
-
-    sstateinst = d.getVar("SSTATE_INSTDIR")
-    d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
-
-    for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package']:
-        # All hooks should run in the SSTATE_INSTDIR
-        bb.build.exec_func(f, d, (sstateinst,))
-
-    return sstate_installpkgdir(ss, d)
-
-def sstate_installpkgdir(ss, d):
-    import oe.path
-    import subprocess
-
-    sstateinst = d.getVar("SSTATE_INSTDIR")
-    d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
-
-    for f in (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split():
-        # All hooks should run in the SSTATE_INSTDIR
-        bb.build.exec_func(f, d, (sstateinst,))
-
-    def prepdir(dir):
-        # remove dir if it exists, ensure any parent directories do exist
-        if os.path.exists(dir):
-            oe.path.remove(dir)
-        bb.utils.mkdirhier(dir)
-        oe.path.remove(dir)
-
-    for state in ss['dirs']:
-        prepdir(state[1])
-        bb.utils.rename(sstateinst + state[0], state[1])
-    sstate_install(ss, d)
-
-    for plain in ss['plaindirs']:
-        workdir = d.getVar('WORKDIR')
-        sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared")
-        src = sstateinst + "/" + plain.replace(workdir, '')
-        if sharedworkdir in plain:
-            src = sstateinst + "/" + plain.replace(sharedworkdir, '')
-        dest = plain
-        bb.utils.mkdirhier(src)
-        prepdir(dest)
-        bb.utils.rename(src, dest)
-
-    return True
-
-python sstate_hardcode_path_unpack () {
-    # Fixup hardcoded paths
-    #
-    # Note: The logic below must match the reverse logic in
-    # sstate_hardcode_path(d)
-    import subprocess
-
-    sstateinst = d.getVar('SSTATE_INSTDIR')
-    sstatefixmedir = d.getVar('SSTATE_FIXMEDIR')
-    fixmefn = sstateinst + "fixmepath"
-    if os.path.isfile(fixmefn):
-        staging_target = d.getVar('RECIPE_SYSROOT')
-        staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
-
-        if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
-            sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host)
-        elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
-            sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (staging_target, staging_host)
-        else:
-            sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g'" % (staging_target)
-
-        extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
-        for fixmevar in extra_staging_fixmes.split():
-            fixme_path = d.getVar(fixmevar)
-            sstate_sed_cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
-
-        # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed
-        sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd)
-
-        # Defer do_populate_sysroot relocation command
-        if sstatefixmedir:
-            bb.utils.mkdirhier(sstatefixmedir)
-            with open(sstatefixmedir + "/fixmepath.cmd", "w") as f:
-                sstate_hardcode_cmd = sstate_hardcode_cmd.replace(fixmefn, sstatefixmedir + "/fixmepath")
-                sstate_hardcode_cmd = sstate_hardcode_cmd.replace(sstateinst, "FIXMEFINALSSTATEINST")
-                sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_host, "FIXMEFINALSSTATEHOST")
-                sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_target, "FIXMEFINALSSTATETARGET")
-                f.write(sstate_hardcode_cmd)
-            bb.utils.copyfile(fixmefn, sstatefixmedir + "/fixmepath")
-            return
-
-        bb.note("Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd))
-        subprocess.check_call(sstate_hardcode_cmd, shell=True)
-
-        # Need to remove this or we'd copy it into the target directory and may
-        # conflict with another writer
-        os.remove(fixmefn)
-}
-
-def sstate_clean_cachefile(ss, d):
-    import oe.path
-
-    if d.getVarFlag('do_%s' % ss['task'], 'task'):
-        d.setVar("SSTATE_PATH_CURRTASK", ss['task'])
-        sstatepkgfile = d.getVar('SSTATE_PATHSPEC')
-        bb.note("Removing %s" % sstatepkgfile)
-        oe.path.remove(sstatepkgfile)
-
-def sstate_clean_cachefiles(d):
-    for task in (d.getVar('SSTATETASKS') or "").split():
-        ld = d.createCopy()
-        ss = sstate_state_fromvars(ld, task)
-        sstate_clean_cachefile(ss, ld)
-
-def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
-    import oe.path
-
-    mfile = open(manifest)
-    entries = mfile.readlines()
-    mfile.close()
-
-    for entry in entries:
-        entry = entry.strip()
-        if prefix and not entry.startswith("/"):
-            entry = prefix + "/" + entry
-        bb.debug(2, "Removing manifest: %s" % entry)
-        # We can race against another package populating directories as we're removing them
-        # so we ignore errors here.
-        try:
-            if entry.endswith("/"):
-                if os.path.islink(entry[:-1]):
-                    os.remove(entry[:-1])
-                elif os.path.exists(entry) and len(os.listdir(entry)) == 0 and not canrace:
-                    # Removing directories whilst builds are in progress exposes a race. Only
-                    # do it in contexts where it is safe to do so.
-                    os.rmdir(entry[:-1])
-            else:
-                os.remove(entry)
-        except OSError:
-            pass
-
-    postrm = manifest + ".postrm"
-    if os.path.exists(manifest + ".postrm"):
-        import subprocess
-        os.chmod(postrm, 0o755)
-        subprocess.check_call(postrm, shell=True)
-        oe.path.remove(postrm)
-
-    oe.path.remove(manifest)
-
-def sstate_clean(ss, d):
-    import oe.path
-    import glob
-
-    d2 = d.createCopy()
-    stamp_clean = d.getVar("STAMPCLEAN")
-    extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info')
-    if extrainf:
-        d2.setVar("SSTATE_MANMACH", extrainf)
-        wildcard_stfile = "%s.do_%s*.%s" % (stamp_clean, ss['task'], extrainf)
-    else:
-        wildcard_stfile = "%s.do_%s*" % (stamp_clean, ss['task'])
-
-    manifest = d2.expand("${SSTATE_MANFILEPREFIX}.%s" % ss['task'])
-
-    if os.path.exists(manifest):
-        locks = []
-        for lock in ss['lockfiles-shared']:
-            locks.append(bb.utils.lockfile(lock))
-        for lock in ss['lockfiles']:
-            locks.append(bb.utils.lockfile(lock))
-
-        sstate_clean_manifest(manifest, d, canrace=True)
-
-        for lock in locks:
-            bb.utils.unlockfile(lock)
-
-    # Remove the current and previous stamps, but keep the sigdata.
-    #
-    # The glob() matches do_task* which may match multiple tasks, for
-    # example: do_package and do_package_write_ipk, so we need to
-    # exactly match *.do_task.* and *.do_task_setscene.*
-    rm_stamp = '.do_%s.' % ss['task']
-    rm_setscene = '.do_%s_setscene.' % ss['task']
-    # For BB_SIGNATURE_HANDLER = "noop"
-    rm_nohash = ".do_%s" % ss['task']
-    for stfile in glob.glob(wildcard_stfile):
-        # Keep the sigdata
-        if ".sigdata." in stfile or ".sigbasedata." in stfile:
-            continue
-        # Preserve taint files in the stamps directory
-        if stfile.endswith('.taint'):
-            continue
-        if rm_stamp in stfile or rm_setscene in stfile or \
-                stfile.endswith(rm_nohash):
-            oe.path.remove(stfile)
-
-sstate_clean[vardepsexclude] = "SSTATE_MANFILEPREFIX"
-
-CLEANFUNCS += "sstate_cleanall"
-
-python sstate_cleanall() {
-    bb.note("Removing shared state for package %s" % d.getVar('PN'))
-
-    manifest_dir = d.getVar('SSTATE_MANIFESTS')
-    if not os.path.exists(manifest_dir):
-        return
-
-    tasks = d.getVar('SSTATETASKS').split()
-    for name in tasks:
-        ld = d.createCopy()
-        shared_state = sstate_state_fromvars(ld, name)
-        sstate_clean(shared_state, ld)
-}
-
-python sstate_hardcode_path () {
-    import subprocess, platform
-
-    # Need to remove hardcoded paths and fix these when we install the
-    # staging packages.
-    #
-    # Note: the logic in this function needs to match the reverse logic
-    # in sstate_installpkg(ss, d)
-
-    staging_target = d.getVar('RECIPE_SYSROOT')
-    staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
-    sstate_builddir = d.getVar('SSTATE_BUILDDIR')
-
-    sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % staging_host
-    if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
-        sstate_grep_cmd = "grep -l -e '%s'" % (staging_host)
-    elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
-        sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging_host)
-        sstate_sed_cmd += " -e 's:%s:FIXMESTAGINGDIRTARGET:g'" % staging_target
-    else:
-        sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging_host)
-        sstate_sed_cmd += " -e 's:%s:FIXMESTAGINGDIRTARGET:g'" % staging_target
-
-    extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
-    for fixmevar in extra_staging_fixmes.split():
-        fixme_path = d.getVar(fixmevar)
-        sstate_sed_cmd += " -e 's:%s:FIXME_%s:g'" % (fixme_path, fixmevar)
-        sstate_grep_cmd += " -e '%s'" % (fixme_path)
-
-    fixmefn =  sstate_builddir + "fixmepath"
-
-    sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD')
-    sstate_filelist_cmd = "tee %s" % (fixmefn)
-
-    # fixmepath file needs relative paths, drop sstate_builddir prefix
-    sstate_filelist_relative_cmd = "sed -i -e 's:^%s::g' %s" % (sstate_builddir, fixmefn)
-
-    xargs_no_empty_run_cmd = '--no-run-if-empty'
-    if platform.system() == 'Darwin':
-        xargs_no_empty_run_cmd = ''
-
-    # Limit the fixpaths and sed operations based on the initial grep search
-    # This has the side effect of making sure the vfs cache is hot
-    sstate_hardcode_cmd = "%s | xargs %s | %s | xargs %s %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, xargs_no_empty_run_cmd, sstate_sed_cmd)
-
-    bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
-    subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
-
-        # If the fixmefn is empty, remove it..
-    if os.stat(fixmefn).st_size == 0:
-        os.remove(fixmefn)
-    else:
-        bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
-        subprocess.check_output(sstate_filelist_relative_cmd, shell=True)
-}
-
-def sstate_package(ss, d):
-    import oe.path
-    import time
-
-    tmpdir = d.getVar('TMPDIR')
-
-    fixtime = False
-    if ss['task'] == "package":
-        fixtime = True
-
-    def fixtimestamp(root, path):
-        f = os.path.join(root, path)
-        if os.lstat(f).st_mtime > sde:
-            os.utime(f, (sde, sde), follow_symlinks=False)
-
-    sstatebuild = d.expand("${WORKDIR}/sstate-build-%s/" % ss['task'])
-    sde = int(d.getVar("SOURCE_DATE_EPOCH") or time.time())
-    d.setVar("SSTATE_CURRTASK", ss['task'])
-    bb.utils.remove(sstatebuild, recurse=True)
-    bb.utils.mkdirhier(sstatebuild)
-    for state in ss['dirs']:
-        if not os.path.exists(state[1]):
-            continue
-        srcbase = state[0].rstrip("/").rsplit('/', 1)[0]
-        # Find and error for absolute symlinks. We could attempt to relocate but its not
-        # clear where the symlink is relative to in this context. We could add that markup
-        # to sstate tasks but there aren't many of these so better just avoid them entirely.
-        for walkroot, dirs, files in os.walk(state[1]):
-            for file in files + dirs:
-                if fixtime:
-                    fixtimestamp(walkroot, file)
-                srcpath = os.path.join(walkroot, file)
-                if not os.path.islink(srcpath):
-                    continue
-                link = os.readlink(srcpath)
-                if not os.path.isabs(link):
-                    continue
-                if not link.startswith(tmpdir):
-                    continue
-                bb.error("sstate found an absolute path symlink %s pointing at %s. Please replace this with a relative link." % (srcpath, link))
-        bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
-        bb.utils.rename(state[1], sstatebuild + state[0])
-
-    workdir = d.getVar('WORKDIR')
-    sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared")
-    for plain in ss['plaindirs']:
-        pdir = plain.replace(workdir, sstatebuild)
-        if sharedworkdir in plain:
-            pdir = plain.replace(sharedworkdir, sstatebuild)
-        bb.utils.mkdirhier(plain)
-        bb.utils.mkdirhier(pdir)
-        bb.utils.rename(plain, pdir)
-        if fixtime:
-            fixtimestamp(pdir, "")
-            for walkroot, dirs, files in os.walk(pdir):
-                for file in files + dirs:
-                    fixtimestamp(walkroot, file)
-
-    d.setVar('SSTATE_BUILDDIR', sstatebuild)
-    d.setVar('SSTATE_INSTDIR', sstatebuild)
-
-    if d.getVar('SSTATE_SKIP_CREATION') == '1':
-        return
-
-    sstate_create_package = ['sstate_report_unihash', 'sstate_create_package']
-    if d.getVar('SSTATE_SIG_KEY'):
-        sstate_create_package.append('sstate_sign_package')
-
-    for f in (d.getVar('SSTATECREATEFUNCS') or '').split() + \
-             sstate_create_package + \
-             (d.getVar('SSTATEPOSTCREATEFUNCS') or '').split():
-        # All hooks should run in SSTATE_BUILDDIR.
-        bb.build.exec_func(f, d, (sstatebuild,))
-
-    # SSTATE_PKG may have been changed by sstate_report_unihash
-    siginfo = d.getVar('SSTATE_PKG') + ".siginfo"
-    if not os.path.exists(siginfo):
-        bb.siggen.dump_this_task(siginfo, d)
-    else:
-        try:
-            os.utime(siginfo, None)
-        except PermissionError:
-            pass
-        except OSError as e:
-            # Handle read-only file systems gracefully
-            import errno
-            if e.errno != errno.EROFS:
-                raise e
-
-    return
-
-sstate_package[vardepsexclude] += "SSTATE_SIG_KEY"
-
-def pstaging_fetch(sstatefetch, d):
-    import bb.fetch2
-
-    # Only try and fetch if the user has configured a mirror
-    mirrors = d.getVar('SSTATE_MIRRORS')
-    if not mirrors:
-        return
-
-    # Copy the data object and override DL_DIR and SRC_URI
-    localdata = bb.data.createCopy(d)
-
-    dldir = localdata.expand("${SSTATE_DIR}")
-    bb.utils.mkdirhier(dldir)
-
-    localdata.delVar('MIRRORS')
-    localdata.setVar('FILESPATH', dldir)
-    localdata.setVar('DL_DIR', dldir)
-    localdata.setVar('PREMIRRORS', mirrors)
-    localdata.setVar('SRCPV', d.getVar('SRCPV'))
-
-    # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK,
-    # we'll want to allow network access for the current set of fetches.
-    if bb.utils.to_boolean(localdata.getVar('BB_NO_NETWORK')) and \
-            bb.utils.to_boolean(localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK')):
-        localdata.delVar('BB_NO_NETWORK')
-
-    # Try a fetch from the sstate mirror, if it fails just return and
-    # we will build the package
-    uris = ['file://{0};downloadfilename={0}'.format(sstatefetch),
-            'file://{0}.siginfo;downloadfilename={0}.siginfo'.format(sstatefetch)]
-    if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
-        uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)]
-
-    for srcuri in uris:
-        localdata.setVar('SRC_URI', srcuri)
-        try:
-            fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
-            fetcher.checkstatus()
-            fetcher.download()
-
-        except bb.fetch2.BBFetchException:
-            pass
-
-pstaging_fetch[vardepsexclude] += "SRCPV"
-
-
-def sstate_setscene(d):
-    shared_state = sstate_state_fromvars(d)
-    accelerate = sstate_installpkg(shared_state, d)
-    if not accelerate:
-        msg = "No sstate archive obtainable, will run full task instead."
-        bb.warn(msg)
-        raise bb.BBHandledException(msg)
-
-python sstate_task_prefunc () {
-    shared_state = sstate_state_fromvars(d)
-    sstate_clean(shared_state, d)
-}
-sstate_task_prefunc[dirs] = "${WORKDIR}"
-
-python sstate_task_postfunc () {
-    shared_state = sstate_state_fromvars(d)
-
-    for intercept in shared_state['interceptfuncs']:
-        bb.build.exec_func(intercept, d, (d.getVar("WORKDIR"),))
-
-    omask = os.umask(0o002)
-    if omask != 0o002:
-       bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
-    sstate_package(shared_state, d)
-    os.umask(omask)
-
-    sstateinst = d.getVar("SSTATE_INSTDIR")
-    d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
-
-    sstate_installpkgdir(shared_state, d)
-
-    bb.utils.remove(d.getVar("SSTATE_BUILDDIR"), recurse=True)
-}
-sstate_task_postfunc[dirs] = "${WORKDIR}"
-
-
-#
-# Shell function to generate a sstate package from a directory
-# set as SSTATE_BUILDDIR. Will be run from within SSTATE_BUILDDIR.
-#
-sstate_create_package () {
-	# Exit early if it already exists
-	if [ -e ${SSTATE_PKG} ]; then
-		touch ${SSTATE_PKG} 2>/dev/null || true
-		return
-	fi
-
-	mkdir --mode=0775 -p `dirname ${SSTATE_PKG}`
-	TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX`
-
-	OPT="-cS"
-	ZSTD="zstd -${SSTATE_ZSTD_CLEVEL} -T${ZSTD_THREADS}"
-	# Use pzstd if available
-	if [ -x "$(command -v pzstd)" ]; then
-		ZSTD="pzstd -${SSTATE_ZSTD_CLEVEL} -p ${ZSTD_THREADS}"
-	fi
-
-	# Need to handle empty directories
-	if [ "$(ls -A)" ]; then
-		set +e
-		tar -I "$ZSTD" $OPT -f $TFILE *
-		ret=$?
-		if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
-			exit 1
-		fi
-		set -e
-	else
-		tar -I "$ZSTD" $OPT --file=$TFILE --files-from=/dev/null
-	fi
-	chmod 0664 $TFILE
-	# Skip if it was already created by some other process
-	if [ -h ${SSTATE_PKG} ] && [ ! -e ${SSTATE_PKG} ]; then
-		# There is a symbolic link, but it links to nothing.
-		# Forcefully replace it with the new file.
-		ln -f $TFILE ${SSTATE_PKG} || true
-	elif [ ! -e ${SSTATE_PKG} ]; then
-		# Move into place using ln to attempt an atomic op.
-		# Abort if it already exists
-		ln $TFILE ${SSTATE_PKG} || true
-	else
-		touch ${SSTATE_PKG} 2>/dev/null || true
-	fi
-	rm $TFILE
-}
-
-python sstate_sign_package () {
-    from oe.gpg_sign import get_signer
-
-
-    signer = get_signer(d, 'local')
-    sstate_pkg = d.getVar('SSTATE_PKG')
-    if os.path.exists(sstate_pkg + '.sig'):
-        os.unlink(sstate_pkg + '.sig')
-    signer.detach_sign(sstate_pkg, d.getVar('SSTATE_SIG_KEY', False), None,
-                       d.getVar('SSTATE_SIG_PASSPHRASE'), armor=False)
-}
-
-python sstate_report_unihash() {
-    report_unihash = getattr(bb.parse.siggen, 'report_unihash', None)
-
-    if report_unihash:
-        ss = sstate_state_fromvars(d)
-        report_unihash(os.getcwd(), ss['task'], d)
-}
-
-#
-# Shell function to decompress and prepare a package for installation
-# Will be run from within SSTATE_INSTDIR.
-#
-sstate_unpack_package () {
-	ZSTD="zstd -T${ZSTD_THREADS}"
-	# Use pzstd if available
-	if [ -x "$(command -v pzstd)" ]; then
-		ZSTD="pzstd -p ${ZSTD_THREADS}"
-	fi
-
-	tar -I "$ZSTD" -xvpf ${SSTATE_PKG}
-	# update .siginfo atime on local/NFS mirror if it is a symbolic link
-	[ ! -h ${SSTATE_PKG}.siginfo ] || [ ! -e ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true
-	# update each symbolic link instead of any referenced file
-	touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true
-	[ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true
-	[ ! -e ${SSTATE_PKG}.siginfo ] || touch --no-dereference ${SSTATE_PKG}.siginfo 2>/dev/null || true
-}
-
-BB_HASHCHECK_FUNCTION = "sstate_checkhashes"
-
-def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, **kwargs):
-    found = set()
-    missed = set()
-
-    def gethash(task):
-        return sq_data['unihash'][task]
-
-    def getpathcomponents(task, d):
-        # Magic data from BB_HASHFILENAME
-        splithashfn = sq_data['hashfn'][task].split(" ")
-        spec = splithashfn[1]
-        if splithashfn[0] == "True":
-            extrapath = d.getVar("NATIVELSBSTRING") + "/"
-        else:
-            extrapath = ""
-        
-        tname = bb.runqueue.taskname_from_tid(task)[3:]
-
-        if tname in ["fetch", "unpack", "patch", "populate_lic", "preconfigure"] and splithashfn[2]:
-            spec = splithashfn[2]
-            extrapath = ""
-
-        return spec, extrapath, tname
-
-    def getsstatefile(tid, siginfo, d):
-        spec, extrapath, tname = getpathcomponents(tid, d)
-        return extrapath + generate_sstatefn(spec, gethash(tid), tname, siginfo, d)
-
-    for tid in sq_data['hash']:
-
-        sstatefile = d.expand("${SSTATE_DIR}/" + getsstatefile(tid, siginfo, d))
-
-        if os.path.exists(sstatefile):
-            found.add(tid)
-            bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
-        else:
-            missed.add(tid)
-            bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile)
-
-    foundLocal = len(found)
-    mirrors = d.getVar("SSTATE_MIRRORS")
-    if mirrors:
-        # Copy the data object and override DL_DIR and SRC_URI
-        localdata = bb.data.createCopy(d)
-
-        dldir = localdata.expand("${SSTATE_DIR}")
-        localdata.delVar('MIRRORS')
-        localdata.setVar('FILESPATH', dldir)
-        localdata.setVar('DL_DIR', dldir)
-        localdata.setVar('PREMIRRORS', mirrors)
-
-        bb.debug(2, "SState using premirror of: %s" % mirrors)
-
-        # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK,
-        # we'll want to allow network access for the current set of fetches.
-        if bb.utils.to_boolean(localdata.getVar('BB_NO_NETWORK')) and \
-                bb.utils.to_boolean(localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK')):
-            localdata.delVar('BB_NO_NETWORK')
-
-        from bb.fetch2 import FetchConnectionCache
-        def checkstatus_init():
-            while not connection_cache_pool.full():
-                connection_cache_pool.put(FetchConnectionCache())
-
-        def checkstatus_end():
-            while not connection_cache_pool.empty():
-                connection_cache = connection_cache_pool.get()
-                connection_cache.close_connections()
-
-        def checkstatus(arg):
-            (tid, sstatefile) = arg
-
-            connection_cache = connection_cache_pool.get()
-            localdata2 = bb.data.createCopy(localdata)
-            srcuri = "file://" + sstatefile
-            localdata2.setVar('SRC_URI', srcuri)
-            bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
-
-            import traceback
-
-            try:
-                fetcher = bb.fetch2.Fetch(srcuri.split(), localdata2,
-                            connection_cache=connection_cache)
-                fetcher.checkstatus()
-                bb.debug(2, "SState: Successful fetch test for %s" % srcuri)
-                found.add(tid)
-                missed.remove(tid)
-            except bb.fetch2.FetchError as e:
-                bb.debug(2, "SState: Unsuccessful fetch test for %s (%s)\n%s" % (srcuri, repr(e), traceback.format_exc()))
-            except Exception as e:
-                bb.error("SState: cannot test %s: %s\n%s" % (srcuri, repr(e), traceback.format_exc()))
-
-            connection_cache_pool.put(connection_cache)
-
-            if progress:
-                bb.event.fire(bb.event.ProcessProgress(msg, len(tasklist) - thread_worker.tasks.qsize()), d)
-
-        tasklist = []
-        for tid in missed:
-            sstatefile = d.expand(getsstatefile(tid, siginfo, d))
-            tasklist.append((tid, sstatefile))
-
-        if tasklist:
-            nproc = min(int(d.getVar("BB_NUMBER_THREADS")), len(tasklist))
-
-            progress = len(tasklist) >= 100
-            if progress:
-                msg = "Checking sstate mirror object availability"
-                bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)
-
-            # Have to setup the fetcher environment here rather than in each thread as it would race
-            fetcherenv = bb.fetch2.get_fetcher_environment(d)
-            with bb.utils.environment(**fetcherenv):
-                bb.event.enable_threadlock()
-                import concurrent.futures
-                from queue import Queue
-                connection_cache_pool = Queue(nproc)
-                checkstatus_init()
-                with concurrent.futures.ThreadPoolExecutor(max_workers=nproc) as executor:
-                    executor.map(checkstatus, tasklist.copy())
-                checkstatus_end()
-                bb.event.disable_threadlock()
-
-            if progress:
-                bb.event.fire(bb.event.ProcessFinished(msg), d)
-
-    inheritlist = d.getVar("INHERIT")
-    if "toaster" in inheritlist:
-        evdata = {'missed': [], 'found': []};
-        for tid in missed:
-            sstatefile = d.expand(getsstatefile(tid, False, d))
-            evdata['missed'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) )
-        for tid in found:
-            sstatefile = d.expand(getsstatefile(tid, False, d))
-            evdata['found'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) )
-        bb.event.fire(bb.event.MetadataEvent("MissedSstate", evdata), d)
-
-    if summary:
-        # Print some summary statistics about the current task completion and how much sstate
-        # reuse there was. Avoid divide by zero errors.
-        total = len(sq_data['hash'])
-        complete = 0
-        if currentcount:
-            complete = (len(found) + currentcount) / (total + currentcount) * 100
-        match = 0
-        if total:
-            match = len(found) / total * 100
-        bb.plain("Sstate summary: Wanted %d Local %d Mirrors %d Missed %d Current %d (%d%% match, %d%% complete)" %
-            (total, foundLocal, len(found)-foundLocal, len(missed), currentcount, match, complete))
-
-    if hasattr(bb.parse.siggen, "checkhashes"):
-        bb.parse.siggen.checkhashes(sq_data, missed, found, d)
-
-    return found
-setscene_depvalid[vardepsexclude] = "SSTATE_EXCLUDEDEPS_SYSROOT"
-
-BB_SETSCENE_DEPVALID = "setscene_depvalid"
-
-def setscene_depvalid(task, taskdependees, notneeded, d, log=None):
-    # taskdependees is a dict of tasks which depend on task, each being a 3 item list of [PN, TASKNAME, FILENAME]
-    # task is included in taskdependees too
-    # Return - False - We need this dependency
-    #        - True - We can skip this dependency
-    import re
-
-    def logit(msg, log):
-        if log is not None:
-            log.append(msg)
-        else:
-            bb.debug(2, msg)
-
-    logit("Considering setscene task: %s" % (str(taskdependees[task])), log)
-
-    directtasks = ["do_populate_lic", "do_deploy_source_date_epoch", "do_shared_workdir", "do_stash_locale", "do_gcc_stash_builddir", "do_create_spdx"]
-
-    def isNativeCross(x):
-        return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x or x.endswith("-cross")
-
-    # We only need to trigger deploy_source_date_epoch through direct dependencies
-    if taskdependees[task][1] in directtasks:
-        return True
-
-    # We only need to trigger packagedata through direct dependencies
-    # but need to preserve packagedata on packagedata links
-    if taskdependees[task][1] == "do_packagedata":
-        for dep in taskdependees:
-            if taskdependees[dep][1] == "do_packagedata":
-                return False
-        return True
-
-    for dep in taskdependees:
-        logit("  considering dependency: %s" % (str(taskdependees[dep])), log)
-        if task == dep:
-            continue
-        if dep in notneeded:
-            continue
-        # do_package_write_* and do_package doesn't need do_package
-        if taskdependees[task][1] == "do_package" and taskdependees[dep][1] in ['do_package', 'do_package_write_deb', 'do_package_write_ipk', 'do_package_write_rpm', 'do_packagedata', 'do_package_qa']:
-            continue
-        # do_package_write_* need do_populate_sysroot as they're mainly postinstall dependencies
-        if taskdependees[task][1] == "do_populate_sysroot" and taskdependees[dep][1] in ['do_package_write_deb', 'do_package_write_ipk', 'do_package_write_rpm']:
-            return False
-        # do_package/packagedata/package_qa/deploy don't need do_populate_sysroot
-        if taskdependees[task][1] == "do_populate_sysroot" and taskdependees[dep][1] in ['do_package', 'do_packagedata', 'do_package_qa', 'do_deploy']:
-            continue
-        # Native/Cross packages don't exist and are noexec anyway
-        if isNativeCross(taskdependees[dep][0]) and taskdependees[dep][1] in ['do_package_write_deb', 'do_package_write_ipk', 'do_package_write_rpm', 'do_packagedata', 'do_package', 'do_package_qa']:
-            continue
-
-        # This is due to the [depends] in useradd.bbclass complicating matters
-        # The logic *is* reversed here due to the way hard setscene dependencies are injected
-        if (taskdependees[task][1] == 'do_package' or taskdependees[task][1] == 'do_populate_sysroot') and taskdependees[dep][0].endswith(('shadow-native', 'shadow-sysroot', 'base-passwd', 'pseudo-native')) and taskdependees[dep][1] == 'do_populate_sysroot':
-            continue
-
-        # Consider sysroot depending on sysroot tasks
-        if taskdependees[task][1] == 'do_populate_sysroot' and taskdependees[dep][1] == 'do_populate_sysroot':
-            # Allow excluding certain recursive dependencies. If a recipe needs it should add a
-            # specific dependency itself, rather than relying on one of its dependees to pull
-            # them in.
-            # See also http://lists.openembedded.org/pipermail/openembedded-core/2018-January/146324.html
-            not_needed = False
-            excludedeps = d.getVar('_SSTATE_EXCLUDEDEPS_SYSROOT')
-            if excludedeps is None:
-                # Cache the regular expressions for speed
-                excludedeps = []
-                for excl in (d.getVar('SSTATE_EXCLUDEDEPS_SYSROOT') or "").split():
-                    excludedeps.append((re.compile(excl.split('->', 1)[0]), re.compile(excl.split('->', 1)[1])))
-                d.setVar('_SSTATE_EXCLUDEDEPS_SYSROOT', excludedeps)
-            for excl in excludedeps:
-                if excl[0].match(taskdependees[dep][0]):
-                    if excl[1].match(taskdependees[task][0]):
-                        not_needed = True
-                        break
-            if not_needed:
-                continue
-            # For meta-extsdk-toolchain we want all sysroot dependencies
-            if taskdependees[dep][0] == 'meta-extsdk-toolchain':
-                return False
-            # Native/Cross populate_sysroot need their dependencies
-            if isNativeCross(taskdependees[task][0]) and isNativeCross(taskdependees[dep][0]):
-                return False
-            # Target populate_sysroot depended on by cross tools need to be installed
-            if isNativeCross(taskdependees[dep][0]):
-                return False
-            # Native/cross tools depended upon by target sysroot are not needed
-            # Add an exception for shadow-native as required by useradd.bbclass
-            if isNativeCross(taskdependees[task][0]) and taskdependees[task][0] != 'shadow-native':
-                continue
-            # Target populate_sysroot need their dependencies
-            return False
-
-        if taskdependees[dep][1] in directtasks:
-            continue
-
-        # Safe fallthrough default
-        logit(" Default setscene dependency fall through due to dependency: %s" % (str(taskdependees[dep])), log)
-        return False
-    return True
-
-addhandler sstate_eventhandler
-sstate_eventhandler[eventmask] = "bb.build.TaskSucceeded"
-python sstate_eventhandler() {
-    d = e.data
-    writtensstate = d.getVar('SSTATE_CURRTASK')
-    if not writtensstate:
-        taskname = d.getVar("BB_RUNTASK")[3:]
-        spec = d.getVar('SSTATE_PKGSPEC')
-        swspec = d.getVar('SSTATE_SWSPEC')
-        if taskname in ["fetch", "unpack", "patch", "populate_lic", "preconfigure"] and swspec:
-            d.setVar("SSTATE_PKGSPEC", "${SSTATE_SWSPEC}")
-            d.setVar("SSTATE_EXTRAPATH", "")
-        d.setVar("SSTATE_CURRTASK", taskname)
-        siginfo = d.getVar('SSTATE_PKG') + ".siginfo"
-        if not os.path.exists(siginfo):
-            bb.siggen.dump_this_task(siginfo, d)
-        else:
-            try:
-                os.utime(siginfo, None)
-            except PermissionError:
-                pass
-            except OSError as e:
-                # Handle read-only file systems gracefully
-                import errno
-                if e.errno != errno.EROFS:
-                    raise e
-
-}
-
-SSTATE_PRUNE_OBSOLETEWORKDIR ?= "1"
-
-#
-# Event handler which removes manifests and stamps file for recipes which are no
-# longer 'reachable' in a build where they once were. 'Reachable' refers to
-# whether a recipe is parsed so recipes in a layer which was removed would no
-# longer be reachable. Switching between systemd and sysvinit where recipes
-# became skipped would be another example.
-#
-# Also optionally removes the workdir of those tasks/recipes
-#
-addhandler sstate_eventhandler_reachablestamps
-sstate_eventhandler_reachablestamps[eventmask] = "bb.event.ReachableStamps"
-python sstate_eventhandler_reachablestamps() {
-    import glob
-    d = e.data
-    stamps = e.stamps.values()
-    removeworkdir = (d.getVar("SSTATE_PRUNE_OBSOLETEWORKDIR", False) == "1")
-    preservestampfile = d.expand('${SSTATE_MANIFESTS}/preserve-stamps')
-    preservestamps = []
-    if os.path.exists(preservestampfile):
-        with open(preservestampfile, 'r') as f:
-            preservestamps = f.readlines()
-    seen = []
-
-    # The machine index contains all the stamps this machine has ever seen in this build directory.
-    # We should only remove things which this machine once accessed but no longer does.
-    machineindex = set()
-    bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
-    mi = d.expand("${SSTATE_MANIFESTS}/index-machine-${MACHINE}")
-    if os.path.exists(mi):
-        with open(mi, "r") as f:
-            machineindex = set(line.strip() for line in f.readlines())
-
-    for a in sorted(list(set(d.getVar("SSTATE_ARCHS").split()))):
-        toremove = []
-        i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
-        if not os.path.exists(i):
-            continue
-        manseen = set()
-        ignore = []
-        with open(i, "r") as f:
-            lines = f.readlines()
-            for l in reversed(lines):
-                try:
-                    (stamp, manifest, workdir) = l.split()
-                    # The index may have multiple entries for the same manifest as the code above only appends
-                    # new entries and there may be an entry with matching manifest but differing version in stamp/workdir.
-                    # The last entry in the list is the valid one, any earlier entries with matching manifests
-                    # should be ignored.
-                    if manifest in manseen:
-                        ignore.append(l)
-                        continue
-                    manseen.add(manifest)
-                    if stamp not in stamps and stamp not in preservestamps and stamp in machineindex:
-                        toremove.append(l)
-                        if stamp not in seen:
-                            bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp)
-                            seen.append(stamp)
-                except ValueError:
-                    bb.fatal("Invalid line '%s' in sstate manifest '%s'" % (l, i))
-
-        if toremove:
-            msg = "Removing %d recipes from the %s sysroot" % (len(toremove), a)
-            bb.event.fire(bb.event.ProcessStarted(msg, len(toremove)), d)
-
-            removed = 0
-            for r in toremove:
-                (stamp, manifest, workdir) = r.split()
-                for m in glob.glob(manifest + ".*"):
-                    if m.endswith(".postrm"):
-                        continue
-                    sstate_clean_manifest(m, d)
-                bb.utils.remove(stamp + "*")
-                if removeworkdir:
-                    bb.utils.remove(workdir, recurse = True)
-                lines.remove(r)
-                removed = removed + 1
-                bb.event.fire(bb.event.ProcessProgress(msg, removed), d)
-
-            bb.event.fire(bb.event.ProcessFinished(msg), d)
-
-        with open(i, "w") as f:
-            for l in lines:
-                if l in ignore:
-                    continue
-                f.write(l)
-    machineindex |= set(stamps)
-    with open(mi, "w") as f:
-        for l in machineindex:
-            f.write(l + "\n")
-
-    if preservestamps:
-        os.remove(preservestampfile)
-}
-
-
-#
-# Bitbake can generate an event showing which setscene tasks are 'stale',
-# i.e. which ones will be rerun. These are ones where a stamp file is present but
-# it is stable (e.g. taskhash doesn't match). With that list we can go through
-# the manifests for matching tasks and "uninstall" those manifests now. We do
-# this now rather than mid build since the distribution of files between sstate
-# objects may have changed, new tasks may run first and if those new tasks overlap
-# with the stale tasks, we'd see overlapping files messages and failures. Thankfully
-# removing these files is fast.
-#
-addhandler sstate_eventhandler_stalesstate
-sstate_eventhandler_stalesstate[eventmask] = "bb.event.StaleSetSceneTasks"
-python sstate_eventhandler_stalesstate() {
-    d = e.data
-    tasks = e.tasks
-
-    bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
-
-    for a in list(set(d.getVar("SSTATE_ARCHS").split())):
-        toremove = []
-        i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
-        if not os.path.exists(i):
-            continue
-        with open(i, "r") as f:
-            lines = f.readlines()
-            for l in lines:
-                try:
-                    (stamp, manifest, workdir) = l.split()
-                    for tid in tasks:
-                        for s in tasks[tid]:
-                            if s.startswith(stamp):
-                                taskname = bb.runqueue.taskname_from_tid(tid)[3:]
-                                manname = manifest + "." + taskname
-                                if os.path.exists(manname):
-                                    bb.debug(2, "Sstate for %s is stale, removing related manifest %s" % (tid, manname))
-                                    toremove.append((manname, tid, tasks[tid]))
-                                    break
-                except ValueError:
-                    bb.fatal("Invalid line '%s' in sstate manifest '%s'" % (l, i))
-
-        if toremove:
-            msg = "Removing %d stale sstate objects for arch %s" % (len(toremove), a)
-            bb.event.fire(bb.event.ProcessStarted(msg, len(toremove)), d)
-
-            removed = 0
-            for (manname, tid, stamps) in toremove:
-                sstate_clean_manifest(manname, d)
-                for stamp in stamps:
-                    bb.utils.remove(stamp)
-                removed = removed + 1
-                bb.event.fire(bb.event.ProcessProgress(msg, removed), d)
-
-            bb.event.fire(bb.event.ProcessFinished(msg), d)
-}
diff --git a/poky/meta/classes/staging.bbclass b/poky/meta/classes/staging.bbclass
deleted file mode 100644
index bf8ca58..0000000
--- a/poky/meta/classes/staging.bbclass
+++ /dev/null
@@ -1,684 +0,0 @@
-# These directories will be staged in the sysroot
-SYSROOT_DIRS = " \
-    ${includedir} \
-    ${libdir} \
-    ${base_libdir} \
-    ${nonarch_base_libdir} \
-    ${datadir} \
-    /sysroot-only \
-"
-
-# These directories are also staged in the sysroot when they contain files that
-# are usable on the build system
-SYSROOT_DIRS_NATIVE = " \
-    ${bindir} \
-    ${sbindir} \
-    ${base_bindir} \
-    ${base_sbindir} \
-    ${libexecdir} \
-    ${sysconfdir} \
-    ${localstatedir} \
-"
-SYSROOT_DIRS:append:class-native = " ${SYSROOT_DIRS_NATIVE}"
-SYSROOT_DIRS:append:class-cross = " ${SYSROOT_DIRS_NATIVE}"
-SYSROOT_DIRS:append:class-crosssdk = " ${SYSROOT_DIRS_NATIVE}"
-
-# These directories will not be staged in the sysroot
-SYSROOT_DIRS_IGNORE = " \
-    ${mandir} \
-    ${docdir} \
-    ${infodir} \
-    ${datadir}/X11/locale \
-    ${datadir}/applications \
-    ${datadir}/bash-completion \
-    ${datadir}/fonts \
-    ${datadir}/gtk-doc/html \
-    ${datadir}/installed-tests \
-    ${datadir}/locale \
-    ${datadir}/pixmaps \
-    ${datadir}/terminfo \
-    ${libdir}/${BPN}/ptest \
-"
-
-sysroot_stage_dir() {
-	src="$1"
-	dest="$2"
-	# if the src doesn't exist don't do anything
-	if [ ! -d "$src" ]; then
-		 return
-	fi
-
-	mkdir -p "$dest"
-	rdest=$(realpath --relative-to="$src" "$dest")
-	(
-		cd $src
-		find . -print0 | cpio --null -pdlu $rdest
-	)
-}
-
-sysroot_stage_dirs() {
-	from="$1"
-	to="$2"
-
-	for dir in ${SYSROOT_DIRS}; do
-		sysroot_stage_dir "$from$dir" "$to$dir"
-	done
-
-	# Remove directories we do not care about
-	for dir in ${SYSROOT_DIRS_IGNORE}; do
-		rm -rf "$to$dir"
-	done
-}
-
-sysroot_stage_all() {
-	sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR}
-}
-
-python sysroot_strip () {
-    inhibit_sysroot = d.getVar('INHIBIT_SYSROOT_STRIP')
-    if inhibit_sysroot and oe.types.boolean(inhibit_sysroot):
-        return
-
-    dstdir = d.getVar('SYSROOT_DESTDIR')
-    pn = d.getVar('PN')
-    libdir = d.getVar("libdir")
-    base_libdir = d.getVar("base_libdir")
-    qa_already_stripped = 'already-stripped' in (d.getVar('INSANE_SKIP:' + pn) or "").split()
-    strip_cmd = d.getVar("STRIP")
-
-    oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d,
-                           qa_already_stripped=qa_already_stripped)
-}
-
-do_populate_sysroot[dirs] = "${SYSROOT_DESTDIR}"
-
-addtask populate_sysroot after do_install
-
-SYSROOT_PREPROCESS_FUNCS ?= ""
-SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir"
-
-python do_populate_sysroot () {
-    # SYSROOT 'version' 2
-    bb.build.exec_func("sysroot_stage_all", d)
-    bb.build.exec_func("sysroot_strip", d)
-    for f in (d.getVar('SYSROOT_PREPROCESS_FUNCS') or '').split():
-        bb.build.exec_func(f, d)
-    pn = d.getVar("PN")
-    multiprov = d.getVar("BB_MULTI_PROVIDER_ALLOWED").split()
-    provdir = d.expand("${SYSROOT_DESTDIR}${base_prefix}/sysroot-providers/")
-    bb.utils.mkdirhier(provdir)
-    for p in d.getVar("PROVIDES").split():
-        if p in multiprov:
-            continue
-        p = p.replace("/", "_")
-        with open(provdir + p, "w") as f:
-            f.write(pn)
-}
-
-do_populate_sysroot[vardeps] += "${SYSROOT_PREPROCESS_FUNCS}"
-do_populate_sysroot[vardepsexclude] += "BB_MULTI_PROVIDER_ALLOWED"
-
-POPULATESYSROOTDEPS = ""
-POPULATESYSROOTDEPS:class-target = "virtual/${MLPREFIX}${HOST_PREFIX}binutils:do_populate_sysroot"
-POPULATESYSROOTDEPS:class-nativesdk = "virtual/${HOST_PREFIX}binutils-crosssdk:do_populate_sysroot"
-do_populate_sysroot[depends] += "${POPULATESYSROOTDEPS}"
-
-SSTATETASKS += "do_populate_sysroot"
-do_populate_sysroot[cleandirs] = "${SYSROOT_DESTDIR}"
-do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}"
-do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
-do_populate_sysroot[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
-
-python do_populate_sysroot_setscene () {
-    sstate_setscene(d)
-}
-addtask do_populate_sysroot_setscene
-
-def staging_copyfile(c, target, dest, postinsts, seendirs):
-    import errno
-
-    destdir = os.path.dirname(dest)
-    if destdir not in seendirs:
-        bb.utils.mkdirhier(destdir)
-        seendirs.add(destdir)
-    if "/usr/bin/postinst-" in c:
-        postinsts.append(dest)
-    if os.path.islink(c):
-        linkto = os.readlink(c)
-        if os.path.lexists(dest):
-            if not os.path.islink(dest):
-                raise OSError(errno.EEXIST, "Link %s already exists as a file" % dest, dest)
-            if os.readlink(dest) == linkto:
-                return dest
-            raise OSError(errno.EEXIST, "Link %s already exists to a different location? (%s vs %s)" % (dest, os.readlink(dest), linkto), dest)
-        os.symlink(linkto, dest)
-        #bb.warn(c)
-    else:
-        try:
-            os.link(c, dest)
-        except OSError as err:
-            if err.errno == errno.EXDEV:
-                bb.utils.copyfile(c, dest)
-            else:
-                raise
-    return dest
-
-def staging_copydir(c, target, dest, seendirs):
-    if dest not in seendirs:
-        bb.utils.mkdirhier(dest)
-        seendirs.add(dest)
-
-def staging_processfixme(fixme, target, recipesysroot, recipesysrootnative, d):
-    import subprocess
-
-    if not fixme:
-        return
-    cmd = "sed -e 's:^[^/]*/:%s/:g' %s | xargs sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (target, " ".join(fixme), recipesysroot, recipesysrootnative)
-    for fixmevar in ['PSEUDO_SYSROOT', 'HOSTTOOLS_DIR', 'PKGDATA_DIR', 'PSEUDO_LOCALSTATEDIR', 'LOGFIFO']:
-        fixme_path = d.getVar(fixmevar)
-        cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
-    bb.debug(2, cmd)
-    subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
-
-def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
-    import glob
-    import subprocess
-    import errno
-
-    fixme = []
-    postinsts = []
-    seendirs = set()
-    stagingdir = d.getVar("STAGING_DIR")
-    if native:
-        pkgarchs = ['${BUILD_ARCH}', '${BUILD_ARCH}_*']
-        targetdir = nativesysroot
-    else:
-        pkgarchs = ['${MACHINE_ARCH}']
-        pkgarchs = pkgarchs + list(reversed(d.getVar("PACKAGE_EXTRA_ARCHS").split()))
-        pkgarchs.append('allarch')
-        targetdir = targetsysroot
-
-    bb.utils.mkdirhier(targetdir)
-    for pkgarch in pkgarchs:
-        for manifest in glob.glob(d.expand("${SSTATE_MANIFESTS}/manifest-%s-*.populate_sysroot" % pkgarch)):
-            if manifest.endswith("-initial.populate_sysroot"):
-                # skip libgcc-initial due to file overlap
-                continue
-            if not native and (manifest.endswith("-native.populate_sysroot") or "nativesdk-" in manifest):
-                continue
-            if native and not (manifest.endswith("-native.populate_sysroot") or manifest.endswith("-cross.populate_sysroot") or "-cross-" in manifest):
-                continue
-            tmanifest = targetdir + "/" + os.path.basename(manifest)
-            if os.path.exists(tmanifest):
-                continue
-            try:
-                os.link(manifest, tmanifest)
-            except OSError as err:
-                if err.errno == errno.EXDEV:
-                    bb.utils.copyfile(manifest, tmanifest)
-                else:
-                    raise
-            with open(manifest, "r") as f:
-                for l in f:
-                    l = l.strip()
-                    if l.endswith("/fixmepath"):
-                        fixme.append(l)
-                        continue
-                    if l.endswith("/fixmepath.cmd"):
-                        continue
-                    dest = l.replace(stagingdir, "")
-                    dest = targetdir + "/" + "/".join(dest.split("/")[3:])
-                    if l.endswith("/"):
-                        staging_copydir(l, targetdir, dest, seendirs)
-                        continue
-                    try:
-                        staging_copyfile(l, targetdir, dest, postinsts, seendirs)
-                    except FileExistsError:
-                        continue
-
-    staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d)
-    for p in postinsts:
-        subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT)
-
-#
-# Manifests here are complicated. The main sysroot area has the unpacked sstate
-# which us unrelocated and tracked by the main sstate manifests. Each recipe
-# specific sysroot has manifests for each dependency that is installed there.
-# The task hash is used to tell whether the data needs to be reinstalled. We
-# use a symlink to point to the currently installed hash. There is also a
-# "complete" stamp file which is used to mark if installation completed. If
-# something fails (e.g. a postinst), this won't get written and we would
-# remove and reinstall the dependency. This also means partially installed
-# dependencies should get cleaned up correctly.
-#
-
-python extend_recipe_sysroot() {
-    import copy
-    import subprocess
-    import errno
-    import collections
-    import glob
-
-    taskdepdata = d.getVar("BB_TASKDEPDATA", False)
-    mytaskname = d.getVar("BB_RUNTASK")
-    if mytaskname.endswith("_setscene"):
-        mytaskname = mytaskname.replace("_setscene", "")
-    workdir = d.getVar("WORKDIR")
-    #bb.warn(str(taskdepdata))
-    pn = d.getVar("PN")
-    stagingdir = d.getVar("STAGING_DIR")
-    sharedmanifests = d.getVar("COMPONENTS_DIR") + "/manifests"
-    recipesysroot = d.getVar("RECIPE_SYSROOT")
-    recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE")
-
-    # Detect bitbake -b usage
-    nodeps = d.getVar("BB_LIMITEDDEPS") or False
-    if nodeps:
-        lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock")
-        staging_populate_sysroot_dir(recipesysroot, recipesysrootnative, True, d)
-        staging_populate_sysroot_dir(recipesysroot, recipesysrootnative, False, d)
-        bb.utils.unlockfile(lock)
-        return
-
-    start = None
-    configuredeps = []
-    owntaskdeps = []
-    for dep in taskdepdata:
-        data = taskdepdata[dep]
-        if data[1] == mytaskname and data[0] == pn:
-            start = dep
-        elif data[0] == pn:
-            owntaskdeps.append(data[1])
-    if start is None:
-        bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
-
-    # We need to figure out which sysroot files we need to expose to this task.
-    # This needs to match what would get restored from sstate, which is controlled
-    # ultimately by calls from bitbake to setscene_depvalid().
-    # That function expects a setscene dependency tree. We build a dependency tree
-    # condensed to inter-sstate task dependencies, similar to that used by setscene
-    # tasks. We can then call into setscene_depvalid() and decide
-    # which dependencies we can "see" and should expose in the recipe specific sysroot.
-    setscenedeps = copy.deepcopy(taskdepdata)
-
-    start = set([start])
-
-    sstatetasks = d.getVar("SSTATETASKS").split()
-    # Add recipe specific tasks referenced by setscene_depvalid()
-    sstatetasks.append("do_stash_locale")
-    sstatetasks.append("do_deploy")
-
-    def print_dep_tree(deptree):
-        data = ""
-        for dep in deptree:
-            deps = "    " + "\n    ".join(deptree[dep][3]) + "\n"
-            data = data + "%s:\n  %s\n  %s\n%s  %s\n  %s\n" % (deptree[dep][0], deptree[dep][1], deptree[dep][2], deps, deptree[dep][4], deptree[dep][5])
-        return data
-
-    #bb.note("Full dep tree is:\n%s" % print_dep_tree(taskdepdata))
-
-    #bb.note(" start2 is %s" % str(start))
-
-    # If start is an sstate task (like do_package) we need to add in its direct dependencies
-    # else the code below won't recurse into them.
-    for dep in set(start):
-        for dep2 in setscenedeps[dep][3]:
-            start.add(dep2)
-        start.remove(dep)
-
-    #bb.note(" start3 is %s" % str(start))
-
-    # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
-    for dep in taskdepdata:
-        data = setscenedeps[dep]
-        if data[1] not in sstatetasks:
-            for dep2 in setscenedeps:
-                data2 = setscenedeps[dep2]
-                if dep in data2[3]:
-                    data2[3].update(setscenedeps[dep][3])
-                    data2[3].remove(dep)
-            if dep in start:
-                start.update(setscenedeps[dep][3])
-                start.remove(dep)
-            del setscenedeps[dep]
-
-    # Remove circular references
-    for dep in setscenedeps:
-        if dep in setscenedeps[dep][3]:
-            setscenedeps[dep][3].remove(dep)
-
-    #bb.note("Computed dep tree is:\n%s" % print_dep_tree(setscenedeps))
-    #bb.note(" start is %s" % str(start))
-
-    # Direct dependencies should be present and can be depended upon
-    for dep in sorted(set(start)):
-        if setscenedeps[dep][1] == "do_populate_sysroot":
-            if dep not in configuredeps:
-                configuredeps.append(dep)
-    bb.note("Direct dependencies are %s" % str(configuredeps))
-    #bb.note(" or %s" % str(start))
-
-    msgbuf = []
-    # Call into setscene_depvalid for each sub-dependency and only copy sysroot files
-    # for ones that would be restored from sstate.
-    done = list(start)
-    next = list(start)
-    while next:
-        new = []
-        for dep in next:
-            data = setscenedeps[dep]
-            for datadep in data[3]:
-                if datadep in done:
-                    continue
-                taskdeps = {}
-                taskdeps[dep] = setscenedeps[dep][:2]
-                taskdeps[datadep] = setscenedeps[datadep][:2]
-                retval = setscene_depvalid(datadep, taskdeps, [], d, msgbuf)
-                if retval:
-                    msgbuf.append("Skipping setscene dependency %s for installation into the sysroot" % datadep)
-                    continue
-                done.append(datadep)
-                new.append(datadep)
-                if datadep not in configuredeps and setscenedeps[datadep][1] == "do_populate_sysroot":
-                    configuredeps.append(datadep)
-                    msgbuf.append("Adding dependency on %s" % setscenedeps[datadep][0])
-                else:
-                    msgbuf.append("Following dependency on %s" % setscenedeps[datadep][0])
-        next = new
-
-    # This logging is too verbose for day to day use sadly
-    #bb.debug(2, "\n".join(msgbuf))
-
-    depdir = recipesysrootnative + "/installeddeps"
-    bb.utils.mkdirhier(depdir)
-    bb.utils.mkdirhier(sharedmanifests)
-
-    lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock")
-
-    fixme = {}
-    seendirs = set()
-    postinsts = []
-    multilibs = {}
-    manifests = {}
-    # All files that we're going to be installing, to find conflicts.
-    fileset = {}
-
-    invalidate_tasks = set()
-    for f in os.listdir(depdir):
-        removed = []
-        if not f.endswith(".complete"):
-            continue
-        f = depdir + "/" + f
-        if os.path.islink(f) and not os.path.exists(f):
-            bb.note("%s no longer exists, removing from sysroot" % f)
-            lnk = os.readlink(f.replace(".complete", ""))
-            sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
-            os.unlink(f)
-            os.unlink(f.replace(".complete", ""))
-            removed.append(os.path.basename(f.replace(".complete", "")))
-
-        # If we've removed files from the sysroot above, the task that installed them may still
-        # have a stamp file present for the task. This is probably invalid right now but may become
-        # valid again if the user were to change configuration back for example. Since we've removed
-        # the files a task might need, remove the stamp file too to force it to rerun.
-        # YOCTO #14790
-        if removed:
-            for i in glob.glob(depdir + "/index.*"):
-                if i.endswith("." + mytaskname):
-                    continue
-                with open(i, "r") as f:
-                    for l in f:
-                        if l.startswith("TaskDeps:"):
-                            continue
-                        l = l.strip()
-                        if l in removed:
-                            invalidate_tasks.add(i.rsplit(".", 1)[1])
-                            break
-    for t in invalidate_tasks:
-        bb.note("Invalidating stamps for task %s" % t)
-        bb.build.clean_stamp(t, d)
-
-    installed = []
-    for dep in configuredeps:
-        c = setscenedeps[dep][0]
-        if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"):
-            bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c)
-            continue
-        installed.append(c)
-
-    # We want to remove anything which this task previously installed but is no longer a dependency
-    taskindex = depdir + "/" + "index." + mytaskname
-    if os.path.exists(taskindex):
-        potential = []
-        with open(taskindex, "r") as f:
-            for l in f:
-                l = l.strip()
-                if l not in installed:
-                    fl = depdir + "/" + l
-                    if not os.path.exists(fl):
-                        # Was likely already uninstalled
-                        continue
-                    potential.append(l)
-        # We need to ensure no other task needs this dependency. We hold the sysroot
-        # lock so we ca search the indexes to check
-        if potential:
-            for i in glob.glob(depdir + "/index.*"):
-                if i.endswith("." + mytaskname):
-                    continue
-                with open(i, "r") as f:
-                    for l in f:
-                        if l.startswith("TaskDeps:"):
-                            prevtasks = l.split()[1:]
-                            if mytaskname in prevtasks:
-                                # We're a dependency of this task so we can clear items out the sysroot
-                                break
-                        l = l.strip()
-                        if l in potential:
-                            potential.remove(l)
-        for l in potential:
-            fl = depdir + "/" + l
-            bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
-            lnk = os.readlink(fl)
-            sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
-            os.unlink(fl)
-            os.unlink(fl + ".complete")
-
-    msg_exists = []
-    msg_adding = []
-
-    # Handle all removals first since files may move between recipes
-    for dep in configuredeps:
-        c = setscenedeps[dep][0]
-        if c not in installed:
-            continue
-        taskhash = setscenedeps[dep][5]
-        taskmanifest = depdir + "/" + c + "." + taskhash
-
-        if os.path.exists(depdir + "/" + c):
-            lnk = os.readlink(depdir + "/" + c)
-            if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
-                continue
-            else:
-                bb.note("%s exists in sysroot, but is stale (%s vs. %s), removing." % (c, lnk, c + "." + taskhash))
-                sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
-                os.unlink(depdir + "/" + c)
-                if os.path.lexists(depdir + "/" + c + ".complete"):
-                    os.unlink(depdir + "/" + c + ".complete")
-        elif os.path.lexists(depdir + "/" + c):
-            os.unlink(depdir + "/" + c)
-
-    binfiles = {}
-    # Now handle installs
-    for dep in configuredeps:
-        c = setscenedeps[dep][0]
-        if c not in installed:
-            continue
-        taskhash = setscenedeps[dep][5]
-        taskmanifest = depdir + "/" + c + "." + taskhash
-
-        if os.path.exists(depdir + "/" + c):
-            lnk = os.readlink(depdir + "/" + c)
-            if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
-                msg_exists.append(c)
-                continue
-
-        msg_adding.append(c)
-
-        os.symlink(c + "." + taskhash, depdir + "/" + c)
-
-        manifest, d2 = oe.sstatesig.find_sstate_manifest(c, setscenedeps[dep][2], "populate_sysroot", d, multilibs)
-        if d2 is not d:
-            # If we don't do this, the recipe sysroot will be placed in the wrong WORKDIR for multilibs
-            # We need a consistent WORKDIR for the image
-            d2.setVar("WORKDIR", d.getVar("WORKDIR"))
-        destsysroot = d2.getVar("RECIPE_SYSROOT")
-        # We put allarch recipes into the default sysroot
-        if manifest and "allarch" in manifest:
-            destsysroot = d.getVar("RECIPE_SYSROOT")
-
-        native = False
-        if c.endswith("-native") or "-cross-" in c or "-crosssdk" in c:
-            native = True
-
-        if manifest:
-            newmanifest = collections.OrderedDict()
-            targetdir = destsysroot
-            if native:
-                targetdir = recipesysrootnative
-            if targetdir not in fixme:
-                fixme[targetdir] = []
-            fm = fixme[targetdir]
-
-            with open(manifest, "r") as f:
-                manifests[dep] = manifest
-                for l in f:
-                    l = l.strip()
-                    if l.endswith("/fixmepath"):
-                        fm.append(l)
-                        continue
-                    if l.endswith("/fixmepath.cmd"):
-                        continue
-                    dest = l.replace(stagingdir, "")
-                    dest = "/" + "/".join(dest.split("/")[3:])
-                    newmanifest[l] = targetdir + dest
-
-                    # Check if files have already been installed by another
-                    # recipe and abort if they have, explaining what recipes are
-                    # conflicting.
-                    hashname = targetdir + dest
-                    if not hashname.endswith("/"):
-                        if hashname in fileset:
-                            bb.fatal("The file %s is installed by both %s and %s, aborting" % (dest, c, fileset[hashname]))
-                        else:
-                            fileset[hashname] = c
-
-            # Having multiple identical manifests in each sysroot eats diskspace so
-            # create a shared pool of them and hardlink if we can.
-            # We create the manifest in advance so that if something fails during installation,
-            # or the build is interrupted, subsequent exeuction can cleanup.
-            sharedm = sharedmanifests + "/" + os.path.basename(taskmanifest)
-            if not os.path.exists(sharedm):
-                smlock = bb.utils.lockfile(sharedm + ".lock")
-                # Can race here. You'd think it just means we may not end up with all copies hardlinked to each other
-                # but python can lose file handles so we need to do this under a lock.
-                if not os.path.exists(sharedm):
-                    with open(sharedm, 'w') as m:
-                       for l in newmanifest:
-                           dest = newmanifest[l]
-                           m.write(dest.replace(workdir + "/", "") + "\n")
-                bb.utils.unlockfile(smlock)
-            try:
-                os.link(sharedm, taskmanifest)
-            except OSError as err:
-                if err.errno == errno.EXDEV:
-                    bb.utils.copyfile(sharedm, taskmanifest)
-                else:
-                    raise
-            # Finally actually install the files
-            for l in newmanifest:
-                    dest = newmanifest[l]
-                    if l.endswith("/"):
-                        staging_copydir(l, targetdir, dest, seendirs)
-                        continue
-                    if "/bin/" in l or "/sbin/" in l:
-                        # defer /*bin/* files until last in case they need libs
-                        binfiles[l] = (targetdir, dest)
-                    else:
-                        staging_copyfile(l, targetdir, dest, postinsts, seendirs)
-
-    # Handle deferred binfiles
-    for l in binfiles:
-        (targetdir, dest) = binfiles[l]
-        staging_copyfile(l, targetdir, dest, postinsts, seendirs)
-
-    bb.note("Installed into sysroot: %s" % str(msg_adding))
-    bb.note("Skipping as already exists in sysroot: %s" % str(msg_exists))
-
-    for f in fixme:
-        staging_processfixme(fixme[f], f, recipesysroot, recipesysrootnative, d)
-
-    for p in postinsts:
-        subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT)
-
-    for dep in manifests:
-        c = setscenedeps[dep][0]
-        os.symlink(manifests[dep], depdir + "/" + c + ".complete")
-
-    with open(taskindex, "w") as f:
-        f.write("TaskDeps: " + " ".join(owntaskdeps) + "\n")
-        for l in sorted(installed):
-            f.write(l + "\n")
-
-    bb.utils.unlockfile(lock)
-}
-extend_recipe_sysroot[vardepsexclude] += "MACHINE_ARCH PACKAGE_EXTRA_ARCHS SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA"
-
-do_prepare_recipe_sysroot[deptask] = "do_populate_sysroot"
-python do_prepare_recipe_sysroot () {
-    bb.build.exec_func("extend_recipe_sysroot", d)
-}
-addtask do_prepare_recipe_sysroot before do_configure after do_fetch
-
-python staging_taskhandler() {
-    bbtasks = e.tasklist
-    for task in bbtasks:
-        deps = d.getVarFlag(task, "depends")
-        if task == "do_configure" or (deps and "populate_sysroot" in deps):
-            d.prependVarFlag(task, "prefuncs", "extend_recipe_sysroot ")
-}
-staging_taskhandler[eventmask] = "bb.event.RecipeTaskPreProcess"
-addhandler staging_taskhandler
-
-
-#
-# Target build output, stored in do_populate_sysroot or do_package can depend
-# not only upon direct dependencies but also indirect ones. A good example is
-# linux-libc-headers. The toolchain depends on this but most target recipes do
-# not. There are some headers which are not used by the toolchain build and do
-# not change the toolchain task output, hence the task hashes can change without
-# changing the sysroot output of that recipe yet they can influence others.
-#
-# A specific example is rtc.h which can change rtcwake.c in util-linux but is not
-# used in the glibc or gcc build. To account for this, we need to account for the
-# populate_sysroot hashes in the task output hashes.
-#
-python target_add_sysroot_deps () {
-    current_task = "do_" + d.getVar("BB_CURRENTTASK")
-    if current_task not in ["do_populate_sysroot", "do_package"]:
-        return
-
-    pn = d.getVar("PN")
-    if pn.endswith("-native"):
-        return
-
-    taskdepdata = d.getVar("BB_TASKDEPDATA", False)
-    deps = {}
-    for dep in taskdepdata.values():
-        if dep[1] == "do_populate_sysroot" and not dep[0].endswith(("-native", "-initial")) and "-cross-" not in dep[0] and dep[0] != pn:
-            deps[dep[0]] = dep[6]
-
-    d.setVar("HASHEQUIV_EXTRA_SIGDATA", "\n".join("%s: %s" % (k, deps[k]) for k in sorted(deps.keys())))
-}
-SSTATECREATEFUNCS += "target_add_sysroot_deps"
-
diff --git a/poky/meta/classes/syslinux.bbclass b/poky/meta/classes/syslinux.bbclass
deleted file mode 100644
index 894f6b3..0000000
--- a/poky/meta/classes/syslinux.bbclass
+++ /dev/null
@@ -1,194 +0,0 @@
-# syslinux.bbclass
-# Copyright (C) 2004-2006, Advanced Micro Devices, Inc.  All Rights Reserved
-# Released under the MIT license (see packages/COPYING)
-
-# Provide syslinux specific functions for building bootable images.
-
-# External variables
-# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional)
-# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
-# ${AUTO_SYSLINUXMENU} - set this to 1 to enable creating an automatic menu
-# ${LABELS} - a list of targets for the automatic config
-# ${APPEND} - an override list of append strings for each label
-# ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
-# ${SYSLINUX_SPLASH} - A background for the vga boot menu if using the boot menu
-# ${SYSLINUX_DEFAULT_CONSOLE} - set to "console=ttyX" to change kernel boot default console
-# ${SYSLINUX_SERIAL} - Set an alternate serial port or turn off serial with empty string
-# ${SYSLINUX_SERIAL_TTY} - Set alternate console=tty... kernel boot argument
-# ${SYSLINUX_KERNEL_ARGS} - Add additional kernel arguments
-
-do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \
-                        syslinux-native:do_populate_sysroot"
-
-ISOLINUXDIR ?= "/isolinux"
-SYSLINUXDIR = "/"
-# The kernel has an internal default console, which you can override with
-# a console=...some_tty...
-SYSLINUX_DEFAULT_CONSOLE ?= ""
-SYSLINUX_SERIAL ?= "0 115200"
-SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200"
-SYSLINUX_PROMPT ?= "0"
-SYSLINUX_TIMEOUT ?= "50"
-AUTO_SYSLINUXMENU ?= "1"
-SYSLINUX_ALLOWOPTIONS ?= "1"
-SYSLINUX_ROOT ?= "${ROOT}"
-SYSLINUX_CFG_VM  ?= "${S}/syslinux_vm.cfg"
-SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg"
-APPEND ?= ""
-
-# Need UUID utility code.
-inherit fs-uuid
-
-syslinux_populate() {
-	DEST=$1
-	BOOTDIR=$2
-	CFGNAME=$3
-
-	install -d ${DEST}${BOOTDIR}
-
-	# Install the config files
-	install -m 0644 ${SYSLINUX_CFG} ${DEST}${BOOTDIR}/${CFGNAME}
-	if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then
-		install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${DEST}${BOOTDIR}/vesamenu.c32
-		install -m 0444 ${STAGING_DATADIR}/syslinux/libcom32.c32 ${DEST}${BOOTDIR}/libcom32.c32
-		install -m 0444 ${STAGING_DATADIR}/syslinux/libutil.c32 ${DEST}${BOOTDIR}/libutil.c32
-		if [ "${SYSLINUX_SPLASH}" != "" ] ; then
-			install -m 0644 ${SYSLINUX_SPLASH} ${DEST}${BOOTDIR}/splash.lss
-		fi
-	fi
-}
-
-syslinux_iso_populate() {
-	iso_dir=$1
-	syslinux_populate $iso_dir ${ISOLINUXDIR} isolinux.cfg
-	install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin $iso_dir${ISOLINUXDIR}
-	install -m 0644 ${STAGING_DATADIR}/syslinux/ldlinux.c32 $iso_dir${ISOLINUXDIR}
-}
-
-syslinux_hddimg_populate() {
-	hdd_dir=$1
-	syslinux_populate $hdd_dir ${SYSLINUXDIR} syslinux.cfg
-	install -m 0444 ${STAGING_DATADIR}/syslinux/ldlinux.sys $hdd_dir${SYSLINUXDIR}/ldlinux.sys
-}
-
-syslinux_hddimg_install() {
-	syslinux ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg
-}
-
-python build_syslinux_cfg () {
-    import copy
-    import sys
-
-    workdir = d.getVar('WORKDIR')
-    if not workdir:
-        bb.error("WORKDIR not defined, unable to package")
-        return
-        
-    labels = d.getVar('LABELS')
-    if not labels:
-        bb.debug(1, "LABELS not defined, nothing to do")
-        return
-    
-    if labels == []:
-        bb.debug(1, "No labels, nothing to do")
-        return
-
-    cfile = d.getVar('SYSLINUX_CFG')
-    if not cfile:
-        bb.fatal('Unable to read SYSLINUX_CFG')
-
-    try:
-        cfgfile = open(cfile, 'w')
-    except OSError:
-        bb.fatal('Unable to open %s' % cfile)
-
-    cfgfile.write('# Automatically created by OE\n')
-
-    opts = d.getVar('SYSLINUX_OPTS')
-
-    if opts:
-        for opt in opts.split(';'):
-            cfgfile.write('%s\n' % opt)
-
-    allowoptions = d.getVar('SYSLINUX_ALLOWOPTIONS')
-    if allowoptions:
-        cfgfile.write('ALLOWOPTIONS %s\n' % allowoptions)
-    else:
-        cfgfile.write('ALLOWOPTIONS 1\n')
-
-    syslinux_default_console = d.getVar('SYSLINUX_DEFAULT_CONSOLE')
-    syslinux_serial_tty = d.getVar('SYSLINUX_SERIAL_TTY')
-    syslinux_serial = d.getVar('SYSLINUX_SERIAL')
-    if syslinux_serial:
-        cfgfile.write('SERIAL %s\n' % syslinux_serial)
-
-    menu = (d.getVar('AUTO_SYSLINUXMENU') == "1")
-
-    if menu and syslinux_serial:
-        cfgfile.write('DEFAULT Graphics console %s\n' % (labels.split()[0]))
-    else:
-        cfgfile.write('DEFAULT %s\n' % (labels.split()[0]))
-
-    timeout = d.getVar('SYSLINUX_TIMEOUT')
-
-    if timeout:
-        cfgfile.write('TIMEOUT %s\n' % timeout)
-    else:
-        cfgfile.write('TIMEOUT 50\n')
-
-    prompt = d.getVar('SYSLINUX_PROMPT')
-    if prompt:
-        cfgfile.write('PROMPT %s\n' % prompt)
-    else:
-        cfgfile.write('PROMPT 1\n')
-
-    if menu:
-        cfgfile.write('ui vesamenu.c32\n')
-        cfgfile.write('menu title Select kernel options and boot kernel\n')
-        cfgfile.write('menu tabmsg Press [Tab] to edit, [Return] to select\n')
-        splash = d.getVar('SYSLINUX_SPLASH')
-        if splash:
-            cfgfile.write('menu background splash.lss\n')
-    
-    for label in labels.split():
-        localdata = bb.data.createCopy(d)
-
-        overrides = localdata.getVar('OVERRIDES')
-        if not overrides:
-            bb.fatal('OVERRIDES not defined')
-
-        localdata.setVar('OVERRIDES', label + ':' + overrides)
-    
-        btypes = [ [ "", syslinux_default_console ] ]
-        if menu and syslinux_serial:
-            btypes = [ [ "Graphics console ", syslinux_default_console  ],
-                [ "Serial console ", syslinux_serial_tty ] ]
-
-        root= d.getVar('SYSLINUX_ROOT')
-        if not root:
-            bb.fatal('SYSLINUX_ROOT not defined')
-
-        kernel = localdata.getVar('KERNEL_IMAGETYPE')
-        for btype in btypes:
-            cfgfile.write('LABEL %s%s\nKERNEL /%s\n' % (btype[0], label, kernel))
-
-            exargs = d.getVar('SYSLINUX_KERNEL_ARGS')
-            if exargs:
-                btype[1] += " " + exargs
-
-            append = localdata.getVar('APPEND')
-            initrd = localdata.getVar('INITRD')
-
-            append = root + " " + append
-            cfgfile.write('APPEND ')
-
-            if initrd:
-                cfgfile.write('initrd=/initrd ')
-
-            cfgfile.write('LABEL=%s '% (label))
-            append = replace_rootfs_uuid(d, append)
-            cfgfile.write('%s %s\n' % (append, btype[1]))
-
-    cfgfile.close()
-}
-build_syslinux_cfg[dirs] = "${S}"
diff --git a/poky/meta/classes/systemd-boot-cfg.bbclass b/poky/meta/classes/systemd-boot-cfg.bbclass
deleted file mode 100644
index b3e0e6a..0000000
--- a/poky/meta/classes/systemd-boot-cfg.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
-SYSTEMD_BOOT_ENTRIES ?= ""
-SYSTEMD_BOOT_TIMEOUT ?= "10"
-
-# Uses MACHINE specific KERNEL_IMAGETYPE
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-# Need UUID utility code.
-inherit fs-uuid
-
-python build_efi_cfg() {
-    s = d.getVar("S")
-    labels = d.getVar('LABELS')
-    if not labels:
-        bb.debug(1, "LABELS not defined, nothing to do")
-        return
-
-    if labels == []:
-        bb.debug(1, "No labels, nothing to do")
-        return
-
-    cfile = d.getVar('SYSTEMD_BOOT_CFG')
-    cdir = os.path.dirname(cfile)
-    if not os.path.exists(cdir):
-        os.makedirs(cdir)
-    try:
-         cfgfile = open(cfile, 'w')
-    except OSError:
-        bb.fatal('Unable to open %s' % cfile)
-
-    cfgfile.write('# Automatically created by OE\n')
-    cfgfile.write('default %s\n' % (labels.split()[0]))
-    timeout = d.getVar('SYSTEMD_BOOT_TIMEOUT')
-    if timeout:
-        cfgfile.write('timeout %s\n' % timeout)
-    else:
-        cfgfile.write('timeout 10\n')
-    cfgfile.close()
-
-    for label in labels.split():
-        localdata = d.createCopy()
-
-        entryfile = "%s/%s.conf" % (s, label)
-        if not os.path.exists(s):
-            os.makedirs(s)
-        d.appendVar("SYSTEMD_BOOT_ENTRIES", " " + entryfile)
-        try:
-            entrycfg = open(entryfile, "w")
-        except OSError:
-            bb.fatal('Unable to open %s' % entryfile)
-
-        entrycfg.write('title %s\n' % label)
-
-        kernel = localdata.getVar("KERNEL_IMAGETYPE")
-        entrycfg.write('linux /%s\n' % kernel)
-
-        append = localdata.getVar('APPEND')
-        initrd = localdata.getVar('INITRD')
-
-        if initrd:
-            entrycfg.write('initrd /initrd\n')
-        lb = label
-        if label == "install":
-            lb = "install-efi"
-        entrycfg.write('options LABEL=%s ' % lb)
-        if append:
-            append = replace_rootfs_uuid(d, append)
-            entrycfg.write('%s' % append)
-        entrycfg.write('\n')
-        entrycfg.close()
-}
diff --git a/poky/meta/classes/systemd-boot.bbclass b/poky/meta/classes/systemd-boot.bbclass
deleted file mode 100644
index 57ec0ac..0000000
--- a/poky/meta/classes/systemd-boot.bbclass
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2016 Intel Corporation
-#
-# Released under the MIT license (see COPYING.MIT)
-
-# systemd-boot.bbclass - The "systemd-boot" is essentially the gummiboot merged into systemd.
-#                        The original standalone gummiboot project is dead without any more
-#                        maintenance.
-#
-# Set EFI_PROVIDER = "systemd-boot" to use systemd-boot on your live images instead of grub-efi
-# (images built by image-live.bbclass)
-
-do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
-
-require conf/image-uefi.conf
-# Need UUID utility code.
-inherit fs-uuid
-
-efi_populate() {
-        efi_populate_common "$1" systemd
-
-        # systemd-boot requires these paths for configuration files
-        # they are not customizable so no point in new vars
-        install -d ${DEST}/loader
-        install -d ${DEST}/loader/entries
-        install -m 0644 ${SYSTEMD_BOOT_CFG} ${DEST}/loader/loader.conf
-        for i in ${SYSTEMD_BOOT_ENTRIES}; do
-            install -m 0644 ${i} ${DEST}/loader/entries
-        done
-}
-
-efi_iso_populate:append() {
-        cp -r $iso_dir/loader ${EFIIMGDIR}
-}
-
-inherit systemd-boot-cfg
diff --git a/poky/meta/classes/systemd.bbclass b/poky/meta/classes/systemd.bbclass
deleted file mode 100644
index 09ec527..0000000
--- a/poky/meta/classes/systemd.bbclass
+++ /dev/null
@@ -1,233 +0,0 @@
-# The list of packages that should have systemd packaging scripts added.  For
-# each entry, optionally have a SYSTEMD_SERVICE:[package] that lists the service
-# files in this package.  If this variable isn't set, [package].service is used.
-SYSTEMD_PACKAGES ?= "${PN}"
-SYSTEMD_PACKAGES:class-native ?= ""
-SYSTEMD_PACKAGES:class-nativesdk ?= ""
-
-# Whether to enable or disable the services on installation.
-SYSTEMD_AUTO_ENABLE ??= "enable"
-
-# This class will be included in any recipe that supports systemd init scripts,
-# even if systemd is not in DISTRO_FEATURES.  As such don't make any changes
-# directly but check the DISTRO_FEATURES first.
-python __anonymous() {
-    # If the distro features have systemd but not sysvinit, inhibit update-rcd
-    # from doing any work so that pure-systemd images don't have redundant init
-    # files.
-    if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
-        d.appendVar("DEPENDS", " systemd-systemctl-native")
-        d.appendVar("PACKAGE_WRITE_DEPS", " systemd-systemctl-native")
-        if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
-            d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
-}
-
-systemd_postinst() {
-if systemctl >/dev/null 2>/dev/null; then
-	OPTS=""
-
-	if [ -n "$D" ]; then
-		OPTS="--root=$D"
-	fi
-
-	if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
-		for service in ${SYSTEMD_SERVICE_ESCAPED}; do
-			systemctl ${OPTS} enable "$service"
-		done
-	fi
-
-	if [ -z "$D" ]; then
-		systemctl daemon-reload
-		systemctl preset ${SYSTEMD_SERVICE_ESCAPED}
-
-		if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
-			systemctl --no-block restart ${SYSTEMD_SERVICE_ESCAPED}
-		fi
-	fi
-fi
-}
-
-systemd_prerm() {
-if systemctl >/dev/null 2>/dev/null; then
-	if [ -z "$D" ]; then
-		systemctl stop ${SYSTEMD_SERVICE_ESCAPED}
-
-		systemctl disable ${SYSTEMD_SERVICE_ESCAPED}
-	fi
-fi
-}
-
-
-systemd_populate_packages[vardeps] += "systemd_prerm systemd_postinst"
-systemd_populate_packages[vardepsexclude] += "OVERRIDES"
-
-
-python systemd_populate_packages() {
-    import re
-    import shlex
-
-    if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
-        return
-
-    def get_package_var(d, var, pkg):
-        val = (d.getVar('%s:%s' % (var, pkg)) or "").strip()
-        if val == "":
-            val = (d.getVar(var) or "").strip()
-        return val
-
-    # Check if systemd-packages already included in PACKAGES
-    def systemd_check_package(pkg_systemd):
-        packages = d.getVar('PACKAGES')
-        if not pkg_systemd in packages.split():
-            bb.error('%s does not appear in package list, please add it' % pkg_systemd)
-
-
-    def systemd_generate_package_scripts(pkg):
-        bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg)
-
-        paths_escaped = ' '.join(shlex.quote(s) for s in d.getVar('SYSTEMD_SERVICE:' + pkg).split())
-        d.setVar('SYSTEMD_SERVICE_ESCAPED:' + pkg, paths_escaped)
-
-        # Add pkg to the overrides so that it finds the SYSTEMD_SERVICE:pkg
-        # variable.
-        localdata = d.createCopy()
-        localdata.prependVar("OVERRIDES", pkg + ":")
-
-        postinst = d.getVar('pkg_postinst:%s' % pkg)
-        if not postinst:
-            postinst = '#!/bin/sh\n'
-        postinst += localdata.getVar('systemd_postinst')
-        d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        prerm = d.getVar('pkg_prerm:%s' % pkg)
-        if not prerm:
-            prerm = '#!/bin/sh\n'
-        prerm += localdata.getVar('systemd_prerm')
-        d.setVar('pkg_prerm:%s' % pkg, prerm)
-
-
-    # Add files to FILES:*-systemd if existent and not already done
-    def systemd_append_file(pkg_systemd, file_append):
-        appended = False
-        if os.path.exists(oe.path.join(d.getVar("D"), file_append)):
-            var_name = "FILES:" + pkg_systemd
-            files = d.getVar(var_name, False) or ""
-            if file_append not in files.split():
-                d.appendVar(var_name, " " + file_append)
-                appended = True
-        return appended
-
-    # Add systemd files to FILES:*-systemd, parse for Also= and follow recursive
-    def systemd_add_files_and_parse(pkg_systemd, path, service, keys):
-        # avoid infinite recursion
-        if systemd_append_file(pkg_systemd, oe.path.join(path, service)):
-            fullpath = oe.path.join(d.getVar("D"), path, service)
-            if service.find('.service') != -1:
-                # for *.service add *@.service
-                service_base = service.replace('.service', '')
-                systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service', keys)
-            if service.find('.socket') != -1:
-                # for *.socket add *.service and *@.service
-                service_base = service.replace('.socket', '')
-                systemd_add_files_and_parse(pkg_systemd, path, service_base + '.service', keys)
-                systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service', keys)
-            for key in keys.split():
-                # recurse all dependencies found in keys ('Also';'Conflicts';..) and add to files
-                cmd = "grep %s %s | sed 's,%s=,,g' | tr ',' '\\n'" % (key, shlex.quote(fullpath), key)
-                pipe = os.popen(cmd, 'r')
-                line = pipe.readline()
-                while line:
-                    line = line.replace('\n', '')
-                    systemd_add_files_and_parse(pkg_systemd, path, line, keys)
-                    line = pipe.readline()
-                pipe.close()
-
-    # Check service-files and call systemd_add_files_and_parse for each entry
-    def systemd_check_services():
-        searchpaths = [oe.path.join(d.getVar("sysconfdir"), "systemd", "system"),]
-        searchpaths.append(d.getVar("systemd_system_unitdir"))
-        systemd_packages = d.getVar('SYSTEMD_PACKAGES')
-
-        keys = 'Also'
-        # scan for all in SYSTEMD_SERVICE[]
-        for pkg_systemd in systemd_packages.split():
-            for service in get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd).split():
-                path_found = ''
-
-                # Deal with adding, for example, 'ifplugd@eth0.service' from
-                # 'ifplugd@.service'
-                base = None
-                at = service.find('@')
-                if at != -1:
-                    ext = service.rfind('.')
-                    base = service[:at] + '@' + service[ext:]
-
-                for path in searchpaths:
-                    if os.path.exists(oe.path.join(d.getVar("D"), path, service)):
-                        path_found = path
-                        break
-                    elif base is not None:
-                        if os.path.exists(oe.path.join(d.getVar("D"), path, base)):
-                            path_found = path
-                            break
-
-                if path_found != '':
-                    systemd_add_files_and_parse(pkg_systemd, path_found, service, keys)
-                else:
-                    bb.fatal("Didn't find service unit '{0}', specified in SYSTEMD_SERVICE:{1}. {2}".format(
-                        service, pkg_systemd, "Also looked for service unit '{0}'.".format(base) if base is not None else ""))
-
-    def systemd_create_presets(pkg, action):
-        presetf = oe.path.join(d.getVar("PKGD"), d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg)
-        bb.utils.mkdirhier(os.path.dirname(presetf))
-        with open(presetf, 'a') as fd:
-            for service in d.getVar('SYSTEMD_SERVICE:%s' % pkg).split():
-                fd.write("%s %s\n" % (action,service))
-        d.appendVar("FILES:%s" % pkg, ' ' + oe.path.join(d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg))
-
-    # Run all modifications once when creating package
-    if os.path.exists(d.getVar("D")):
-        for pkg in d.getVar('SYSTEMD_PACKAGES').split():
-            systemd_check_package(pkg)
-            if d.getVar('SYSTEMD_SERVICE:' + pkg):
-                systemd_generate_package_scripts(pkg)
-                action = get_package_var(d, 'SYSTEMD_AUTO_ENABLE', pkg)
-                if action in ("enable", "disable"):
-                    systemd_create_presets(pkg, action)
-                elif action not in ("mask", "preset"):
-                    bb.fatal("SYSTEMD_AUTO_ENABLE:%s '%s' is not 'enable', 'disable', 'mask' or 'preset'" % (pkg, action))
-        systemd_check_services()
-}
-
-PACKAGESPLITFUNCS:prepend = "systemd_populate_packages "
-
-python rm_systemd_unitdir (){
-    import shutil
-    if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
-        systemd_unitdir = oe.path.join(d.getVar("D"), d.getVar('systemd_unitdir'))
-        if os.path.exists(systemd_unitdir):
-            shutil.rmtree(systemd_unitdir)
-        systemd_libdir = os.path.dirname(systemd_unitdir)
-        if (os.path.exists(systemd_libdir) and not os.listdir(systemd_libdir)):
-            os.rmdir(systemd_libdir)
-}
-
-python rm_sysvinit_initddir (){
-    import shutil
-    sysv_initddir = oe.path.join(d.getVar("D"), (d.getVar('INIT_D_DIR') or "/etc/init.d"))
-
-    if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \
-        not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \
-        os.path.exists(sysv_initddir):
-        systemd_system_unitdir = oe.path.join(d.getVar("D"), d.getVar('systemd_system_unitdir'))
-
-        # If systemd_system_unitdir contains anything, delete sysv_initddir
-        if (os.path.exists(systemd_system_unitdir) and os.listdir(systemd_system_unitdir)):
-            shutil.rmtree(sysv_initddir)
-}
-
-do_install[postfuncs] += "${RMINITDIR} "
-RMINITDIR:class-target = " rm_sysvinit_initddir rm_systemd_unitdir "
-RMINITDIR:class-nativesdk = " rm_sysvinit_initddir rm_systemd_unitdir "
-RMINITDIR = ""
-
diff --git a/poky/meta/classes/terminal.bbclass b/poky/meta/classes/terminal.bbclass
index a564ee7..2dfc7db 100644
--- a/poky/meta/classes/terminal.bbclass
+++ b/poky/meta/classes/terminal.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 OE_TERMINAL ?= 'auto'
 OE_TERMINAL[type] = 'choice'
 OE_TERMINAL[choices] = 'auto none \
diff --git a/poky/meta/classes/testexport.bbclass b/poky/meta/classes/testexport.bbclass
index 1b0fb44..f7c5242 100644
--- a/poky/meta/classes/testexport.bbclass
+++ b/poky/meta/classes/testexport.bbclass
@@ -1,7 +1,6 @@
 # Copyright (C) 2016 Intel Corporation
 #
-# Released under the MIT license (see COPYING.MIT)
-#
+# SPDX-License-Identifier: MIT
 #
 # testexport.bbclass allows to execute runtime test outside OE environment.
 # Most of the tests are commands run on target image over ssh.
@@ -23,10 +22,9 @@
 TEST_TARGET_IP ?= ""
 TEST_SERVER_IP ?= ""
 
-TEST_EXPORT_SDK_PACKAGES ?= ""
+require conf/testexport.conf
+
 TEST_EXPORT_SDK_ENABLED ?= "0"
-TEST_EXPORT_SDK_NAME ?= "testexport-tools-nativesdk"
-TEST_EXPORT_SDK_DIR ?= "sdk"
 
 TEST_EXPORT_DEPENDS = ""
 TEST_EXPORT_DEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}"
@@ -179,4 +177,4 @@
     tar.close()
     os.chdir(current_dir)
 
-inherit testimage
+IMAGE_CLASSES += "testimage"
diff --git a/poky/meta/classes/testimage.bbclass b/poky/meta/classes/testimage.bbclass
deleted file mode 100644
index 7898223..0000000
--- a/poky/meta/classes/testimage.bbclass
+++ /dev/null
@@ -1,508 +0,0 @@
-# Copyright (C) 2013 Intel Corporation
-#
-# Released under the MIT license (see COPYING.MIT)
-
-inherit metadata_scm
-inherit image-artifact-names
-
-# testimage.bbclass enables testing of qemu images using python unittests.
-# Most of the tests are commands run on target image over ssh.
-# To use it add testimage to global inherit and call your target image with -c testimage
-# You can try it out like this:
-# - first add IMAGE_CLASSES += "testimage" in local.conf
-# - build a qemu core-image-sato
-# - then bitbake core-image-sato -c testimage. That will run a standard suite of tests.
-#
-# The tests can be run automatically each time an image is built if you set
-# TESTIMAGE_AUTO = "1"
-
-TESTIMAGE_AUTO ??= "0"
-
-# You can set (or append to) TEST_SUITES in local.conf to select the tests
-# which you want to run for your target.
-# The test names are the module names in meta/lib/oeqa/runtime/cases.
-# Each name in TEST_SUITES represents a required test for the image. (no skipping allowed)
-# Appending "auto" means that it will try to run all tests that are suitable for the image (each test decides that on it's own).
-# Note that order in TEST_SUITES is relevant: tests are run in an order such that
-# tests mentioned in @skipUnlessPassed run before the tests that depend on them,
-# but without such dependencies, tests run in the order in which they are listed
-# in TEST_SUITES.
-#
-# A layer can add its own tests in lib/oeqa/runtime, provided it extends BBPATH as normal in its layer.conf.
-
-# TEST_LOG_DIR contains a command ssh log and may contain infromation about what command is running, output and return codes and for qemu a boot log till login.
-# Booting is handled by this class, and it's not a test in itself.
-# TEST_QEMUBOOT_TIMEOUT can be used to set the maximum time in seconds the launch code will wait for the login prompt.
-# TEST_OVERALL_TIMEOUT can be used to set the maximum time in seconds the tests will be allowed to run (defaults to no limit).
-# TEST_QEMUPARAMS can be used to pass extra parameters to qemu, e.g. "-m 1024" for setting the amount of ram to 1 GB.
-# TEST_RUNQEMUPARAMS can be used to pass extra parameters to runqemu, e.g. "gl" to enable OpenGL acceleration.
-# QEMU_USE_KVM can be set to "" to disable the use of kvm (by default it is enabled if target_arch == build_arch or both of them are x86 archs)
-
-# TESTIMAGE_BOOT_PATTERNS can be used to override certain patterns used to communicate with the target when booting,
-# if a pattern is not specifically present on this variable a default will be used when booting the target.
-# TESTIMAGE_BOOT_PATTERNS[<flag>] overrides the pattern used for that specific flag, where flag comes from a list of accepted flags
-# e.g. normally the system boots and waits for a login prompt (login:), after that it sends the command: "root\n" to log as the root user
-# if we wanted to log in as the hypothetical "webserver" user for example we could set the following:
-# TESTIMAGE_BOOT_PATTERNS = "send_login_user search_login_succeeded"
-# TESTIMAGE_BOOT_PATTERNS[send_login_user] = "webserver\n"
-# TESTIMAGE_BOOT_PATTERNS[search_login_succeeded] = "webserver@[a-zA-Z0-9\-]+:~#"
-# The accepted flags are the following: search_reached_prompt, send_login_user, search_login_succeeded, search_cmd_finished.
-# They are prefixed with either search/send, to differentiate if the pattern is meant to be sent or searched to/from the target terminal
-
-TEST_LOG_DIR ?= "${WORKDIR}/testimage"
-
-TEST_EXPORT_DIR ?= "${TMPDIR}/testimage/${PN}"
-TEST_INSTALL_TMP_DIR ?= "${WORKDIR}/testimage/install_tmp"
-TEST_NEEDED_PACKAGES_DIR ?= "${WORKDIR}/testimage/packages"
-TEST_EXTRACTED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/extracted"
-TEST_PACKAGED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/packaged"
-
-BASICTESTSUITE = "\
-    ping date df ssh scp python perl gi ptest parselogs \
-    logrotate connman systemd oe_syslog pam stap ldd xorg \
-    kernelmodule gcc buildcpio buildlzip buildgalculator \
-    dnf rpm opkg apt weston go rust"
-
-DEFAULT_TEST_SUITES = "${BASICTESTSUITE}"
-
-# musl doesn't support systemtap
-DEFAULT_TEST_SUITES:remove:libc-musl = "stap"
-
-# qemumips is quite slow and has reached the timeout limit several times on the YP build cluster,
-# mitigate this by removing build tests for qemumips machines.
-MIPSREMOVE ??= "buildcpio buildlzip buildgalculator"
-DEFAULT_TEST_SUITES:remove:qemumips = "${MIPSREMOVE}"
-DEFAULT_TEST_SUITES:remove:qemumips64 = "${MIPSREMOVE}"
-
-TEST_SUITES ?= "${DEFAULT_TEST_SUITES}"
-
-QEMU_USE_KVM ?= "1"
-TEST_QEMUBOOT_TIMEOUT ?= "1000"
-TEST_OVERALL_TIMEOUT ?= ""
-TEST_TARGET ?= "qemu"
-TEST_QEMUPARAMS ?= ""
-TEST_RUNQEMUPARAMS ?= ""
-
-TESTIMAGE_BOOT_PATTERNS ?= ""
-
-TESTIMAGEDEPENDS = ""
-TESTIMAGEDEPENDS:append:qemuall = " qemu-native:do_populate_sysroot qemu-helper-native:do_populate_sysroot qemu-helper-native:do_addto_recipe_sysroot"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'dnf-native:do_populate_sysroot', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-native:do_populate_sysroot', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'ipk', 'opkg-utils-native:do_populate_sysroot package-index:do_package_index', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'deb', 'apt-native:do_populate_sysroot  package-index:do_package_index', '', d)}"
-
-TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
-TESTIMAGELOCK:qemuall = ""
-
-TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/"
-
-TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR"
-
-testimage_dump_target () {
-    top -bn1
-    ps
-    free
-    df
-    # The next command will export the default gateway IP
-    export DEFAULT_GATEWAY=$(ip route | awk '/default/ { print $3}')
-    ping -c3 $DEFAULT_GATEWAY
-    dmesg
-    netstat -an
-    ip address
-    # Next command will dump logs from /var/log/
-    find /var/log/ -type f 2>/dev/null -exec echo "====================" \; -exec echo {} \; -exec echo "====================" \; -exec cat {} \; -exec echo "" \;
-}
-
-testimage_dump_host () {
-    top -bn1
-    iostat -x -z -N -d -p ALL 20 2
-    ps -ef
-    free
-    df
-    memstat
-    dmesg
-    ip -s link
-    netstat -an
-}
-
-testimage_dump_monitor () {
-    query-status
-    query-block
-    dump-guest-memory {"paging":false,"protocol":"file:%s.img"}
-}
-
-python do_testimage() {
-    testimage_main(d)
-}
-
-addtask testimage
-do_testimage[nostamp] = "1"
-do_testimage[network] = "1"
-do_testimage[depends] += "${TESTIMAGEDEPENDS}"
-do_testimage[lockfiles] += "${TESTIMAGELOCK}"
-
-def testimage_sanity(d):
-    if (d.getVar('TEST_TARGET') == 'simpleremote'
-        and (not d.getVar('TEST_TARGET_IP')
-             or not d.getVar('TEST_SERVER_IP'))):
-        bb.fatal('When TEST_TARGET is set to "simpleremote" '
-                 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
-
-def get_testimage_configuration(d, test_type, machine):
-    import platform
-    from oeqa.utils.metadata import get_layers
-    configuration = {'TEST_TYPE': test_type,
-                    'MACHINE': machine,
-                    'DISTRO': d.getVar("DISTRO"),
-                    'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
-                    'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
-                    'STARTTIME': d.getVar("DATETIME"),
-                    'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'),
-                    'LAYERS': get_layers(d.getVar("BBLAYERS"))}
-    return configuration
-get_testimage_configuration[vardepsexclude] = "DATETIME"
-
-def get_testimage_json_result_dir(d):
-    json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
-    custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
-    if custom_json_result_dir:
-        json_result_dir = custom_json_result_dir
-    return json_result_dir
-
-def get_testimage_result_id(configuration):
-    return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME'])
-
-def get_testimage_boot_patterns(d):
-    from collections import defaultdict
-    boot_patterns = defaultdict(str)
-    # Only accept certain values
-    accepted_patterns = ['search_reached_prompt', 'send_login_user', 'search_login_succeeded', 'search_cmd_finished']
-    # Not all patterns need to be overriden, e.g. perhaps we only want to change the user
-    boot_patterns_flags = d.getVarFlags('TESTIMAGE_BOOT_PATTERNS') or {}
-    if boot_patterns_flags:
-        patterns_set = [p for p in boot_patterns_flags.items() if p[0] in d.getVar('TESTIMAGE_BOOT_PATTERNS').split()]
-        for flag, flagval in patterns_set:
-                if flag not in accepted_patterns:
-                    bb.fatal('Testimage: The only accepted boot patterns are: search_reached_prompt,send_login_user, \
-                    search_login_succeeded,search_cmd_finished\n Make sure your TESTIMAGE_BOOT_PATTERNS=%s \
-                    contains an accepted flag.' % d.getVar('TESTIMAGE_BOOT_PATTERNS'))
-                    return
-                # We know boot prompt is searched through in binary format, others might be expressions
-                if flag == 'search_reached_prompt':
-                    boot_patterns[flag] = flagval.encode()
-                else:
-                    boot_patterns[flag] = flagval.encode().decode('unicode-escape')
-    return boot_patterns
-
-
-def testimage_main(d):
-    import os
-    import json
-    import signal
-    import logging
-    import shutil
-
-    from bb.utils import export_proxies
-    from oeqa.runtime.context import OERuntimeTestContext
-    from oeqa.runtime.context import OERuntimeTestContextExecutor
-    from oeqa.core.target.qemu import supported_fstypes
-    from oeqa.core.utils.test import getSuiteCases
-    from oeqa.utils import make_logger_bitbake_compatible
-
-    def sigterm_exception(signum, stackframe):
-        """
-        Catch SIGTERM from worker in order to stop qemu.
-        """
-        os.kill(os.getpid(), signal.SIGINT)
-
-    def handle_test_timeout(timeout):
-        bb.warn("Global test timeout reached (%s seconds), stopping the tests." %(timeout))
-        os.kill(os.getpid(), signal.SIGINT)
-
-    testimage_sanity(d)
-
-    if (d.getVar('IMAGE_PKGTYPE') == 'rpm'
-       and ('dnf' in d.getVar('TEST_SUITES') or 'auto' in d.getVar('TEST_SUITES'))):
-        create_rpm_index(d)
-
-    logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
-    pn = d.getVar("PN")
-
-    bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
-
-    image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
-                             d.getVar('IMAGE_LINK_NAME')))
-
-    tdname = "%s.testdata.json" % image_name
-    try:
-        with open(tdname, "r") as f:
-            td = json.load(f)
-    except FileNotFoundError as err:
-        bb.fatal('File %s not found (%s).\nHave you built the image with INHERIT += "testimage" in the conf/local.conf?' % (tdname, err))
-
-    # Some variables need to be updates (mostly paths) with the
-    # ones of the current environment because some tests require them.
-    for var in d.getVar('TESTIMAGE_UPDATE_VARS').split():
-        td[var] = d.getVar(var)
-
-    image_manifest = "%s.manifest" % image_name
-    image_packages = OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
-
-    extract_dir = d.getVar("TEST_EXTRACTED_DIR")
-
-    # Get machine
-    machine = d.getVar("MACHINE")
-
-    # Get rootfs
-    fstypes = d.getVar('IMAGE_FSTYPES').split()
-    if d.getVar("TEST_TARGET") == "qemu":
-        fstypes = [fs for fs in fstypes if fs in supported_fstypes]
-        if not fstypes:
-            bb.fatal('Unsupported image type built. Add a compatible image to '
-                     'IMAGE_FSTYPES. Supported types: %s' %
-                     ', '.join(supported_fstypes))
-    qfstype = fstypes[0]
-    qdeffstype = d.getVar("QB_DEFAULT_FSTYPE")
-    if qdeffstype:
-        qfstype = qdeffstype
-    rootfs = '%s.%s' % (image_name, qfstype)
-
-    # Get tmpdir (not really used, just for compatibility)
-    tmpdir = d.getVar("TMPDIR")
-
-    # Get deploy_dir_image (not really used, just for compatibility)
-    dir_image = d.getVar("DEPLOY_DIR_IMAGE")
-
-    # Get bootlog
-    bootlog = os.path.join(d.getVar("TEST_LOG_DIR"),
-                           'qemu_boot_log.%s' % d.getVar('DATETIME'))
-
-    # Get display
-    display = d.getVar("BB_ORIGENV").getVar("DISPLAY")
-
-    # Get kernel
-    kernel_name = ('%s-%s.bin' % (d.getVar("KERNEL_IMAGETYPE"), machine))
-    kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), kernel_name)
-
-    # Get boottime
-    boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT"))
-
-    # Get use_kvm
-    kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH'))
-
-    # Get OVMF
-    ovmf = d.getVar("QEMU_USE_OVMF")
-
-    slirp = False
-    if d.getVar("QEMU_USE_SLIRP"):
-        slirp = True
-
-    # TODO: We use the current implementation of qemu runner because of
-    # time constrains, qemu runner really needs a refactor too.
-    target_kwargs = { 'machine'     : machine,
-                      'rootfs'      : rootfs,
-                      'tmpdir'      : tmpdir,
-                      'dir_image'   : dir_image,
-                      'display'     : display,
-                      'kernel'      : kernel,
-                      'boottime'    : boottime,
-                      'bootlog'     : bootlog,
-                      'kvm'         : kvm,
-                      'slirp'       : slirp,
-                      'dump_dir'    : d.getVar("TESTIMAGE_DUMP_DIR"),
-                      'serial_ports': len(d.getVar("SERIAL_CONSOLES").split()),
-                      'ovmf'        : ovmf,
-                      'tmpfsdir'    : d.getVar("RUNQEMU_TMPFS_DIR"),
-                    }
-
-    if d.getVar("TESTIMAGE_BOOT_PATTERNS"):
-        target_kwargs['boot_patterns'] = get_testimage_boot_patterns(d)
-
-    # hardware controlled targets might need further access
-    target_kwargs['powercontrol_cmd'] = d.getVar("TEST_POWERCONTROL_CMD") or None
-    target_kwargs['powercontrol_extra_args'] = d.getVar("TEST_POWERCONTROL_EXTRA_ARGS") or ""
-    target_kwargs['serialcontrol_cmd'] = d.getVar("TEST_SERIALCONTROL_CMD") or None
-    target_kwargs['serialcontrol_extra_args'] = d.getVar("TEST_SERIALCONTROL_EXTRA_ARGS") or ""
-    target_kwargs['testimage_dump_monitor'] = d.getVar("testimage_dump_monitor") or ""
-    target_kwargs['testimage_dump_target'] = d.getVar("testimage_dump_target") or ""
-
-    def export_ssh_agent(d):
-        import os
-
-        variables = ['SSH_AGENT_PID', 'SSH_AUTH_SOCK']
-        for v in variables:
-            if v not in os.environ.keys():
-                val = d.getVar(v)
-                if val is not None:
-                    os.environ[v] = val
-
-    export_ssh_agent(d)
-
-    # runtime use network for download projects for build
-    export_proxies(d)
-
-    # we need the host dumper in test context
-    host_dumper = OERuntimeTestContextExecutor.getHostDumper(
-        d.getVar("testimage_dump_host"),
-        d.getVar("TESTIMAGE_DUMP_DIR"))
-
-    # the robot dance
-    target = OERuntimeTestContextExecutor.getTarget(
-        d.getVar("TEST_TARGET"), logger, d.getVar("TEST_TARGET_IP"),
-        d.getVar("TEST_SERVER_IP"), **target_kwargs)
-
-    # test context
-    tc = OERuntimeTestContext(td, logger, target, host_dumper,
-                              image_packages, extract_dir)
-
-    # Load tests before starting the target
-    test_paths = get_runtime_paths(d)
-    test_modules = d.getVar('TEST_SUITES').split()
-    if not test_modules:
-        bb.fatal('Empty test suite, please verify TEST_SUITES variable')
-
-    tc.loadTests(test_paths, modules=test_modules)
-
-    suitecases = getSuiteCases(tc.suites)
-    if not suitecases:
-        bb.fatal('Empty test suite, please verify TEST_SUITES variable')
-    else:
-        bb.debug(2, 'test suites:\n\t%s' % '\n\t'.join([str(c) for c in suitecases]))
-
-    package_extraction(d, tc.suites)
-
-    results = None
-    complete = False
-    orig_sigterm_handler = signal.signal(signal.SIGTERM, sigterm_exception)
-    try:
-        # We need to check if runqemu ends unexpectedly
-        # or if the worker send us a SIGTERM
-        tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS"))
-        import threading
-        try:
-            threading.Timer(int(d.getVar("TEST_OVERALL_TIMEOUT")), handle_test_timeout, (int(d.getVar("TEST_OVERALL_TIMEOUT")),)).start()
-        except ValueError:
-            pass
-        results = tc.runTests()
-        complete = True
-    except (KeyboardInterrupt, BlockingIOError) as err:
-        if isinstance(err, KeyboardInterrupt):
-            bb.error('testimage interrupted, shutting down...')
-        else:
-            bb.error('runqemu failed, shutting down...')
-        if results:
-            results.stop()
-        results = tc.results
-    finally:
-        signal.signal(signal.SIGTERM, orig_sigterm_handler)
-        tc.target.stop()
-
-    # Show results (if we have them)
-    if results:
-        configuration = get_testimage_configuration(d, 'runtime', machine)
-        results.logDetails(get_testimage_json_result_dir(d),
-                        configuration,
-                        get_testimage_result_id(configuration),
-                        dump_streams=d.getVar('TESTREPORT_FULLLOGS'))
-        results.logSummary(pn)
-
-    # Copy additional logs to tmp/log/oeqa so it's easier to find them
-    targetdir = os.path.join(get_testimage_json_result_dir(d), d.getVar("PN"))
-    os.makedirs(targetdir, exist_ok=True)
-    os.symlink(bootlog, os.path.join(targetdir, os.path.basename(bootlog)))
-    os.symlink(d.getVar("BB_LOGFILE"), os.path.join(targetdir, os.path.basename(d.getVar("BB_LOGFILE") + "." + d.getVar('DATETIME'))))
-
-    if not results or not complete:
-        bb.fatal('%s - FAILED - tests were interrupted during execution, check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
-    if not results.wasSuccessful():
-        bb.fatal('%s - FAILED - also check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
-
-def get_runtime_paths(d):
-    """
-    Returns a list of paths where runtime test must reside.
-
-    Runtime tests are expected in <LAYER_DIR>/lib/oeqa/runtime/cases/
-    """
-    paths = []
-
-    for layer in d.getVar('BBLAYERS').split():
-        path = os.path.join(layer, 'lib/oeqa/runtime/cases')
-        if os.path.isdir(path):
-            paths.append(path)
-    return paths
-
-def create_index(arg):
-    import subprocess
-
-    index_cmd = arg
-    try:
-        bb.note("Executing '%s' ..." % index_cmd)
-        result = subprocess.check_output(index_cmd,
-                                        stderr=subprocess.STDOUT,
-                                        shell=True)
-        result = result.decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        return("Index creation command '%s' failed with return code "
-               '%d:\n%s' % (e.cmd, e.returncode, e.output.decode("utf-8")))
-    if result:
-        bb.note(result)
-    return None
-
-def create_rpm_index(d):
-    import glob
-    # Index RPMs
-    rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo_c")
-    index_cmds = []
-    archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_')
-
-    for arch in archs.split():
-        rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch)
-        idx_path = os.path.join(d.getVar('WORKDIR'), 'oe-testimage-repo', arch)
-
-        if not os.path.isdir(rpm_dir):
-            continue
-
-        lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock')
-        lf = bb.utils.lockfile(lockfilename, False)
-        oe.path.copyhardlinktree(rpm_dir, idx_path)
-        # Full indexes overload a 256MB image so reduce the number of rpms
-        # in the feed by filtering to specific packages needed by the tests.
-        package_list = glob.glob(idx_path + "*/*.rpm")
-
-        for pkg in package_list:
-            if os.path.basename(pkg).startswith(("curl-ptest")):
-                bb.utils.remove(pkg)
-
-            if not os.path.basename(pkg).startswith(("rpm", "run-postinsts", "busybox", "bash", "update-alternatives", "libc6", "curl", "musl")):
-                bb.utils.remove(pkg)
-
-        bb.utils.unlockfile(lf)
-        cmd = '%s --update -q %s' % (rpm_createrepo, idx_path)
-
-        # Create repodata
-        result = create_index(cmd)
-        if result:
-            bb.fatal('%s' % ('\n'.join(result)))
-
-def package_extraction(d, test_suites):
-    from oeqa.utils.package_manager import find_packages_to_extract
-    from oeqa.utils.package_manager import extract_packages
-
-    bb.utils.remove(d.getVar("TEST_NEEDED_PACKAGES_DIR"), recurse=True)
-    packages = find_packages_to_extract(test_suites)
-    if packages:
-        bb.utils.mkdirhier(d.getVar("TEST_INSTALL_TMP_DIR"))
-        bb.utils.mkdirhier(d.getVar("TEST_PACKAGED_DIR"))
-        bb.utils.mkdirhier(d.getVar("TEST_EXTRACTED_DIR"))
-        extract_packages(d, packages)
-
-testimage_main[vardepsexclude] += "BB_ORIGENV DATETIME"
-
-python () {
-    if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
-        bb.build.addtask("testimage", "do_build", "do_image_complete", d)
-}
-
-inherit testsdk
diff --git a/poky/meta/classes/testsdk.bbclass b/poky/meta/classes/testsdk.bbclass
deleted file mode 100644
index 8b2e74f..0000000
--- a/poky/meta/classes/testsdk.bbclass
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright (C) 2013 - 2016 Intel Corporation
-#
-# Released under the MIT license (see COPYING.MIT)
-
-# testsdk.bbclass enables testing for SDK and Extensible SDK
-#
-# To run SDK tests, run the commands:
-# $ bitbake <image-name> -c populate_sdk
-# $ bitbake <image-name> -c testsdk
-#
-# To run eSDK tests, run the commands:
-# $ bitbake <image-name> -c populate_sdk_ext
-# $ bitbake <image-name> -c testsdkext
-#
-# where "<image-name>" is an image like core-image-sato.
-
-TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK"
-TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt"
-
-def import_and_run(name, d):
-    import importlib
-
-    class_name = d.getVar(name)
-    if class_name:
-        module, cls = class_name.rsplit('.', 1)
-        m = importlib.import_module(module)
-        c = getattr(m, cls)()
-        c.run(d)
-    else:
-        bb.warn('No tests were run because %s did not define a class' % name)
-
-import_and_run[vardepsexclude] = "DATETIME BB_ORIGENV"
-
-python do_testsdk() {
-    import_and_run('TESTSDK_CLASS_NAME', d)
-}
-addtask testsdk
-do_testsdk[nostamp] = "1"
-do_testsdk[network] = "1"
-
-python do_testsdkext() {
-    import_and_run('TESTSDKEXT_CLASS_NAME', d)
-}
-addtask testsdkext
-do_testsdkext[nostamp] = "1"
-do_testsdkext[network] = "1"
-
-python () {
-    if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
-        bb.build.addtask("testsdk", None, "do_populate_sdk", d)
-        bb.build.addtask("testsdkext", None, "do_populate_sdk_ext", d)
-}
diff --git a/poky/meta/classes/texinfo.bbclass b/poky/meta/classes/texinfo.bbclass
deleted file mode 100644
index 68c9d4f..0000000
--- a/poky/meta/classes/texinfo.bbclass
+++ /dev/null
@@ -1,18 +0,0 @@
-# This class is inherited by recipes whose upstream packages invoke the
-# texinfo utilities at build-time. Native and cross recipes are made to use the
-# dummy scripts provided by texinfo-dummy-native, for improved performance.
-# Target architecture recipes use the genuine Texinfo utilities. By default,
-# they use the Texinfo utilities on the host system. If you want to use the
-# Texinfo recipe, you can remove texinfo-native from ASSUME_PROVIDED and
-# makeinfo from SANITY_REQUIRED_UTILITIES.
-
-TEXDEP = "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'texinfo-replacement-native', 'texinfo-dummy-native', d)}"
-TEXDEP:class-native = "texinfo-dummy-native"
-TEXDEP:class-cross = "texinfo-dummy-native"
-TEXDEP:class-crosssdk = "texinfo-dummy-native"
-TEXDEP:class-cross-canadian = "texinfo-dummy-native"
-DEPENDS:append = " ${TEXDEP}"
-
-# libtool-cross doesn't inherit cross
-TEXDEP:pn-libtool-cross = "texinfo-dummy-native"
-
diff --git a/poky/meta/classes/toaster.bbclass b/poky/meta/classes/toaster.bbclass
index f365c09..03c4f3a 100644
--- a/poky/meta/classes/toaster.bbclass
+++ b/poky/meta/classes/toaster.bbclass
@@ -3,7 +3,7 @@
 #
 # Copyright (C) 2013 Intel Corporation
 #
-# Released under the MIT license (see COPYING.MIT)
+# SPDX-License-Identifier: MIT
 #
 # This bbclass is designed to extract data used by OE-Core during the build process,
 # for recording in the Toaster system.
diff --git a/poky/meta/classes/toolchain-scripts-base.bbclass b/poky/meta/classes/toolchain-scripts-base.bbclass
deleted file mode 100644
index 2489b9d..0000000
--- a/poky/meta/classes/toolchain-scripts-base.bbclass
+++ /dev/null
@@ -1,11 +0,0 @@
-#This function create a version information file
-toolchain_create_sdk_version () {
-	local versionfile=$1
-	rm -f $versionfile
-	touch $versionfile
-	echo 'Distro: ${DISTRO}' >> $versionfile
-	echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
-	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
-	echo 'Timestamp: ${DATETIME}' >> $versionfile
-}
-toolchain_create_sdk_version[vardepsexclude] = "DATETIME"
diff --git a/poky/meta/classes/toolchain-scripts.bbclass b/poky/meta/classes/toolchain-scripts.bbclass
deleted file mode 100644
index 16f1e17..0000000
--- a/poky/meta/classes/toolchain-scripts.bbclass
+++ /dev/null
@@ -1,230 +0,0 @@
-inherit toolchain-scripts-base siteinfo kernel-arch
-
-# We want to be able to change the value of MULTIMACH_TARGET_SYS, because it
-# doesn't always match our expectations... but we default to the stock value
-REAL_MULTIMACH_TARGET_SYS ?= "${MULTIMACH_TARGET_SYS}"
-TARGET_CC_ARCH:append:libc-musl = " -mmusl"
-
-# default debug prefix map isn't valid in the SDK
-DEBUG_PREFIX_MAP = ""
-
-EXPORT_SDK_PS1 = "${@ 'export PS1=\\"%s\\"' % d.getVar('SDK_PS1') if d.getVar('SDK_PS1') else ''}"
-
-# This function creates an environment-setup-script for use in a deployable SDK
-toolchain_create_sdk_env_script () {
-	# Create environment setup script.  Remember that $SDKTARGETSYSROOT should
-	# only be expanded on the target at runtime.
-	base_sbindir=${10:-${base_sbindir_nativesdk}}
-	base_bindir=${9:-${base_bindir_nativesdk}}
-	sbindir=${8:-${sbindir_nativesdk}}
-	sdkpathnative=${7:-${SDKPATHNATIVE}}
-	prefix=${6:-${prefix_nativesdk}}
-	bindir=${5:-${bindir_nativesdk}}
-	libdir=${4:-${libdir}}
-	sysroot=${3:-${SDKTARGETSYSROOT}}
-	multimach_target_sys=${2:-${REAL_MULTIMACH_TARGET_SYS}}
-	script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-$multimach_target_sys}
-	rm -f $script
-	touch $script
-
-	echo '# Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice' >> $script
-	echo '# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80' >> $script
-	echo '# http://xahlee.info/UnixResource_dir/_/ldpath.html' >> $script
-	echo '# Only disable this check if you are absolutely know what you are doing!' >> $script
-	echo 'if [ ! -z "$LD_LIBRARY_PATH" ]; then' >> $script
-	echo "    echo \"Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'\"" >> $script
-	echo "    echo \"but please check why this was set in the first place and that it's safe to unset.\"" >> $script
-	echo '    echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."' >> $script
-	echo '    echo "For more references see:"' >> $script
-	echo '    echo "  http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80"' >> $script
-	echo '    echo "  http://xahlee.info/UnixResource_dir/_/ldpath.html"' >> $script
-	echo '    return 1' >> $script
-	echo 'fi' >> $script
-
-	echo "${EXPORT_SDK_PS1}" >> $script
-	echo 'export SDKTARGETSYSROOT='"$sysroot" >> $script
-	EXTRAPATH=""
-	for i in ${CANADIANEXTRAOS}; do
-		EXTRAPATH="$EXTRAPATH:$sdkpathnative$bindir/${TARGET_ARCH}${TARGET_VENDOR}-$i"
-	done
-	echo "export PATH=$sdkpathnative$bindir:$sdkpathnative$sbindir:$sdkpathnative$base_bindir:$sdkpathnative$base_sbindir:$sdkpathnative$bindir/../${HOST_SYS}/bin:$sdkpathnative$bindir/${TARGET_SYS}"$EXTRAPATH':$PATH' >> $script
-	echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >> $script
-	echo 'export PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig' >> $script
-	echo 'export CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script
-	echo "export OECORE_NATIVE_SYSROOT=\"$sdkpathnative\"" >> $script
-	echo 'export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"' >> $script
-	echo "export OECORE_ACLOCAL_OPTS=\"-I $sdkpathnative/usr/share/aclocal\"" >> $script
-	echo 'export OECORE_BASELIB="${baselib}"' >> $script
-	echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
-	echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
-
-	echo 'unset command_not_found_handle' >> $script
-
-	toolchain_shared_env_script
-}
-
-# This function creates an environment-setup-script in B which enables
-# a OE-core IDE to integrate with the build tree
-# Caller must ensure CONFIG_SITE is setup
-toolchain_create_tree_env_script () {
-	script=${B}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
-	rm -f $script
-	touch $script
-	echo 'standalone_sysroot_target="${STAGING_DIR}/${MACHINE}"' >> $script
-	echo 'standalone_sysroot_native="${STAGING_DIR}/${BUILD_ARCH}"' >> $script
-	echo 'orig=`pwd`; cd ${COREBASE}; . ./oe-init-build-env ${TOPDIR}; cd $orig' >> $script
-	echo 'export PATH=$standalone_sysroot_native/${bindir_native}:$standalone_sysroot_native/${bindir_native}/${TARGET_SYS}:$PATH' >> $script
-	echo 'export PKG_CONFIG_SYSROOT_DIR=$standalone_sysroot_target' >> $script
-	echo 'export PKG_CONFIG_PATH=$standalone_sysroot_target'"$libdir"'/pkgconfig:$standalone_sysroot_target'"$prefix"'/share/pkgconfig' >> $script
-	echo 'export CONFIG_SITE="${CONFIG_SITE}"' >> $script
-	echo 'export SDKTARGETSYSROOT=$standalone_sysroot_target' >> $script
-	echo 'export OECORE_NATIVE_SYSROOT=$standalone_sysroot_native' >> $script
-	echo 'export OECORE_TARGET_SYSROOT=$standalone_sysroot_target' >> $script
-	echo 'export OECORE_ACLOCAL_OPTS="-I $standalone_sysroot_native/usr/share/aclocal"' >> $script
-	echo 'export OECORE_BASELIB="${baselib}"' >> $script
-	echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
-	echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
-
-	toolchain_shared_env_script
-
-	cat >> $script <<EOF
-
-if [ -d "\$OECORE_NATIVE_SYSROOT/${datadir}/post-relocate-setup.d/" ]; then
-	for s in \$OECORE_NATIVE_SYSROOT/${datadir}/post-relocate-setup.d/*; do
-		if [ ! -x \$s ]; then
-			continue
-		fi
-		\$s "\$1"
-		status=\$?
-		if [ \$status != 0 ]; then
-			echo "post-relocate command \"\$s \$1\" failed with status \$status" >&2
-			exit \$status
-		fi
-	done
-fi
-EOF
-}
-
-toolchain_shared_env_script () {
-	echo 'export CC="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
-	echo 'export CXX="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
-	echo 'export CPP="${TARGET_PREFIX}gcc -E ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
-	echo 'export AS="${TARGET_PREFIX}as ${TARGET_AS_ARCH}"' >> $script
-	echo 'export LD="${TARGET_PREFIX}ld ${TARGET_LD_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
-	echo 'export GDB=${TARGET_PREFIX}gdb' >> $script
-	echo 'export STRIP=${TARGET_PREFIX}strip' >> $script
-	echo 'export RANLIB=${TARGET_PREFIX}ranlib' >> $script
-	echo 'export OBJCOPY=${TARGET_PREFIX}objcopy' >> $script
-	echo 'export OBJDUMP=${TARGET_PREFIX}objdump' >> $script
-	echo 'export READELF=${TARGET_PREFIX}readelf' >> $script
-	echo 'export AR=${TARGET_PREFIX}ar' >> $script
-	echo 'export NM=${TARGET_PREFIX}nm' >> $script
-	echo 'export M4=m4' >> $script
-	echo 'export TARGET_PREFIX=${TARGET_PREFIX}' >> $script
-	echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${SDK_ARCH}-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"' >> $script
-	echo 'export CFLAGS="${TARGET_CFLAGS}"' >> $script
-	echo 'export CXXFLAGS="${TARGET_CXXFLAGS}"' >> $script
-	echo 'export LDFLAGS="${TARGET_LDFLAGS}"' >> $script
-	echo 'export CPPFLAGS="${TARGET_CPPFLAGS}"' >> $script
-	echo 'export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"' >> $script
-	echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
-	echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script
-	echo 'export ARCH=${ARCH}' >> $script
-	echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script
-	echo 'export OECORE_TUNE_CCARGS="${TUNE_CCARGS}"' >> $script
-
-    cat >> $script <<EOF
-
-# Append environment subscripts
-if [ -d "\$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then
-    for envfile in \$OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do
-	    . \$envfile
-    done
-fi
-if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
-    for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
-	    . \$envfile
-    done
-fi
-EOF
-}
-
-toolchain_create_post_relocate_script() {
-	relocate_script=$1
-	env_dir=$2
-	rm -f $relocate_script
-	touch $relocate_script
-
-	cat >> $relocate_script <<EOF
-if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
-	# Source top-level SDK env scripts in case they are needed for the relocate
-	# scripts.
-	for env_setup_script in ${env_dir}/environment-setup-*; do
-		. \$env_setup_script
-		status=\$?
-		if [ \$status != 0 ]; then
-			echo "\$0: Failed to source \$env_setup_script with status \$status"
-			exit \$status
-		fi
-
-		for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*; do
-			if [ ! -x \$s ]; then
-				continue
-			fi
-			\$s "\$1"
-			status=\$?
-			if [ \$status != 0 ]; then
-				echo "post-relocate command \"\$s \$1\" failed with status \$status" >&2
-				exit \$status
-			fi
-		done
-	done
-	rm -rf "${SDKPATHNATIVE}/post-relocate-setup.d"
-fi
-EOF
-}
-
-#we get the cached site config in the runtime
-TOOLCHAIN_CONFIGSITE_NOCACHE = "${@' '.join(siteinfo_get_files(d)[0])}"
-TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
-TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses"
-DEPENDS += "${TOOLCHAIN_NEED_CONFIGSITE_CACHE}"
-
-#This function create a site config file
-toolchain_create_sdk_siteconfig () {
-	local siteconfig=$1
-
-	rm -f $siteconfig
-	touch $siteconfig
-
-	for sitefile in ${TOOLCHAIN_CONFIGSITE_NOCACHE} ; do
-		cat $sitefile >> $siteconfig
-	done
-
-	#get cached site config
-	for sitefile in ${TOOLCHAIN_NEED_CONFIGSITE_CACHE}; do
-		# Resolve virtual/* names to the real recipe name using sysroot-providers info
-		case $sitefile in virtual/*)
-			sitefile=`echo $sitefile | tr / _`
-			sitefile=`cat ${STAGING_DIR_TARGET}/sysroot-providers/$sitefile`
-		esac
-
-		if [ -r ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config ]; then
-			cat ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config >> $siteconfig
-		fi
-	done
-}
-# The immediate expansion above can result in unwanted path dependencies here
-toolchain_create_sdk_siteconfig[vardepsexclude] = "TOOLCHAIN_CONFIGSITE_SYSROOTCACHE"
-
-python __anonymous () {
-    import oe.classextend
-    deps = ""
-    for dep in (d.getVar('TOOLCHAIN_NEED_CONFIGSITE_CACHE') or "").split():
-        deps += " %s:do_populate_sysroot" % dep
-        for variant in (d.getVar('MULTILIB_VARIANTS') or "").split():
-            clsextend = oe.classextend.ClassExtender(variant, d)
-            newdep = clsextend.extend_name(dep)
-            deps += " %s:do_populate_sysroot" % newdep
-    d.appendVarFlag('do_configure', 'depends', deps)
-}
diff --git a/poky/meta/classes/typecheck.bbclass b/poky/meta/classes/typecheck.bbclass
index 72da932..160f7a0 100644
--- a/poky/meta/classes/typecheck.bbclass
+++ b/poky/meta/classes/typecheck.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # Check types of bitbake configuration variables
 #
 # See oe.types for details.
diff --git a/poky/meta/classes/uboot-config.bbclass b/poky/meta/classes/uboot-config.bbclass
deleted file mode 100644
index e8da8c7..0000000
--- a/poky/meta/classes/uboot-config.bbclass
+++ /dev/null
@@ -1,130 +0,0 @@
-# Handle U-Boot config for a machine
-#
-# The format to specify it, in the machine, is:
-#
-# UBOOT_CONFIG ??= <default>
-# UBOOT_CONFIG[foo] = "config,images,binary"
-#
-# or
-#
-# UBOOT_MACHINE = "config"
-#
-# Copyright 2013, 2014 (C) O.S. Systems Software LTDA.
-
-def removesuffix(s, suffix):
-    if suffix and s.endswith(suffix):
-        return s[:-len(suffix)]
-    return s
-
-# Some versions of u-boot use .bin and others use .img.  By default use .bin
-# but enable individual recipes to change this value.
-UBOOT_SUFFIX ??= "bin"
-UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
-UBOOT_BINARYNAME ?= "${@os.path.splitext(d.getVar("UBOOT_BINARY"))[0]}"
-UBOOT_IMAGE ?= "${UBOOT_BINARYNAME}-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
-UBOOT_SYMLINK ?= "${UBOOT_BINARYNAME}-${MACHINE}.${UBOOT_SUFFIX}"
-UBOOT_MAKE_TARGET ?= "all"
-
-# Output the ELF generated. Some platforms can use the ELF file and directly
-# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging
-# purposes.
-UBOOT_ELF ?= ""
-UBOOT_ELF_SUFFIX ?= "elf"
-UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}"
-UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}"
-UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}"
-
-# Some versions of u-boot build an SPL (Second Program Loader) image that
-# should be packaged along with the u-boot binary as well as placed in the
-# deploy directory.  For those versions they can set the following variables
-# to allow packaging the SPL.
-SPL_SUFFIX ?= ""
-SPL_BINARY ?= ""
-SPL_DELIMITER  ?= "${@'.' if d.getVar("SPL_SUFFIX") else ''}"
-SPL_BINARYFILE ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}"
-SPL_BINARYNAME ?= "${@removesuffix(d.getVar("SPL_BINARYFILE"), "." + d.getVar("SPL_SUFFIX"))}"
-SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}"
-SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}${SPL_DELIMITER}${SPL_SUFFIX}"
-
-# Additional environment variables or a script can be installed alongside
-# u-boot to be used automatically on boot.  This file, typically 'uEnv.txt'
-# or 'boot.scr', should be packaged along with u-boot as well as placed in the
-# deploy directory.  Machine configurations needing one of these files should
-# include it in the SRC_URI and set the UBOOT_ENV parameter.
-UBOOT_ENV_SUFFIX ?= "txt"
-UBOOT_ENV ?= ""
-UBOOT_ENV_SRC_SUFFIX ?= "cmd"
-UBOOT_ENV_SRC ?= "${UBOOT_ENV}.${UBOOT_ENV_SRC_SUFFIX}"
-UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
-UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
-UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
-
-# Default name of u-boot initial env, but enable individual recipes to change
-# this value.
-UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
-
-# U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf
-# to find EXTLINUX conf file.
-UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux"
-UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf"
-UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${PR}"
-
-# Options for the device tree compiler passed to mkimage '-D' feature:
-UBOOT_MKIMAGE_DTCOPTS ??= ""
-SPL_MKIMAGE_DTCOPTS ??= ""
-
-# mkimage command
-UBOOT_MKIMAGE ?= "uboot-mkimage"
-UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}"
-
-# Arguments passed to mkimage for signing
-UBOOT_MKIMAGE_SIGN_ARGS ?= ""
-SPL_MKIMAGE_SIGN_ARGS ?= ""
-
-# Options to deploy the u-boot device tree
-UBOOT_DTB ?= ""
-UBOOT_DTB_BINARY ??= ""
-
-python () {
-    ubootmachine = d.getVar("UBOOT_MACHINE")
-    ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
-    ubootbinary = d.getVar('UBOOT_BINARY')
-    ubootbinaries = d.getVar('UBOOT_BINARIES')
-    # The "doc" varflag is special, we don't want to see it here
-    ubootconfigflags.pop('doc', None)
-    ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split()
-
-    if not ubootmachine and not ubootconfig:
-        PN = d.getVar("PN")
-        FILE = os.path.basename(d.getVar("FILE"))
-        bb.debug(1, "To build %s, see %s for instructions on \
-                 setting up your machine config" % (PN, FILE))
-        raise bb.parse.SkipRecipe("Either UBOOT_MACHINE or UBOOT_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE"))
-
-    if ubootmachine and ubootconfig:
-        raise bb.parse.SkipRecipe("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at the same time.")
-
-    if ubootconfigflags and ubootbinaries:
-        raise bb.parse.SkipRecipe("You cannot use UBOOT_BINARIES as it is internal to uboot_config.bbclass.")
-
-    if len(ubootconfig) > 0:
-        for config in ubootconfig:
-            for f, v in ubootconfigflags.items():
-                if config == f: 
-                    items = v.split(',')
-                    if items[0] and len(items) > 3:
-                        raise bb.parse.SkipRecipe('Only config,images,binary can be specified!')
-                    d.appendVar('UBOOT_MACHINE', ' ' + items[0])
-                    # IMAGE_FSTYPES appending
-                    if len(items) > 1 and items[1]:
-                        bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
-                        d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
-                    if len(items) > 2 and items[2]:
-                        bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % items[2])
-                        d.appendVar('UBOOT_BINARIES', ' ' + items[2])
-                    else:
-                        bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % ubootbinary)
-                        d.appendVar('UBOOT_BINARIES', ' ' + ubootbinary)
-                    return
-        raise bb.parse.SkipRecipe("The selected UBOOT_CONFIG key %s has no match in %s." % (ubootconfig, ubootconfigflags.keys()))
-}
diff --git a/poky/meta/classes/uboot-extlinux-config.bbclass b/poky/meta/classes/uboot-extlinux-config.bbclass
deleted file mode 100644
index dcebe7f..0000000
--- a/poky/meta/classes/uboot-extlinux-config.bbclass
+++ /dev/null
@@ -1,158 +0,0 @@
-# uboot-extlinux-config.bbclass
-#
-# This class allow the extlinux.conf generation for U-Boot use. The
-# U-Boot support for it is given to allow the Generic Distribution
-# Configuration specification use by OpenEmbedded-based products.
-#
-# External variables:
-#
-# UBOOT_EXTLINUX_CONSOLE           - Set to "console=ttyX" to change kernel boot
-#                                    default console.
-# UBOOT_EXTLINUX_LABELS            - A list of targets for the automatic config.
-# UBOOT_EXTLINUX_KERNEL_ARGS       - Add additional kernel arguments.
-# UBOOT_EXTLINUX_KERNEL_IMAGE      - Kernel image name.
-# UBOOT_EXTLINUX_FDTDIR            - Device tree directory.
-# UBOOT_EXTLINUX_FDT               - Device tree file.
-# UBOOT_EXTLINUX_INITRD            - Indicates a list of filesystem images to
-#                                    concatenate and use as an initrd (optional).
-# UBOOT_EXTLINUX_MENU_DESCRIPTION  - Name to use as description.
-# UBOOT_EXTLINUX_ROOT              - Root kernel cmdline.
-# UBOOT_EXTLINUX_TIMEOUT           - Timeout before DEFAULT selection is made.
-#                                    Measured in 1/10 of a second.
-# UBOOT_EXTLINUX_DEFAULT_LABEL     - Target to be selected by default after
-#                                    the timeout period
-#
-# If there's only one label system will boot automatically and menu won't be
-# created. If you want to use more than one labels, e.g linux and alternate,
-# use overrides to set menu description, console and others variables.
-#
-# Ex:
-#
-# UBOOT_EXTLINUX_LABELS ??= "default fallback"
-#
-# UBOOT_EXTLINUX_DEFAULT_LABEL ??= "Linux Default"
-# UBOOT_EXTLINUX_TIMEOUT ??= "30"
-#
-# UBOOT_EXTLINUX_KERNEL_IMAGE_default ??= "../zImage"
-# UBOOT_EXTLINUX_MENU_DESCRIPTION_default ??= "Linux Default"
-#
-# UBOOT_EXTLINUX_KERNEL_IMAGE_fallback ??= "../zImage-fallback"
-# UBOOT_EXTLINUX_MENU_DESCRIPTION_fallback ??= "Linux Fallback"
-#
-# Results:
-#
-# menu title Select the boot mode
-# TIMEOUT 30
-# DEFAULT Linux Default
-# LABEL Linux Default
-#   KERNEL ../zImage
-#   FDTDIR ../
-#   APPEND root=/dev/mmcblk2p2 rootwait rw console=${console}
-# LABEL Linux Fallback
-#   KERNEL ../zImage-fallback
-#   FDTDIR ../
-#   APPEND root=/dev/mmcblk2p2 rootwait rw console=${console}
-#
-# Copyright (C) 2016, O.S. Systems Software LTDA.  All Rights Reserved
-# Released under the MIT license (see packages/COPYING)
-#
-# The kernel has an internal default console, which you can override with
-# a console=...some_tty...
-UBOOT_EXTLINUX_CONSOLE ??= "console=${console},${baudrate}"
-UBOOT_EXTLINUX_LABELS ??= "linux"
-UBOOT_EXTLINUX_FDT ??= ""
-UBOOT_EXTLINUX_FDTDIR ??= "../"
-UBOOT_EXTLINUX_KERNEL_IMAGE ??= "../${KERNEL_IMAGETYPE}"
-UBOOT_EXTLINUX_KERNEL_ARGS ??= "rootwait rw"
-UBOOT_EXTLINUX_MENU_DESCRIPTION:linux ??= "${DISTRO_NAME}"
-
-UBOOT_EXTLINUX_CONFIG = "${B}/extlinux.conf"
-
-python do_create_extlinux_config() {
-    if d.getVar("UBOOT_EXTLINUX") != "1":
-      return
-
-    if not d.getVar('WORKDIR'):
-        bb.error("WORKDIR not defined, unable to package")
-
-    labels = d.getVar('UBOOT_EXTLINUX_LABELS')
-    if not labels:
-        bb.fatal("UBOOT_EXTLINUX_LABELS not defined, nothing to do")
-
-    if not labels.strip():
-        bb.fatal("No labels, nothing to do")
-
-    cfile = d.getVar('UBOOT_EXTLINUX_CONFIG')
-    if not cfile:
-        bb.fatal('Unable to read UBOOT_EXTLINUX_CONFIG')
-
-    localdata = bb.data.createCopy(d)
-
-    try:
-        with open(cfile, 'w') as cfgfile:
-            cfgfile.write('# Generic Distro Configuration file generated by OpenEmbedded\n')
-
-            if len(labels.split()) > 1:
-                cfgfile.write('menu title Select the boot mode\n')
-
-            timeout =  localdata.getVar('UBOOT_EXTLINUX_TIMEOUT')
-            if timeout:
-                cfgfile.write('TIMEOUT %s\n' % (timeout))
-
-            if len(labels.split()) > 1:
-                default = localdata.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL')
-                if default:
-                    cfgfile.write('DEFAULT %s\n' % (default))
-
-            # Need to deconflict the labels with existing overrides
-            label_overrides = labels.split()
-            default_overrides = localdata.getVar('OVERRIDES').split(':')
-            # We're keeping all the existing overrides that aren't used as a label
-            # an override for that label will be added back in while we're processing that label
-            keep_overrides = list(filter(lambda x: x not in label_overrides, default_overrides))
-
-            for label in labels.split():
-
-                localdata.setVar('OVERRIDES', ':'.join(keep_overrides + [label]))
-
-                extlinux_console = localdata.getVar('UBOOT_EXTLINUX_CONSOLE')
-
-                menu_description = localdata.getVar('UBOOT_EXTLINUX_MENU_DESCRIPTION')
-                if not menu_description:
-                    menu_description = label
-
-                root = localdata.getVar('UBOOT_EXTLINUX_ROOT')
-                if not root:
-                    bb.fatal('UBOOT_EXTLINUX_ROOT not defined')
-
-                kernel_image = localdata.getVar('UBOOT_EXTLINUX_KERNEL_IMAGE')
-                fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR')
-
-                fdt = localdata.getVar('UBOOT_EXTLINUX_FDT')
-
-                if fdt:
-                    cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' %
-                                 (menu_description, kernel_image, fdt))
-                elif fdtdir:
-                    cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDTDIR %s\n' %
-                                 (menu_description, kernel_image, fdtdir))
-                else:
-                    cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image))
-
-                kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS')
-
-                initrd = localdata.getVar('UBOOT_EXTLINUX_INITRD')
-                if initrd:
-                    cfgfile.write('\tINITRD %s\n'% initrd)
-
-                kernel_args = root + " " + kernel_args
-                cfgfile.write('\tAPPEND %s %s\n' % (kernel_args, extlinux_console))
-
-    except OSError:
-        bb.fatal('Unable to open %s' % (cfile))
-}
-UBOOT_EXTLINUX_VARS = "CONSOLE MENU_DESCRIPTION ROOT KERNEL_IMAGE FDTDIR FDT KERNEL_ARGS INITRD"
-do_create_extlinux_config[vardeps] += "${@' '.join(['UBOOT_EXTLINUX_%s_%s' % (v, l) for v in d.getVar('UBOOT_EXTLINUX_VARS').split() for l in d.getVar('UBOOT_EXTLINUX_LABELS').split()])}"
-do_create_extlinux_config[vardepsexclude] += "OVERRIDES"
-
-addtask create_extlinux_config before do_install do_deploy after do_compile
diff --git a/poky/meta/classes/uboot-sign.bbclass b/poky/meta/classes/uboot-sign.bbclass
deleted file mode 100644
index eecdec9..0000000
--- a/poky/meta/classes/uboot-sign.bbclass
+++ /dev/null
@@ -1,499 +0,0 @@
-# This file is part of U-Boot verified boot support and is intended to be
-# inherited from u-boot recipe and from kernel-fitimage.bbclass.
-#
-# The signature procedure requires the user to generate an RSA key and
-# certificate in a directory and to define the following variable:
-#
-#   UBOOT_SIGN_KEYDIR = "/keys/directory"
-#   UBOOT_SIGN_KEYNAME = "dev" # keys name in keydir (eg. "dev.crt", "dev.key")
-#   UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
-#   UBOOT_SIGN_ENABLE = "1"
-#
-# As verified boot depends on fitImage generation, following is also required:
-#
-#   KERNEL_CLASSES ?= " kernel-fitimage "
-#   KERNEL_IMAGETYPE ?= "fitImage"
-#
-# The signature support is limited to the use of CONFIG_OF_SEPARATE in U-Boot.
-#
-# The tasks sequence is set as below, using DEPLOY_IMAGE_DIR as common place to
-# treat the device tree blob:
-#
-# * u-boot:do_install:append
-#   Install UBOOT_DTB_BINARY to datadir, so that kernel can use it for
-#   signing, and kernel will deploy UBOOT_DTB_BINARY after signs it.
-#
-# * virtual/kernel:do_assemble_fitimage
-#   Sign the image
-#
-# * u-boot:do_deploy[postfuncs]
-#   Deploy files like UBOOT_DTB_IMAGE, UBOOT_DTB_SYMLINK and others.
-#
-# For more details on signature process, please refer to U-Boot documentation.
-
-# We need some variables from u-boot-config
-inherit uboot-config
-
-# Enable use of a U-Boot fitImage
-UBOOT_FITIMAGE_ENABLE ?= "0"
-
-# Signature activation - these require their respective fitImages
-UBOOT_SIGN_ENABLE ?= "0"
-SPL_SIGN_ENABLE ?= "0"
-
-# Default value for deployment filenames.
-UBOOT_DTB_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.dtb"
-UBOOT_DTB_BINARY ?= "u-boot.dtb"
-UBOOT_DTB_SYMLINK ?= "u-boot-${MACHINE}.dtb"
-UBOOT_NODTB_IMAGE ?= "u-boot-nodtb-${MACHINE}-${PV}-${PR}.bin"
-UBOOT_NODTB_BINARY ?= "u-boot-nodtb.bin"
-UBOOT_NODTB_SYMLINK ?= "u-boot-nodtb-${MACHINE}.bin"
-UBOOT_ITS_IMAGE ?= "u-boot-its-${MACHINE}-${PV}-${PR}"
-UBOOT_ITS ?= "u-boot.its"
-UBOOT_ITS_SYMLINK ?= "u-boot-its-${MACHINE}"
-UBOOT_FITIMAGE_IMAGE ?= "u-boot-fitImage-${MACHINE}-${PV}-${PR}"
-UBOOT_FITIMAGE_BINARY ?= "u-boot-fitImage"
-UBOOT_FITIMAGE_SYMLINK ?= "u-boot-fitImage-${MACHINE}"
-SPL_DIR ?= "spl"
-SPL_DTB_IMAGE ?= "u-boot-spl-${MACHINE}-${PV}-${PR}.dtb"
-SPL_DTB_BINARY ?= "u-boot-spl.dtb"
-SPL_DTB_SYMLINK ?= "u-boot-spl-${MACHINE}.dtb"
-SPL_NODTB_IMAGE ?= "u-boot-spl-nodtb-${MACHINE}-${PV}-${PR}.bin"
-SPL_NODTB_BINARY ?= "u-boot-spl-nodtb.bin"
-SPL_NODTB_SYMLINK ?= "u-boot-spl-nodtb-${MACHINE}.bin"
-
-# U-Boot fitImage description
-UBOOT_FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"
-
-# Kernel / U-Boot fitImage Hash Algo
-FIT_HASH_ALG ?= "sha256"
-UBOOT_FIT_HASH_ALG ?= "sha256"
-
-# Kernel / U-Boot fitImage Signature Algo
-FIT_SIGN_ALG ?= "rsa2048"
-UBOOT_FIT_SIGN_ALG ?= "rsa2048"
-
-# Kernel / U-Boot fitImage Padding Algo
-FIT_PAD_ALG ?= "pkcs-1.5"
-
-# Generate keys for signing Kernel / U-Boot fitImage
-FIT_GENERATE_KEYS ?= "0"
-UBOOT_FIT_GENERATE_KEYS ?= "0"
-
-# Size of private keys in number of bits
-FIT_SIGN_NUMBITS ?= "2048"
-UBOOT_FIT_SIGN_NUMBITS ?= "2048"
-
-# args to openssl genrsa (Default is just the public exponent)
-FIT_KEY_GENRSA_ARGS ?= "-F4"
-UBOOT_FIT_KEY_GENRSA_ARGS ?= "-F4"
-
-# args to openssl req (Default is -batch for non interactive mode and
-# -new for new certificate)
-FIT_KEY_REQ_ARGS ?= "-batch -new"
-UBOOT_FIT_KEY_REQ_ARGS ?= "-batch -new"
-
-# Standard format for public key certificate
-FIT_KEY_SIGN_PKCS ?= "-x509"
-UBOOT_FIT_KEY_SIGN_PKCS ?= "-x509"
-
-# Functions on this bbclass can apply to either U-boot or Kernel,
-# depending on the scenario
-UBOOT_PN = "${@d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'}"
-KERNEL_PN = "${@d.getVar('PREFERRED_PROVIDER_virtual/kernel')}"
-
-# We need u-boot-tools-native if we're creating a U-Boot fitImage
-python() {
-    if d.getVar('UBOOT_FITIMAGE_ENABLE') == '1':
-        depends = d.getVar("DEPENDS")
-        depends = "%s u-boot-tools-native dtc-native" % depends
-        d.setVar("DEPENDS", depends)
-}
-
-concat_dtb_helper() {
-	if [ -e "${UBOOT_DTB_BINARY}" ]; then
-		ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY}
-		ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK}
-	fi
-
-	if [ -f "${UBOOT_NODTB_BINARY}" ]; then
-		install ${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}
-		ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_SYMLINK}
-		ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_BINARY}
-	fi
-
-	# If we're not using a signed u-boot fit, concatenate SPL w/o DTB & U-Boot DTB
-	# with public key (otherwise it will be deployed by the equivalent
-	# concat_spl_dtb_helper function - cf. kernel-fitimage.bbclass for more details)
-	if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then
-		deployed_uboot_dtb_binary='${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_IMAGE}'
-		if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
-			[ -e "$deployed_uboot_dtb_binary" ]; then
-			oe_runmake EXT_DTB=$deployed_uboot_dtb_binary
-			install ${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
-		elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then
-			cd ${DEPLOYDIR}
-			cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE}
-
-			if [ -n "${UBOOT_CONFIG}" ]
-			then
-				i=0
-				j=0
-				for config in ${UBOOT_MACHINE}; do
-					i=$(expr $i + 1);
-					for type in ${UBOOT_CONFIG}; do
-						j=$(expr $j + 1);
-						if [ $j -eq $i ]
-						then
-							cp ${UBOOT_IMAGE} ${B}/${CONFIG_B_PATH}/u-boot-$type.${UBOOT_SUFFIX}
-						fi
-					done
-				done
-			fi
-		else
-			bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
-		fi
-	fi
-}
-
-concat_spl_dtb_helper() {
-
-	# We only deploy symlinks to the u-boot-spl.dtb,as the KERNEL_PN will
-	# be responsible for deploying the real file
-	if [ -e "${SPL_DIR}/${SPL_DTB_BINARY}" ] ; then
-		ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_SYMLINK}
-		ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_BINARY}
-	fi
-
-	# Concatenate the SPL nodtb binary and u-boot.dtb
-	deployed_spl_dtb_binary='${DEPLOY_DIR_IMAGE}/${SPL_DTB_IMAGE}'
-	if [ -e "${DEPLOYDIR}/${SPL_NODTB_IMAGE}" -a -e "$deployed_spl_dtb_binary" ] ; then
-		cd ${DEPLOYDIR}
-		cat ${SPL_NODTB_IMAGE} $deployed_spl_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${SPL_BINARY} > ${SPL_IMAGE}
-	else
-		bbwarn "Failure while adding public key to spl binary. Verified U-Boot boot won't be available."
-	fi
-}
-
-
-concat_dtb() {
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" -a -n "${UBOOT_DTB_BINARY}" ]; then
-		mkdir -p ${DEPLOYDIR}
-		if [ -n "${UBOOT_CONFIG}" ]; then
-			for config in ${UBOOT_MACHINE}; do
-				CONFIG_B_PATH="$config"
-				cd ${B}/$config
-				concat_dtb_helper
-			done
-		else
-			CONFIG_B_PATH=""
-			cd ${B}
-			concat_dtb_helper
-		fi
-	fi
-}
-
-concat_spl_dtb() {
-	if [ "${SPL_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" -a -n "${SPL_DTB_BINARY}" ]; then
-		mkdir -p ${DEPLOYDIR}
-		if [ -n "${UBOOT_CONFIG}" ]; then
-			for config in ${UBOOT_MACHINE}; do
-				CONFIG_B_PATH="$config"
-				cd ${B}/$config
-				concat_spl_dtb_helper
-			done
-		else
-			CONFIG_B_PATH=""
-			cd ${B}
-			concat_spl_dtb_helper
-		fi
-	fi
-}
-
-
-# Install UBOOT_DTB_BINARY to datadir, so that kernel can use it for
-# signing, and kernel will deploy UBOOT_DTB_BINARY after signs it.
-install_helper() {
-	if [ -f "${UBOOT_DTB_BINARY}" ]; then
-		# UBOOT_DTB_BINARY is a symlink to UBOOT_DTB_IMAGE, so we
-		# need both of them.
-		install -Dm 0644 ${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE}
-		ln -sf ${UBOOT_DTB_IMAGE} ${D}${datadir}/${UBOOT_DTB_BINARY}
-	else
-		bbwarn "${UBOOT_DTB_BINARY} not found"
-	fi
-}
-
-# Install SPL dtb and u-boot nodtb to datadir,
-install_spl_helper() {
-	if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then
-		install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE}
-		ln -sf ${SPL_DTB_IMAGE} ${D}${datadir}/${SPL_DTB_BINARY}
-	else
-		bbwarn "${SPL_DTB_BINARY} not found"
-	fi
-	if [ -f "${UBOOT_NODTB_BINARY}" ] ; then
-		install -Dm 0644 ${UBOOT_NODTB_BINARY} ${D}${datadir}/${UBOOT_NODTB_IMAGE}
-		ln -sf ${UBOOT_NODTB_IMAGE} ${D}${datadir}/${UBOOT_NODTB_BINARY}
-	else
-		bbwarn "${UBOOT_NODTB_BINARY} not found"
-	fi
-
-	# We need to install a 'stub' u-boot-fitimage + its to datadir,
-	# so that the KERNEL_PN can use the correct filename when
-	# assembling and deploying them
-	touch ${D}/${datadir}/${UBOOT_FITIMAGE_IMAGE}
-	touch ${D}/${datadir}/${UBOOT_ITS_IMAGE}
-}
-
-do_install:append() {
-	if [ "${PN}" = "${UBOOT_PN}" ]; then
-		if [ -n "${UBOOT_CONFIG}" ]; then
-			for config in ${UBOOT_MACHINE}; do
-				cd ${B}/$config
-				if [ "${UBOOT_SIGN_ENABLE}" = "1" -o "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
-					[ -n "${UBOOT_DTB_BINARY}" ]; then
-					install_helper
-				fi
-				if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
-					install_spl_helper
-				fi
-			done
-		else
-			cd ${B}
-			if [ "${UBOOT_SIGN_ENABLE}" = "1" -o "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
-				[ -n "${UBOOT_DTB_BINARY}" ]; then
-				install_helper
-			fi
-			if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
-				install_spl_helper
-			fi
-		fi
-	fi
-}
-
-do_uboot_generate_rsa_keys() {
-	if [ "${SPL_SIGN_ENABLE}" = "0" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
-		bbwarn "UBOOT_FIT_GENERATE_KEYS is set to 1 eventhough SPL_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used."
-	fi
-
-	if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
-
-		# Generate keys only if they don't already exist
-		if [ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key ] || \
-			[ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt ]; then
-
-			# make directory if it does not already exist
-			mkdir -p "${SPL_SIGN_KEYDIR}"
-
-			echo "Generating RSA private key for signing U-Boot fitImage"
-			openssl genrsa ${UBOOT_FIT_KEY_GENRSA_ARGS} -out \
-				"${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
-				"${UBOOT_FIT_SIGN_NUMBITS}"
-
-			echo "Generating certificate for signing U-Boot fitImage"
-			openssl req ${FIT_KEY_REQ_ARGS} "${UBOOT_FIT_KEY_SIGN_PKCS}" \
-				-key "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
-				-out "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt
-		fi
-	fi
-
-}
-
-addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile
-
-# Create a ITS file for the U-boot FIT, for use when
-# we want to sign it so that the SPL can verify it
-uboot_fitimage_assemble() {
-	uboot_its="$1"
-	uboot_nodtb_bin="$2"
-	uboot_dtb="$3"
-	uboot_bin="$4"
-	spl_dtb="$5"
-	uboot_csum="${UBOOT_FIT_HASH_ALG}"
-	uboot_sign_algo="${UBOOT_FIT_SIGN_ALG}"
-	uboot_sign_keyname="${SPL_SIGN_KEYNAME}"
-
-	rm -f $uboot_its $uboot_bin
-
-	# First we create the ITS script
-	cat << EOF >> $uboot_its
-/dts-v1/;
-
-/ {
-    description = "${UBOOT_FIT_DESC}";
-    #address-cells = <1>;
-
-    images {
-        uboot {
-            description = "U-Boot image";
-            data = /incbin/("$uboot_nodtb_bin");
-            type = "standalone";
-            os = "u-boot";
-            arch = "${UBOOT_ARCH}";
-            compression = "none";
-            load = <${UBOOT_LOADADDRESS}>;
-            entry = <${UBOOT_ENTRYPOINT}>;
-EOF
-
-	if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
-		cat << EOF >> $uboot_its
-            signature {
-                algo = "$uboot_csum,$uboot_sign_algo";
-                key-name-hint = "$uboot_sign_keyname";
-            };
-EOF
-	fi
-
-	cat << EOF >> $uboot_its
-        };
-        fdt {
-            description = "U-Boot FDT";
-            data = /incbin/("$uboot_dtb");
-            type = "flat_dt";
-            arch = "${UBOOT_ARCH}";
-            compression = "none";
-EOF
-
-	if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
-		cat << EOF >> $uboot_its
-            signature {
-                algo = "$uboot_csum,$uboot_sign_algo";
-                key-name-hint = "$uboot_sign_keyname";
-            };
-EOF
-	fi
-
-	cat << EOF >> $uboot_its
-        };
-    };
-
-    configurations {
-        default = "conf";
-        conf {
-            description = "Boot with signed U-Boot FIT";
-            loadables = "uboot";
-            fdt = "fdt";
-        };
-    };
-};
-EOF
-
-	#
-	# Assemble the U-boot FIT image
-	#
-	${UBOOT_MKIMAGE} \
-		${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
-		-f $uboot_its \
-		$uboot_bin
-
-	if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
-		#
-		# Sign the U-boot FIT image and add public key to SPL dtb
-		#
-		${UBOOT_MKIMAGE_SIGN} \
-			${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
-			-F -k "${SPL_SIGN_KEYDIR}" \
-			-K "$spl_dtb" \
-			-r $uboot_bin \
-			${SPL_MKIMAGE_SIGN_ARGS}
-	fi
-
-}
-
-do_uboot_assemble_fitimage() {
-	# This function runs in KERNEL_PN context. The reason for that is that we need to
-	# support the scenario where UBOOT_SIGN_ENABLE is placing the Kernel fitImage's
-	# pubkey in the u-boot.dtb file, so that we can use it when building the U-Boot
-	# fitImage itself.
-	if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
-	   [ -n "${SPL_DTB_BINARY}" -a "${PN}" = "${KERNEL_PN}" ] ; then
-		if [ "${UBOOT_SIGN_ENABLE}" != "1" ]; then
-			# If we're not signing the Kernel fitImage, that means
-			# we need to copy the u-boot.dtb from staging ourselves
-			cp -P ${STAGING_DATADIR}/u-boot*.dtb ${B}
-		fi
-		# As we are in the kernel context, we need to copy u-boot-spl.dtb from staging first.
-		# Unfortunately, need to glob on top of ${SPL_DTB_BINARY} since _IMAGE and _SYMLINK
-		# will contain U-boot's PV
-		# Similarly, we need to get the filename for the 'stub' u-boot-fitimage + its in
-		# staging so that we can use it for creating the image with the correct filename
-		# in the KERNEL_PN context.
-		# As for the u-boot.dtb (with fitimage's pubkey), it should come from the dependent
-		# do_assemble_fitimage task
-		cp -P ${STAGING_DATADIR}/u-boot-spl*.dtb ${B}
-		cp -P ${STAGING_DATADIR}/u-boot-nodtb*.bin ${B}
-		rm -rf ${B}/u-boot-fitImage-* ${B}/u-boot-its-*
-		kernel_uboot_fitimage_name=`basename ${STAGING_DATADIR}/u-boot-fitImage-*`
-		kernel_uboot_its_name=`basename ${STAGING_DATADIR}/u-boot-its-*`
-		cd ${B}
-		uboot_fitimage_assemble $kernel_uboot_its_name ${UBOOT_NODTB_BINARY} \
-					${UBOOT_DTB_BINARY} $kernel_uboot_fitimage_name \
-					${SPL_DTB_BINARY}
-	fi
-}
-
-addtask uboot_assemble_fitimage before do_deploy after do_compile
-
-do_deploy:prepend:pn-${UBOOT_PN}() {
-	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
-		concat_dtb
-	fi
-
-	if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
-	# Deploy the u-boot-nodtb binary and symlinks...
-		if [ -f "${SPL_DIR}/${SPL_NODTB_BINARY}" ] ; then
-			echo "Copying u-boot-nodtb binary..."
-			install -m 0644 ${SPL_DIR}/${SPL_NODTB_BINARY} ${DEPLOYDIR}/${SPL_NODTB_IMAGE}
-			ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_SYMLINK}
-			ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_BINARY}
-		fi
-
-
-		# We only deploy the symlinks to the uboot-fitImage and uboot-its
-		# images, as the KERNEL_PN will take care of deploying the real file
-		ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_BINARY}
-		ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_SYMLINK}
-		ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS}
-		ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS_SYMLINK}
-	fi
-
-	if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then
-		concat_spl_dtb
-	fi
-
-
-}
-
-do_deploy:append:pn-${UBOOT_PN}() {
-	# If we're creating a u-boot fitImage, point u-boot.bin
-	# symlink since it might get used by image recipes
-	if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
-		ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_BINARY}
-		ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_SYMLINK}
-	fi
-}
-
-python () {
-    if (   (d.getVar('UBOOT_SIGN_ENABLE') == '1'
-            or d.getVar('UBOOT_FITIMAGE_ENABLE') == '1')
-        and d.getVar('PN') == d.getVar('UBOOT_PN')
-        and d.getVar('UBOOT_DTB_BINARY')):
-
-        # Make "bitbake u-boot -cdeploy" deploys the signed u-boot.dtb
-        # and/or the U-Boot fitImage
-        d.appendVarFlag('do_deploy', 'depends', ' %s:do_deploy' % d.getVar('KERNEL_PN'))
-
-    if d.getVar('UBOOT_FITIMAGE_ENABLE') == '1' and d.getVar('PN') == d.getVar('KERNEL_PN'):
-        # As the U-Boot fitImage is created by the KERNEL_PN, we need
-        # to make sure that the u-boot-spl.dtb and u-boot-spl-nodtb.bin
-        # files are in the staging dir for it's use
-        d.appendVarFlag('do_uboot_assemble_fitimage', 'depends', ' %s:do_populate_sysroot' % d.getVar('UBOOT_PN'))
-
-        # If the Kernel fitImage is being signed, we need to
-        # create the U-Boot fitImage after it
-        if d.getVar('UBOOT_SIGN_ENABLE') == '1':
-            d.appendVarFlag('do_uboot_assemble_fitimage', 'depends', ' %s:do_assemble_fitimage' % d.getVar('KERNEL_PN'))
-            d.appendVarFlag('do_uboot_assemble_fitimage', 'depends', ' %s:do_assemble_fitimage_initramfs' % d.getVar('KERNEL_PN'))
-
-}
diff --git a/poky/meta/classes/uninative.bbclass b/poky/meta/classes/uninative.bbclass
deleted file mode 100644
index 6a9e862..0000000
--- a/poky/meta/classes/uninative.bbclass
+++ /dev/null
@@ -1,171 +0,0 @@
-UNINATIVE_LOADER ?= "${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux/lib/${@bb.utils.contains('BUILD_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', '', d)}${@bb.utils.contains('BUILD_ARCH', 'i686', 'ld-linux.so.2', '', d)}${@bb.utils.contains('BUILD_ARCH', 'aarch64', 'ld-linux-aarch64.so.1', '', d)}${@bb.utils.contains('BUILD_ARCH', 'ppc64le', 'ld64.so.2', '', d)}"
-UNINATIVE_STAGING_DIR ?= "${STAGING_DIR}"
-
-UNINATIVE_URL ?= "unset"
-UNINATIVE_TARBALL ?= "${BUILD_ARCH}-nativesdk-libc-${UNINATIVE_VERSION}.tar.xz"
-# Example checksums
-#UNINATIVE_CHECKSUM[aarch64] = "dead"
-#UNINATIVE_CHECKSUM[i686] = "dead"
-#UNINATIVE_CHECKSUM[x86_64] = "dead"
-UNINATIVE_DLDIR ?= "${DL_DIR}/uninative/"
-
-# Enabling uninative will change the following variables so they need to go the parsing ignored variables list to prevent multiple recipe parsing
-BB_HASHCONFIG_IGNORE_VARS += "NATIVELSBSTRING SSTATEPOSTUNPACKFUNCS BUILD_LDFLAGS"
-
-addhandler uninative_event_fetchloader
-uninative_event_fetchloader[eventmask] = "bb.event.BuildStarted"
-
-addhandler uninative_event_enable
-uninative_event_enable[eventmask] = "bb.event.ConfigParsed"
-
-python uninative_event_fetchloader() {
-    """
-    This event fires on the parent and will try to fetch the tarball if the
-    loader isn't already present.
-    """
-
-    chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH"))
-    if not chksum:
-        bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH"))
-
-    loader = d.getVar("UNINATIVE_LOADER")
-    loaderchksum = loader + ".chksum"
-    if os.path.exists(loader) and os.path.exists(loaderchksum):
-        with open(loaderchksum, "r") as f:
-            readchksum = f.read().strip()
-        if readchksum == chksum:
-            return
-
-    import subprocess
-    try:
-        # Save and restore cwd as Fetch.download() does a chdir()
-        olddir = os.getcwd()
-
-        tarball = d.getVar("UNINATIVE_TARBALL")
-        tarballdir = os.path.join(d.getVar("UNINATIVE_DLDIR"), chksum)
-        tarballpath = os.path.join(tarballdir, tarball)
-
-        if not os.path.exists(tarballpath + ".done"):
-            bb.utils.mkdirhier(tarballdir)
-            if d.getVar("UNINATIVE_URL") == "unset":
-                bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
-
-            localdata = bb.data.createCopy(d)
-            localdata.setVar('FILESPATH', "")
-            localdata.setVar('DL_DIR', tarballdir)
-            # Our games with path manipulation of DL_DIR mean standard PREMIRRORS don't work
-            # and we can't easily put 'chksum' into the url path from a url parameter with
-            # the current fetcher url handling
-            premirrors = bb.fetch2.mirror_from_string(localdata.getVar("PREMIRRORS"))
-            for line in premirrors:
-                try:
-                    (find, replace) = line
-                except ValueError:
-                    continue
-                if find.startswith("http"):
-                    localdata.appendVar("PREMIRRORS", " ${UNINATIVE_URL}${UNINATIVE_TARBALL} %s/uninative/%s/${UNINATIVE_TARBALL}" % (replace, chksum))
-
-            srcuri = d.expand("${UNINATIVE_URL}${UNINATIVE_TARBALL};sha256sum=%s" % chksum)
-            bb.note("Fetching uninative binary shim %s (will check PREMIRRORS first)" % srcuri)
-
-            fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
-            fetcher.download()
-            localpath = fetcher.localpath(srcuri)
-            if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath):
-                # Follow the symlink behavior from the bitbake fetch2.
-                # This will cover the case where an existing symlink is broken
-                # as well as if there are two processes trying to create it
-                # at the same time.
-                if os.path.islink(tarballpath):
-                    # Broken symbolic link
-                    os.unlink(tarballpath)
-
-                # Deal with two processes trying to make symlink at once
-                try:
-                    os.symlink(localpath, tarballpath)
-                except FileExistsError:
-                    pass
-
-        # ldd output is "ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23", extract last option from first line
-        glibcver = subprocess.check_output(["ldd", "--version"]).decode('utf-8').split('\n')[0].split()[-1]
-        if bb.utils.vercmp_string(d.getVar("UNINATIVE_MAXGLIBCVERSION"), glibcver) < 0:
-            raise RuntimeError("Your host glibc version (%s) is newer than that in uninative (%s). Disabling uninative so that sstate is not corrupted." % (glibcver, d.getVar("UNINATIVE_MAXGLIBCVERSION")))
-
-        cmd = d.expand("\
-mkdir -p ${UNINATIVE_STAGING_DIR}-uninative; \
-cd ${UNINATIVE_STAGING_DIR}-uninative; \
-tar -xJf ${UNINATIVE_DLDIR}/%s/${UNINATIVE_TARBALL}; \
-${UNINATIVE_STAGING_DIR}-uninative/relocate_sdk.py \
-  ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux \
-  ${UNINATIVE_LOADER} \
-  ${UNINATIVE_LOADER} \
-  ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux/${bindir_native}/patchelf-uninative \
-  ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux${base_libdir_native}/libc*.so*" % chksum)
-        subprocess.check_output(cmd, shell=True)
-
-        with open(loaderchksum, "w") as f:
-            f.write(chksum)
-
-        enable_uninative(d)
-
-    except RuntimeError as e:
-        bb.warn(str(e))
-    except bb.fetch2.BBFetchException as exc:
-        bb.warn("Disabling uninative as unable to fetch uninative tarball: %s" % str(exc))
-        bb.warn("To build your own uninative loader, please bitbake uninative-tarball and set UNINATIVE_TARBALL appropriately.")
-    except subprocess.CalledProcessError as exc:
-        bb.warn("Disabling uninative as unable to install uninative tarball: %s" % str(exc))
-        bb.warn("To build your own uninative loader, please bitbake uninative-tarball and set UNINATIVE_TARBALL appropriately.")
-    finally:
-        os.chdir(olddir)
-}
-
-python uninative_event_enable() {
-    """
-    This event handler is called in the workers and is responsible for setting
-    up uninative if a loader is found.
-    """
-    enable_uninative(d)
-}
-
-def enable_uninative(d):
-    loader = d.getVar("UNINATIVE_LOADER")
-    if os.path.exists(loader):
-        bb.debug(2, "Enabling uninative")
-        d.setVar("NATIVELSBSTRING", "universal%s" % oe.utils.host_gcc_version(d))
-        d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
-        d.appendVarFlag("SSTATEPOSTUNPACKFUNCS", "vardepvalueexclude", "| uninative_changeinterp")
-        d.appendVar("BUILD_LDFLAGS", " -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=${UNINATIVE_LOADER}")
-        d.appendVarFlag("BUILD_LDFLAGS", "vardepvalueexclude", "| -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=${UNINATIVE_LOADER}")
-        d.appendVarFlag("BUILD_LDFLAGS", "vardepsexclude", "UNINATIVE_LOADER")
-        d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
-
-python uninative_changeinterp () {
-    import subprocess
-    import stat
-    import oe.qa
-
-    if not (bb.data.inherits_class('native', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross', d)):
-        return
-
-    sstateinst = d.getVar('SSTATE_INSTDIR')
-    for walkroot, dirs, files in os.walk(sstateinst):
-        for file in files:
-            if file.endswith(".so") or ".so." in file:
-                continue
-            f = os.path.join(walkroot, file)
-            if os.path.islink(f):
-                continue
-            s = os.stat(f)
-            if not ((s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH)):
-                continue
-            elf = oe.qa.ELFFile(f)
-            try:
-                elf.open()
-            except oe.qa.NotELFFileError:
-                continue
-            if not elf.isDynamic():
-                continue
-
-            subprocess.check_output(("patchelf-uninative", "--set-interpreter", d.getVar("UNINATIVE_LOADER"), f), stderr=subprocess.STDOUT)
-}
diff --git a/poky/meta/classes/update-alternatives.bbclass b/poky/meta/classes/update-alternatives.bbclass
deleted file mode 100644
index fc1ffd8..0000000
--- a/poky/meta/classes/update-alternatives.bbclass
+++ /dev/null
@@ -1,327 +0,0 @@
-# This class is used to help the alternatives system which is useful when
-# multiple sources provide same command. You can use update-alternatives
-# command directly in your recipe, but in most cases this class simplifies
-# that job.
-#
-# To use this class a number of variables should be defined:
-#
-# List all of the alternatives needed by a package:
-# ALTERNATIVE:<pkg> = "name1 name2 name3 ..."
-#
-#   i.e. ALTERNATIVE:busybox = "sh sed test bracket"
-#
-# The pathname of the link
-# ALTERNATIVE_LINK_NAME[name] = "target"
-#
-#   This is the name of the binary once it's been installed onto the runtime.
-#   This name is global to all split packages in this recipe, and should match
-#   other recipes with the same functionality.
-#   i.e. ALTERNATIVE_LINK_NAME[bracket] = "/usr/bin/["
-#
-# NOTE: If ALTERNATIVE_LINK_NAME is not defined, it defaults to ${bindir}/name
-#
-# The default link to create for all targets
-# ALTERNATIVE_TARGET = "target"
-#
-#   This is useful in a multicall binary case
-#   i.e. ALTERNATIVE_TARGET = "/bin/busybox"
-#
-# A non-default link to create for a target
-# ALTERNATIVE_TARGET[name] = "target"
-#
-#   This is the name of the binary as it's been install by do_install
-#   i.e. ALTERNATIVE_TARGET[sh] = "/bin/bash"
-#
-# A package specific link for a target
-# ALTERNATIVE_TARGET_<pkg>[name] = "target"
-#
-#   This is useful when a recipe provides multiple alternatives for the
-#   same item.
-#
-# NOTE: If ALTERNATIVE_TARGET is not defined, it will inherit the value
-# from ALTERNATIVE_LINK_NAME.
-#
-# NOTE: If the ALTERNATIVE_LINK_NAME and ALTERNATIVE_TARGET are the same,
-# ALTERNATIVE_TARGET will have '.{BPN}' appended to it.  If the file
-# referenced has not been renamed, it will also be renamed.  (This avoids
-# the need to rename alternative files in the do_install step, but still
-# supports it if necessary for some reason.)
-#
-# The default priority for any alternatives
-# ALTERNATIVE_PRIORITY = "priority"
-#
-#   i.e. default is ALTERNATIVE_PRIORITY = "10"
-#
-# The non-default priority for a specific target
-# ALTERNATIVE_PRIORITY[name] = "priority"
-#
-# The package priority for a specific target
-# ALTERNATIVE_PRIORITY_<pkg>[name] = "priority"
-
-ALTERNATIVE_PRIORITY = "10"
-
-# We need special processing for vardeps because it can not work on
-# modified flag values.  So we aggregate the flags into a new variable
-# and include that vairable in the set.
-UPDALTVARS  = "ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_PRIORITY"
-
-PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native"
-
-def gen_updatealternativesvardeps(d):
-    pkgs = (d.getVar("PACKAGES") or "").split()
-    vars = (d.getVar("UPDALTVARS") or "").split()
-
-    # First compute them for non_pkg versions
-    for v in vars:
-        for flag in sorted((d.getVarFlags(v) or {}).keys()):
-            if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
-                continue
-            d.appendVar('%s_VARDEPS' % (v), ' %s:%s' % (flag, d.getVarFlag(v, flag, False)))
-
-    for p in pkgs:
-        for v in vars:
-            for flag in sorted((d.getVarFlags("%s_%s" % (v,p)) or {}).keys()):
-                if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
-                    continue
-                d.appendVar('%s_VARDEPS_%s' % (v,p), ' %s:%s' % (flag, d.getVarFlag('%s_%s' % (v,p), flag, False)))
-
-def ua_extend_depends(d):
-    if not 'virtual/update-alternatives' in d.getVar('PROVIDES'):
-        d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives')
-
-def update_alternatives_enabled(d):
-    # Update Alternatives only works on target packages...
-    if bb.data.inherits_class('native', d) or \
-       bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or \
-       bb.data.inherits_class('cross-canadian', d):
-        return False
-
-    # Disable when targeting mingw32 (no target support)
-    if d.getVar("TARGET_OS") == "mingw32":
-        return False
-
-    return True
-
-python __anonymous() {
-    if not update_alternatives_enabled(d):
-        return
-
-    # compute special vardeps
-    gen_updatealternativesvardeps(d)
-
-    # extend the depends to include virtual/update-alternatives
-    ua_extend_depends(d)
-}
-
-def gen_updatealternativesvars(d):
-    ret = []
-    pkgs = (d.getVar("PACKAGES") or "").split()
-    vars = (d.getVar("UPDALTVARS") or "").split()
-
-    for v in vars:
-        ret.append(v + "_VARDEPS")
-
-    for p in pkgs:
-        for v in vars:
-            ret.append(v + ":" + p)
-            ret.append(v + "_VARDEPS_" + p)
-    return " ".join(ret)
-
-# Now the new stuff, we use a custom function to generate the right values
-populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
-
-# We need to do the rename after the image creation step, but before
-# the split and strip steps..  PACKAGE_PREPROCESS_FUNCS is the right
-# place for that.
-PACKAGE_PREPROCESS_FUNCS += "apply_update_alternative_renames"
-python apply_update_alternative_renames () {
-    if not update_alternatives_enabled(d):
-       return
-
-    import re
-
-    def update_files(alt_target, alt_target_rename, pkg, d):
-        f = d.getVar('FILES:' + pkg)
-        if f:
-            f = re.sub(r'(^|\s)%s(\s|$)' % re.escape (alt_target), r'\1%s\2' % alt_target_rename, f)
-            d.setVar('FILES:' + pkg, f)
-
-    # Check for deprecated usage...
-    pn = d.getVar('BPN')
-    if d.getVar('ALTERNATIVE_LINKS') != None:
-        bb.fatal('%s: Use of ALTERNATIVE_LINKS/ALTERNATIVE_PATH/ALTERNATIVE_NAME is no longer supported, please convert to the updated syntax, see update-alternatives.bbclass for more info.' % pn)
-
-    # Do actual update alternatives processing
-    pkgdest = d.getVar('PKGD')
-    for pkg in (d.getVar('PACKAGES') or "").split():
-        # If the src == dest, we know we need to rename the dest by appending ${BPN}
-        link_rename = []
-        for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split():
-            alt_link     = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
-            if not alt_link:
-                alt_link = "%s/%s" % (d.getVar('bindir'), alt_name)
-                d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link)
-            if alt_link.startswith(os.path.join(d.getVar('sysconfdir'), 'init.d')):
-                # Managing init scripts does not work (bug #10433), foremost
-                # because of a race with update-rc.d
-                bb.fatal("Using update-alternatives for managing SysV init scripts is not supported")
-
-            alt_target   = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name)
-            alt_target   = alt_target or d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or d.getVar('ALTERNATIVE_TARGET') or alt_link
-            # Sometimes alt_target is specified as relative to the link name.
-            alt_target   = os.path.join(os.path.dirname(alt_link), alt_target)
-
-            # If the link and target are the same name, we need to rename the target.
-            if alt_link == alt_target:
-                src = '%s/%s' % (pkgdest, alt_target)
-                alt_target_rename = '%s.%s' % (alt_target, pn)
-                dest = '%s/%s' % (pkgdest, alt_target_rename)
-                if os.path.lexists(dest):
-                    bb.note('%s: Already renamed: %s' % (pn, alt_target_rename))
-                elif os.path.lexists(src):
-                    if os.path.islink(src):
-                        # Delay rename of links
-                        link_rename.append((alt_target, alt_target_rename))
-                    else:
-                        bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename))
-                        bb.utils.rename(src, dest)
-                        update_files(alt_target, alt_target_rename, pkg, d)
-                else:
-                    bb.warn("%s: alternative target (%s or %s) does not exist, skipping..." % (pn, alt_target, alt_target_rename))
-                    continue
-                d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name, alt_target_rename)
-
-        # Process delayed link names
-        # Do these after other renames so we can correct broken links
-        for (alt_target, alt_target_rename) in link_rename:
-            src = '%s/%s' % (pkgdest, alt_target)
-            dest = '%s/%s' % (pkgdest, alt_target_rename)
-            link_target = oe.path.realpath(src, pkgdest, True)
-
-            if os.path.lexists(link_target):
-                # Ok, the link_target exists, we can rename
-                bb.note('%s: Rename (link) %s -> %s' % (pn, alt_target, alt_target_rename))
-                bb.utils.rename(src, dest)
-            else:
-                # Try to resolve the broken link to link.${BPN}
-                link_maybe = '%s.%s' % (os.readlink(src), pn)
-                if os.path.lexists(os.path.join(os.path.dirname(src), link_maybe)):
-                    # Ok, the renamed link target exists.. create a new link, and remove the original
-                    bb.note('%s: Creating new link %s -> %s' % (pn, alt_target_rename, link_maybe))
-                    os.symlink(link_maybe, dest)
-                    os.unlink(src)
-                else:
-                    bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
-                    continue
-            update_files(alt_target, alt_target_rename, pkg, d)
-}
-
-def update_alternatives_alt_targets(d, pkg):
-    """
-    Returns the update-alternatives metadata for a package.
-
-    The returned format is a list of tuples where the tuple contains:
-    alt_name:     The binary name
-    alt_link:     The path for the binary (Shared by different packages)
-    alt_target:   The path for the renamed binary (Unique per package)
-    alt_priority: The priority of the alt_target
-
-    All the alt_targets will be installed into the sysroot. The alt_link is
-    a symlink pointing to the alt_target with the highest priority.
-    """
-
-    pn = d.getVar('BPN')
-    pkgdest = d.getVar('PKGD')
-    updates = list()
-    for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split():
-        alt_link     = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
-        alt_target   = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or \
-                       d.getVarFlag('ALTERNATIVE_TARGET', alt_name) or \
-                       d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or \
-                       d.getVar('ALTERNATIVE_TARGET') or \
-                       alt_link
-        alt_priority = d.getVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg,  alt_name) or \
-                       d.getVarFlag('ALTERNATIVE_PRIORITY',  alt_name) or \
-                       d.getVar('ALTERNATIVE_PRIORITY_%s' % pkg) or  \
-                       d.getVar('ALTERNATIVE_PRIORITY')
-
-        # This shouldn't trigger, as it should have been resolved earlier!
-        if alt_link == alt_target:
-            bb.note('alt_link == alt_target: %s == %s -- correcting, this should not happen!' % (alt_link, alt_target))
-            alt_target = '%s.%s' % (alt_target, pn)
-
-        if not os.path.lexists('%s/%s' % (pkgdest, alt_target)):
-            bb.warn('%s: NOT adding alternative provide %s: %s does not exist' % (pn, alt_link, alt_target))
-            continue
-
-        alt_target = os.path.normpath(alt_target)
-        updates.append( (alt_name, alt_link, alt_target, alt_priority) )
-
-    return updates
-
-PACKAGESPLITFUNCS:prepend = "populate_packages_updatealternatives "
-
-python populate_packages_updatealternatives () {
-    if not update_alternatives_enabled(d):
-        return
-
-    # Do actual update alternatives processing
-    for pkg in (d.getVar('PACKAGES') or "").split():
-        # Create post install/removal scripts
-        alt_setup_links = ""
-        alt_remove_links = ""
-        updates = update_alternatives_alt_targets(d, pkg)
-        for alt_name, alt_link, alt_target, alt_priority in updates:
-            alt_setup_links  += '\tupdate-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority)
-            alt_remove_links += '\tupdate-alternatives --remove  %s %s\n' % (alt_name, alt_target)
-
-        if alt_setup_links:
-            # RDEPENDS setup
-            provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives')
-            if provider:
-                #bb.note('adding runtime requirement for update-alternatives for %s' % pkg)
-                d.appendVar('RDEPENDS:%s' % pkg, ' ' + d.getVar('MLPREFIX', False) + provider)
-
-            bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg)
-            bb.note('%s' % alt_setup_links)
-            postinst = d.getVar('pkg_postinst:%s' % pkg)
-            if postinst:
-                postinst = alt_setup_links + postinst
-            else:
-                postinst = '#!/bin/sh\n' + alt_setup_links
-            d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-            bb.note('%s' % alt_remove_links)
-            prerm = d.getVar('pkg_prerm:%s' % pkg) or '#!/bin/sh\n'
-            prerm += alt_remove_links
-            d.setVar('pkg_prerm:%s' % pkg, prerm)
-}
-
-python package_do_filedeps:append () {
-    if update_alternatives_enabled(d):
-        apply_update_alternative_provides(d)
-}
-
-def apply_update_alternative_provides(d):
-    pn = d.getVar('BPN')
-    pkgdest = d.getVar('PKGDEST')
-
-    for pkg in d.getVar('PACKAGES').split():
-        for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split():
-            alt_link     = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
-            alt_target   = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name)
-            alt_target   = alt_target or d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or d.getVar('ALTERNATIVE_TARGET') or alt_link
-
-            if alt_link == alt_target:
-                bb.warn('%s: alt_link == alt_target: %s == %s' % (pn, alt_link, alt_target))
-                alt_target = '%s.%s' % (alt_target, pn)
-
-            if not os.path.lexists('%s/%s/%s' % (pkgdest, pkg, alt_target)):
-                continue
-
-            # Add file provide
-            trans_target = oe.package.file_translate(alt_target)
-            d.appendVar('FILERPROVIDES:%s:%s' % (trans_target, pkg), " " + alt_link)
-            if not trans_target in (d.getVar('FILERPROVIDESFLIST:%s' % pkg) or ""):
-                d.appendVar('FILERPROVIDESFLIST:%s' % pkg, " " + trans_target)
-
diff --git a/poky/meta/classes/update-rc.d.bbclass b/poky/meta/classes/update-rc.d.bbclass
deleted file mode 100644
index 0a3a608..0000000
--- a/poky/meta/classes/update-rc.d.bbclass
+++ /dev/null
@@ -1,123 +0,0 @@
-UPDATERCPN ?= "${PN}"
-
-DEPENDS:append:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', ' update-rc.d initscripts', '', d)}"
-
-UPDATERCD = "update-rc.d"
-UPDATERCD:class-cross = ""
-UPDATERCD:class-native = ""
-UPDATERCD:class-nativesdk = ""
-
-INITSCRIPT_PARAMS ?= "defaults"
-
-INIT_D_DIR = "${sysconfdir}/init.d"
-
-def use_updatercd(d):
-    # If the distro supports both sysvinit and systemd, and the current recipe
-    # supports systemd, only call update-rc.d on rootfs creation or if systemd
-    # is not running. That's because systemctl enable/disable will already call
-    # update-rc.d if it detects initscripts.
-    if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and bb.data.inherits_class('systemd', d):
-        return '[ -n "$D" -o ! -d /run/systemd/system ]'
-    return 'true'
-
-PACKAGE_WRITE_DEPS += "update-rc.d-native"
-
-updatercd_postinst() {
-if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then
-	if [ -n "$D" ]; then
-		OPT="-r $D"
-	else
-		OPT="-s"
-	fi
-	update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
-fi
-}
-
-updatercd_prerm() {
-if ${@use_updatercd(d)} && [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
-	${INIT_D_DIR}/${INITSCRIPT_NAME} stop || :
-fi
-}
-
-updatercd_postrm() {
-if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then
-	if [ -n "$D" ]; then
-		OPT="-f -r $D"
-	else
-		OPT="-f"
-	fi
-	update-rc.d $OPT ${INITSCRIPT_NAME} remove
-fi
-}
-
-
-def update_rc_after_parse(d):
-    if d.getVar('INITSCRIPT_PACKAGES', False) == None:
-        if d.getVar('INITSCRIPT_NAME', False) == None:
-            bb.fatal("%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % d.getVar('FILE', False))
-        if d.getVar('INITSCRIPT_PARAMS', False) == None:
-            bb.fatal("%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % d.getVar('FILE', False))
-
-python __anonymous() {
-    update_rc_after_parse(d)
-}
-
-PACKAGESPLITFUNCS:prepend = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'populate_packages_updatercd ', '', d)}"
-PACKAGESPLITFUNCS:remove:class-nativesdk = "populate_packages_updatercd "
-
-populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_postinst"
-populate_packages_updatercd[vardepsexclude] += "OVERRIDES"
-
-python populate_packages_updatercd () {
-    def update_rcd_auto_depend(pkg):
-        import subprocess
-        import os
-        path = d.expand("${D}${INIT_D_DIR}/${INITSCRIPT_NAME}")
-        if not os.path.exists(path):
-            return
-        statement = "grep -q -w '/etc/init.d/functions' %s" % path
-        if subprocess.call(statement, shell=True) == 0:
-            mlprefix = d.getVar('MLPREFIX') or ""
-            d.appendVar('RDEPENDS:' + pkg, ' %sinitd-functions' % (mlprefix))
-
-    def update_rcd_package(pkg):
-        bb.debug(1, 'adding update-rc.d calls to postinst/prerm/postrm for %s' % pkg)
-
-        localdata = bb.data.createCopy(d)
-        overrides = localdata.getVar("OVERRIDES")
-        localdata.setVar("OVERRIDES", "%s:%s" % (pkg, overrides))
-
-        update_rcd_auto_depend(pkg)
-
-        postinst = d.getVar('pkg_postinst:%s' % pkg)
-        if not postinst:
-            postinst = '#!/bin/sh\n'
-        postinst += localdata.getVar('updatercd_postinst')
-        d.setVar('pkg_postinst:%s' % pkg, postinst)
-
-        prerm = d.getVar('pkg_prerm:%s' % pkg)
-        if not prerm:
-            prerm = '#!/bin/sh\n'
-        prerm += localdata.getVar('updatercd_prerm')
-        d.setVar('pkg_prerm:%s' % pkg, prerm)
-
-        postrm = d.getVar('pkg_postrm:%s' % pkg)
-        if not postrm:
-                postrm = '#!/bin/sh\n'
-        postrm += localdata.getVar('updatercd_postrm')
-        d.setVar('pkg_postrm:%s' % pkg, postrm)
-
-        d.appendVar('RRECOMMENDS:' + pkg, " ${MLPREFIX}${UPDATERCD}")
-
-    # Check that this class isn't being inhibited (generally, by
-    # systemd.bbclass) before doing any work.
-    if not d.getVar("INHIBIT_UPDATERCD_BBCLASS"):
-        pkgs = d.getVar('INITSCRIPT_PACKAGES')
-        if pkgs == None:
-            pkgs = d.getVar('UPDATERCPN')
-            packages = (d.getVar('PACKAGES') or "").split()
-            if not pkgs in packages and packages != []:
-                pkgs = packages[0]
-        for pkg in pkgs.split():
-            update_rcd_package(pkg)
-}
diff --git a/poky/meta/classes/upstream-version-is-even.bbclass b/poky/meta/classes/upstream-version-is-even.bbclass
deleted file mode 100644
index 256c752..0000000
--- a/poky/meta/classes/upstream-version-is-even.bbclass
+++ /dev/null
@@ -1,5 +0,0 @@
-# This class ensures that the upstream version check only
-# accepts even minor versions (i.e. 3.0.x, 3.2.x, 3.4.x, etc.)
-# This scheme is used by Gnome and a number of other projects
-# to signify stable releases vs development releases.
-UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>\d+\.(\d*[02468])+(\.\d+)+)\.tar"
diff --git a/poky/meta/classes/useradd-staticids.bbclass b/poky/meta/classes/useradd-staticids.bbclass
index 3acf59c..abe484e 100644
--- a/poky/meta/classes/useradd-staticids.bbclass
+++ b/poky/meta/classes/useradd-staticids.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # In order to support a deterministic set of 'dynamic' users/groups,
 # we need a function to reformat the params based on a static file
 def update_useradd_static_config(d):
diff --git a/poky/meta/classes/useradd.bbclass b/poky/meta/classes/useradd.bbclass
index 20771a0..4d3bd9a 100644
--- a/poky/meta/classes/useradd.bbclass
+++ b/poky/meta/classes/useradd.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 inherit useradd_base
 
 # base-passwd-cross provides the default passwd and group files in the
diff --git a/poky/meta/classes/useradd_base.bbclass b/poky/meta/classes/useradd_base.bbclass
index 7f5b9b7..863cb7b 100644
--- a/poky/meta/classes/useradd_base.bbclass
+++ b/poky/meta/classes/useradd_base.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
 # This bbclass provides basic functionality for user/group settings.
 # This bbclass is intended to be inherited by useradd.bbclass and
 # extrausers.bbclass.
diff --git a/poky/meta/classes/utility-tasks.bbclass b/poky/meta/classes/utility-tasks.bbclass
deleted file mode 100644
index 0466325..0000000
--- a/poky/meta/classes/utility-tasks.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-addtask listtasks
-do_listtasks[nostamp] = "1"
-python do_listtasks() {
-    taskdescs = {}
-    maxlen = 0
-    for e in d.keys():
-        if d.getVarFlag(e, 'task'):
-            maxlen = max(maxlen, len(e))
-            if e.endswith('_setscene'):
-                desc = "%s (setscene version)" % (d.getVarFlag(e[:-9], 'doc') or '')
-            else:
-                desc = d.getVarFlag(e, 'doc') or ''
-            taskdescs[e] = desc
-
-    tasks = sorted(taskdescs.keys())
-    for taskname in tasks:
-        bb.plain("%s  %s" % (taskname.ljust(maxlen), taskdescs[taskname]))
-}
-
-CLEANFUNCS ?= ""
-
-T:task-clean = "${LOG_DIR}/cleanlogs/${PN}"
-addtask clean
-do_clean[nostamp] = "1"
-python do_clean() {
-    """clear the build and temp directories"""
-    dir = d.expand("${WORKDIR}")
-    bb.note("Removing " + dir)
-    oe.path.remove(dir)
-
-    dir = "%s.*" % d.getVar('STAMP')
-    bb.note("Removing " + dir)
-    oe.path.remove(dir)
-
-    for f in (d.getVar('CLEANFUNCS') or '').split():
-        bb.build.exec_func(f, d)
-}
-
-addtask checkuri
-do_checkuri[nostamp] = "1"
-do_checkuri[network] = "1"
-python do_checkuri() {
-    src_uri = (d.getVar('SRC_URI') or "").split()
-    if len(src_uri) == 0:
-        return
-
-    try:
-        fetcher = bb.fetch2.Fetch(src_uri, d)
-        fetcher.checkstatus()
-    except bb.fetch2.BBFetchException as e:
-        bb.fatal(str(e))
-}
-
-
diff --git a/poky/meta/classes/utils.bbclass b/poky/meta/classes/utils.bbclass
deleted file mode 100644
index e6f7f95..0000000
--- a/poky/meta/classes/utils.bbclass
+++ /dev/null
@@ -1,364 +0,0 @@
-
-oe_soinstall() {
-	# Purpose: Install shared library file and
-	#          create the necessary links
-	# Example: oe_soinstall libfoo.so.1.2.3 ${D}${libdir}
-	libname=`basename $1`
-	case "$libname" in
-	    *.so)
-	        bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3)"
-	        ;;
-	esac
-	install -m 755 $1 $2/$libname
-	sonamelink=`${HOST_PREFIX}readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
-	if [ -z $sonamelink ]; then
-		bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'."
-	fi
-	solink=`echo $libname | sed -e 's/\.so\..*/.so/'`
-	ln -sf $libname $2/$sonamelink
-	ln -sf $libname $2/$solink
-}
-
-oe_libinstall() {
-	# Purpose: Install a library, in all its forms
-	# Example
-	#
-	# oe_libinstall libltdl ${STAGING_LIBDIR}/
-	# oe_libinstall -C src/libblah libblah ${D}/${libdir}/
-	dir=""
-	libtool=""
-	silent=""
-	require_static=""
-	require_shared=""
-	while [ "$#" -gt 0 ]; do
-		case "$1" in
-		-C)
-			shift
-			dir="$1"
-			;;
-		-s)
-			silent=1
-			;;
-		-a)
-			require_static=1
-			;;
-		-so)
-			require_shared=1
-			;;
-		-*)
-			bbfatal "oe_libinstall: unknown option: $1"
-			;;
-		*)
-			break;
-			;;
-		esac
-		shift
-	done
-
-	libname="$1"
-	shift
-	destpath="$1"
-	if [ -z "$destpath" ]; then
-		bbfatal "oe_libinstall: no destination path specified"
-	fi
-
-	__runcmd () {
-		if [ -z "$silent" ]; then
-			echo >&2 "oe_libinstall: $*"
-		fi
-		$*
-	}
-
-	if [ -z "$dir" ]; then
-		dir=`pwd`
-	fi
-
-	dotlai=$libname.lai
-
-	# Sanity check that the libname.lai is unique
-	number_of_files=`(cd $dir; find . -name "$dotlai") | wc -l`
-	if [ $number_of_files -gt 1 ]; then
-		bbfatal "oe_libinstall: $dotlai is not unique in $dir"
-	fi
-
-
-	dir=$dir`(cd $dir;find . -name "$dotlai") | sed "s/^\.//;s/\/$dotlai\$//;q"`
-	olddir=`pwd`
-	__runcmd cd $dir
-
-	lafile=$libname.la
-
-	# If such file doesn't exist, try to cut version suffix
-	if [ ! -f "$lafile" ]; then
-		libname1=`echo "$libname" | sed 's/-[0-9.]*$//'`
-		lafile1=$libname.la
-		if [ -f "$lafile1" ]; then
-			libname=$libname1
-			lafile=$lafile1
-		fi
-	fi
-
-	if [ -f "$lafile" ]; then
-		# libtool archive
-		eval `cat $lafile|grep "^library_names="`
-		libtool=1
-	else
-		library_names="$libname.so* $libname.dll.a $libname.*.dylib"
-	fi
-
-	__runcmd install -d $destpath/
-	dota=$libname.a
-	if [ -f "$dota" -o -n "$require_static" ]; then
-		rm -f $destpath/$dota
-		__runcmd install -m 0644 $dota $destpath/
-	fi
-	if [ -f "$dotlai" -a -n "$libtool" ]; then
-		rm -f $destpath/$libname.la
-		__runcmd install -m 0644 $dotlai $destpath/$libname.la
-	fi
-
-	for name in $library_names; do
-		files=`eval echo $name`
-		for f in $files; do
-			if [ ! -e "$f" ]; then
-				if [ -n "$libtool" ]; then
-					bbfatal "oe_libinstall: $dir/$f not found."
-				fi
-			elif [ -L "$f" ]; then
-				__runcmd cp -P "$f" $destpath/
-			elif [ ! -L "$f" ]; then
-				libfile="$f"
-				rm -f $destpath/$libfile
-				__runcmd install -m 0755 $libfile $destpath/
-			fi
-		done
-	done
-
-	if [ -z "$libfile" ]; then
-		if  [ -n "$require_shared" ]; then
-			bbfatal "oe_libinstall: unable to locate shared library"
-		fi
-	elif [ -z "$libtool" ]; then
-		# special case hack for non-libtool .so.#.#.# links
-		baselibfile=`basename "$libfile"`
-		if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
-			sonamelink=`${HOST_PREFIX}readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
-			solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
-			if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
-				__runcmd ln -sf $baselibfile $destpath/$sonamelink
-			fi
-			__runcmd ln -sf $baselibfile $destpath/$solink
-		fi
-	fi
-
-	__runcmd cd "$olddir"
-}
-
-create_cmdline_wrapper () {
-	# Create a wrapper script where commandline options are needed
-	#
-	# These are useful to work around relocation issues, by passing extra options
-	# to a program
-	#
-	# Usage: create_cmdline_wrapper FILENAME <extra-options>
-
-	cmd=$1
-	shift
-
-	echo "Generating wrapper script for $cmd"
-
-	mv $cmd $cmd.real
-	cmdname=`basename $cmd`
-	dirname=`dirname $cmd`
-	cmdoptions=$@
-	if [ "${base_prefix}" != "" ]; then
-		relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
-		cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
-	fi
-	cat <<END >$cmd
-#!/bin/bash
-realpath=\`readlink -fn \$0\`
-realdir=\`dirname \$realpath\`
-exec -a \$realdir/$cmdname \$realdir/$cmdname.real $cmdoptions "\$@"
-END
-	chmod +x $cmd
-}
-
-create_cmdline_shebang_wrapper () {
-	# Create a wrapper script where commandline options are needed
-	#
-	# These are useful to work around shebang relocation issues, where shebangs are too
-	# long or have arguments in them, thus preventing them from using the /usr/bin/env
-	# shebang
-	#
-	# Usage: create_cmdline_wrapper FILENAME <extra-options>
-
-	cmd=$1
-	shift
-
-	echo "Generating wrapper script for $cmd"
-
-	# Strip #! and get remaining interpreter + arg
-	argument="$(sed -ne 's/^#! *//p;q' $cmd)"
-	# strip the shebang from the real script as we do not want it to be usable anyway
-	tail -n +2 $cmd > $cmd.real
-	chown --reference=$cmd $cmd.real
-	chmod --reference=$cmd $cmd.real
-	rm -f $cmd
-	cmdname=$(basename $cmd)
-	dirname=$(dirname $cmd)
-	cmdoptions=$@
-	if [ "${base_prefix}" != "" ]; then
-		relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
-		cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
-	fi
-	cat <<END >$cmd
-#!/usr/bin/env bash
-realpath=\`readlink -fn \$0\`
-realdir=\`dirname \$realpath\`
-exec -a \$realdir/$cmdname $argument \$realdir/$cmdname.real $cmdoptions "\$@"
-END
-	chmod +x $cmd
-}
-
-create_wrapper () {
-	# Create a wrapper script where extra environment variables are needed
-	#
-	# These are useful to work around relocation issues, by setting environment
-	# variables which point to paths in the filesystem.
-	#
-	# Usage: create_wrapper FILENAME [[VAR=VALUE]..]
-
-	cmd=$1
-	shift
-
-	echo "Generating wrapper script for $cmd"
-
-	mv $cmd $cmd.real
-	cmdname=`basename $cmd`
-	dirname=`dirname $cmd`
-	exportstring=$@
-	if [ "${base_prefix}" != "" ]; then
-		relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
-		exportstring=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
-	fi
-	cat <<END >$cmd
-#!/bin/bash
-realpath=\`readlink -fn \$0\`
-realdir=\`dirname \$realpath\`
-export $exportstring
-exec -a "\$0" \$realdir/$cmdname.real "\$@"
-END
-	chmod +x $cmd
-}
-
-# Copy files/directories from $1 to $2 but using hardlinks
-# (preserve symlinks)
-hardlinkdir () {
-	from=$1
-	to=$2
-	(cd $from; find . -print0 | cpio --null -pdlu $to)
-}
-
-
-def check_app_exists(app, d):
-    app = d.expand(app).split()[0].strip()
-    path = d.getVar('PATH')
-    return bool(bb.utils.which(path, app))
-
-def explode_deps(s):
-    return bb.utils.explode_deps(s)
-
-def base_set_filespath(path, d):
-    filespath = []
-    extrapaths = (d.getVar("FILESEXTRAPATHS") or "")
-    # Remove default flag which was used for checking
-    extrapaths = extrapaths.replace("__default:", "")
-    # Don't prepend empty strings to the path list
-    if extrapaths != "":
-        path = extrapaths.split(":") + path
-    # The ":" ensures we have an 'empty' override
-    overrides = (":" + (d.getVar("FILESOVERRIDES") or "")).split(":")
-    overrides.reverse()
-    for o in overrides:
-        for p in path:
-            if p != "":
-                filespath.append(os.path.join(p, o))
-    return ":".join(filespath)
-
-def extend_variants(d, var, extend, delim=':'):
-    """Return a string of all bb class extend variants for the given extend"""
-    variants = []
-    whole = d.getVar(var) or ""
-    for ext in whole.split():
-        eext = ext.split(delim)
-        if len(eext) > 1 and eext[0] == extend:
-            variants.append(eext[1])
-    return " ".join(variants)
-
-def multilib_pkg_extend(d, pkg):
-    variants = (d.getVar("MULTILIB_VARIANTS") or "").split()
-    if not variants:
-        return pkg
-    pkgs = pkg
-    for v in variants:
-        pkgs = pkgs + " " + v + "-" + pkg
-    return pkgs
-
-def get_multilib_datastore(variant, d):
-    return oe.utils.get_multilib_datastore(variant, d)
-
-def all_multilib_tune_values(d, var, unique = True, need_split = True, delim = ' '):
-    """Return a string of all ${var} in all multilib tune configuration"""
-    values = []
-    variants = (d.getVar("MULTILIB_VARIANTS") or "").split() + ['']
-    for item in variants:
-        localdata = get_multilib_datastore(item, d)
-        # We need WORKDIR to be consistent with the original datastore
-        localdata.setVar("WORKDIR", d.getVar("WORKDIR"))
-        value = localdata.getVar(var) or ""
-        if value != "":
-            if need_split:
-                for item in value.split(delim):
-                    values.append(item)
-            else:
-                values.append(value)
-    if unique:
-        #we do this to keep order as much as possible
-        ret = []
-        for value in values:
-            if not value in ret:
-                ret.append(value)
-    else:
-        ret = values
-    return " ".join(ret)
-
-def all_multilib_tune_list(vars, d):
-    """
-    Return a list of ${VAR} for each variable VAR in vars from each 
-    multilib tune configuration.
-    Is safe to be called from a multilib recipe/context as it can
-    figure out the original tune and remove the multilib overrides.
-    """
-    values = {}
-    for v in vars:
-        values[v] = []
-    values['ml'] = ['']
-
-    variants = (d.getVar("MULTILIB_VARIANTS") or "").split() + ['']
-    for item in variants:
-        localdata = get_multilib_datastore(item, d)
-        values[v].append(localdata.getVar(v))
-        values['ml'].append(item)
-    return values
-all_multilib_tune_list[vardepsexclude] = "OVERRIDES"
-
-# If the user hasn't set up their name/email, set some defaults
-check_git_config() {
-	if ! git config user.email > /dev/null ; then
-		git config --local user.email "${PATCH_GIT_USER_EMAIL}"
-	fi
-	if ! git config user.name > /dev/null ; then
-		git config --local user.name "${PATCH_GIT_USER_NAME}"
-	fi
-}
diff --git a/poky/meta/classes/vala.bbclass b/poky/meta/classes/vala.bbclass
deleted file mode 100644
index bfcceff..0000000
--- a/poky/meta/classes/vala.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-# Everyone needs vala-native and targets need vala, too,
-# because that is where target builds look for .vapi files.
-#
-VALADEPENDS = ""
-VALADEPENDS:class-target = "vala"
-DEPENDS:append = " vala-native ${VALADEPENDS}"
-
-# Our patched version of Vala looks in STAGING_DATADIR for .vapi files
-export STAGING_DATADIR
-# Upstream Vala >= 0.11 looks in XDG_DATA_DIRS for .vapi files
-export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}"
-
-# Package additional files
-FILES:${PN}-dev += "\
-    ${datadir}/vala/vapi/*.vapi \
-    ${datadir}/vala/vapi/*.deps \
-    ${datadir}/gir-1.0 \
-"
-
-# Remove vapigen.m4 that is bundled with tarballs
-# because it does not yet have our cross-compile fixes
-do_configure:prepend() {
-        rm -f ${S}/m4/vapigen.m4
-}
diff --git a/poky/meta/classes/waf.bbclass b/poky/meta/classes/waf.bbclass
deleted file mode 100644
index 464564a..0000000
--- a/poky/meta/classes/waf.bbclass
+++ /dev/null
@@ -1,75 +0,0 @@
-# avoids build breaks when using no-static-libs.inc
-DISABLE_STATIC = ""
-
-# What Python interpretter to use.  Defaults to Python 3 but can be
-# overridden if required.
-WAF_PYTHON ?= "python3"
-
-B = "${WORKDIR}/build"
-do_configure[cleandirs] += "${B}"
-
-EXTRA_OECONF:append = " ${PACKAGECONFIG_CONFARGS}"
-
-EXTRA_OEWAF_BUILD ??= ""
-# In most cases, you want to pass the same arguments to `waf build` and `waf
-# install`, but you can override it if necessary
-EXTRA_OEWAF_INSTALL ??= "${EXTRA_OEWAF_BUILD}"
-
-def waflock_hash(d):
-    # Calculates the hash used for the waf lock file. This should include
-    # all of the user controllable inputs passed to waf configure. Note
-    # that the full paths for ${B} and ${S} are used; this is OK and desired
-    # because a change to either of these should create a unique lock file
-    # to prevent collisions.
-    import hashlib
-    h = hashlib.sha512()
-    def update(name):
-        val = d.getVar(name)
-        if val is not None:
-            h.update(val.encode('utf-8'))
-    update('S')
-    update('B')
-    update('prefix')
-    update('EXTRA_OECONF')
-    return h.hexdigest()
-
-# Use WAFLOCK to specify a separate lock file. The build is already
-# sufficiently isolated by setting the output directory, this ensures that
-# bitbake won't step on toes of any other configured context in the source
-# directory (e.g. if the source is coming from externalsrc and was previously
-# configured elsewhere).
-export WAFLOCK = ".lock-waf_oe_${@waflock_hash(d)}_build"
-BB_BASEHASH_IGNORE_VARS += "WAFLOCK"
-
-python waf_preconfigure() {
-    import subprocess
-    subsrcdir = d.getVar('S')
-    python = d.getVar('WAF_PYTHON')
-    wafbin = os.path.join(subsrcdir, 'waf')
-    try:
-        result = subprocess.check_output([python, wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
-        version = result.decode('utf-8').split()[1]
-        if bb.utils.vercmp_string_op(version, "1.8.7", ">="):
-            d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
-    except subprocess.CalledProcessError as e:
-        bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % e.returncode)
-    except FileNotFoundError:
-        bb.fatal("waf does not exist in %s" % subsrcdir)
-}
-
-do_configure[prefuncs] += "waf_preconfigure"
-
-waf_do_configure() {
-	(cd ${S} && ${WAF_PYTHON} ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
-}
-
-do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+"
-waf_do_compile()  {
-	(cd ${S} && ${WAF_PYTHON} ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD})
-}
-
-waf_do_install() {
-	(cd ${S} && ${WAF_PYTHON} ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/xmlcatalog.bbclass b/poky/meta/classes/xmlcatalog.bbclass
deleted file mode 100644
index be155b7..0000000
--- a/poky/meta/classes/xmlcatalog.bbclass
+++ /dev/null
@@ -1,26 +0,0 @@
-DEPENDS = "libxml2-native"
-
-# A whitespace-separated list of XML catalogs to be registered, for example
-# "${sysconfdir}/xml/docbook-xml.xml".
-XMLCATALOGS ?= ""
-
-SYSROOT_PREPROCESS_FUNCS:append = " xmlcatalog_sstate_postinst"
-
-xmlcatalog_complete() {
-	ROOTCATALOG="${STAGING_ETCDIR_NATIVE}/xml/catalog"
-	if [ ! -f $ROOTCATALOG ]; then
-		mkdir --parents $(dirname $ROOTCATALOG)
-		xmlcatalog --noout --create $ROOTCATALOG
-	fi
-	for CATALOG in ${XMLCATALOGS}; do
-		xmlcatalog --noout --add nextCatalog unused file://$CATALOG $ROOTCATALOG
-	done
-}
-
-xmlcatalog_sstate_postinst() {
-	mkdir -p ${SYSROOT_DESTDIR}${bindir}
-	dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}-xmlcatalog
-	echo '#!/bin/sh' > $dest
-	echo '${xmlcatalog_complete}' >> $dest
-	chmod 0755 $dest
-}
diff --git a/poky/meta/classes/yocto-check-layer.bbclass b/poky/meta/classes/yocto-check-layer.bbclass
index 329d3f8..404f5fd 100644
--- a/poky/meta/classes/yocto-check-layer.bbclass
+++ b/poky/meta/classes/yocto-check-layer.bbclass
@@ -1,4 +1,10 @@
 #
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
 # This class is used by yocto-check-layer script for additional per-recipe tests
 # The first test ensures that the layer has no recipes skipping 'installed-vs-shipped' QA checks
 #
