@@ -63,8 +63,6 @@ python () {
d.appendVarFlag("emit_pkgdata", "vardepsexclude", " MULTILIB_VARIANTS")
d.appendVarFlag("write_specfile", "vardepsexclude", " MULTILIBS")
d.appendVarFlag("do_package", "vardepsexclude", " package_do_shlibs")
-
- d.setVar("qemu_wrapper_cmdline", "def qemu_wrapper_cmdline(data, rootfs_path, library_paths):\n return 'false'")
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"))
}
@@ -14,7 +14,7 @@
# with this use case in mind this works very nicely also out of an IDE
# configured to use cmake-native for cross compiling.
-inherit qemu cmake
+inherit cmake
DEPENDS:append:class-target = "${@' qemu-native' if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) else ''}"
@@ -22,7 +22,7 @@ cmake_do_generate_toolchain_file:append:class-target() {
if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
# Write out a qemu wrapper that will be used as exe_wrapper so that cmake
# can run target helper binaries through that. This also allows to execute ctest.
- qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}"
+ qemu_binary="${@oe.qemu.qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}"
echo "#!/bin/sh" > "${WORKDIR}/cmake-qemuwrapper"
echo "$qemu_binary \"\$@\"" >> "${WORKDIR}/cmake-qemuwrapper"
chmod +x "${WORKDIR}/cmake-qemuwrapper"
@@ -35,14 +35,14 @@ DEPENDS:append = " gtk-doc-native"
export STAGING_DIR_HOST
-inherit python3native pkgconfig qemu
+inherit python3native pkgconfig
DEPENDS:append = "${@' qemu-native' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
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}'])}"
+ qemu_binary="${@oe.qemu.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
@@ -94,8 +94,6 @@ do_collect_bins_from_locale_tree() {
cross-localedef-hardlink -c -v ${WORKDIR}/locale-tree
}
-inherit qemu
-
python package_do_split_gconvs () {
import re
if (d.getVar('PACKAGE_NO_GCONV') == '1'):
@@ -284,7 +282,7 @@ python package_do_split_gconvs () {
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)
+ qemu = oe.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)
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: MIT
#
-inherit python3native meson-routines qemu
+inherit python3native meson-routines
DEPENDS:append = " meson-native ninja-native"
@@ -132,7 +132,7 @@ EOF
write_qemuwrapper() {
# 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}'])}"
+ qemu_binary="${@oe.qemu.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
@@ -9,56 +9,17 @@
# 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"
+python () {
+ funcs = ["qemu_target_binary", "qemu_wrapper_cmdline", "qemu_run_binary"]
+ bb.warn("qemu.bbclass has been deprecated, please remove 'inherit qemu' and replace function invocation:\n\t%s" %
+ '\n\t'.join(["{0} -> oe.qemu.{0}".format(f) for f in funcs]))
+}
- return "qemu-" + target_arch
+def qemu_target_binary(data):
+ return oe.qemu.qemu_target_binary(data)
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") or ""
-
- return "PSEUDO_UNLOAD=1 " + qemu_binary + " " + qemu_options + " -L " + rootfs_path\
- + " -E LD_LIBRARY_PATH=" + ":".join(library_paths) + " "
+ return oe.qemu.qemu_wrapper_cmdline(data, rootfs_path, 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:tune-%s" % d.getVar('TUNE_PKGARCH')) or ""}"
-QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS:tune-${TUNE_PKGARCH}"
+ return oe.qemu.qemu_run_binary(data, rootfs_path, binary)
@@ -896,6 +896,15 @@ ZSTD_DEFAULTS[vardepsexclude] = "ZSTD_THREADS"
# may fallback to using all CPUs
export OMP_NUM_THREADS = "${BB_NUMBER_THREADS}"
+# 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:tune-%s" % d.getVar('TUNE_PKGARCH')) or ""}"
+QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS:tune-${TUNE_PKGARCH}"
+
##################################################################
# Magic Cookie for SANITY CHECK
##################################################################
@@ -10,5 +10,5 @@ __path__ = extend_path(__path__, __name__)
# Modules with vistorcode need to go first else anything depending on them won't be
# processed correctly (e.g. qa)
BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \
- "packagegroup", "sstatesig", "lsb", "cachedpath", "license", \
+ "packagegroup", "sstatesig", "lsb", "cachedpath", "license", "qemu", \
"reproducible", "rust", "buildcfg", "go", "spdx30_tasks", "spdx_common"]
new file mode 100644
@@ -0,0 +1,54 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+
+def qemu_target_binary(d):
+ package_arch = d.getVar("PACKAGE_ARCH")
+ qemu_target_binary = (d.getVar("QEMU_TARGET_BINARY_%s" % package_arch) or "")
+ if qemu_target_binary:
+ return qemu_target_binary
+
+ target_arch = d.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(d, rootfs_path, library_paths, qemu_options=None):
+ import string
+
+ package_arch = d.getVar("PACKAGE_ARCH")
+ if package_arch == "all":
+ return "false"
+
+ qemu_binary = qemu_target_binary(d)
+ if qemu_binary == "qemu-allarch":
+ qemu_binary = "qemuwrapper"
+
+ if qemu_options == None:
+ qemu_options = d.getVar("QEMU_OPTIONS") or ""
+
+ 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(d, rootfs_path, binary):
+ libdir = rootfs_path + d.getVar("libdir", False)
+ base_libdir = rootfs_path + d.getVar("base_libdir", False)
+
+ return qemu_wrapper_cmdline(d, rootfs_path, [libdir, base_libdir]) + rootfs_path + binary
@@ -1,8 +1,6 @@
require glibc_${PV}.bb
require glibc-tests.inc
-inherit qemu
-
SRC_URI += "file://check-test-wrapper"
# strip provides
@@ -22,7 +20,7 @@ do_check:append () {
oe_runmake -i \
QEMU_SYSROOT="${RECIPE_SYSROOT}" \
- QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \
+ QEMU_OPTIONS="${@oe.qemu.qemu_target_binary(d)} ${QEMU_OPTIONS}" \
SSH_HOST="${TOOLCHAIN_TEST_HOST}" \
SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \
SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \
@@ -1,5 +1,3 @@
-inherit qemu
-
TOOLCHAIN_TEST_TARGET ??= "user"
TOOLCHAIN_TEST_HOST ??= "localhost"
TOOLCHAIN_TEST_HOST_USER ??= "root"
@@ -41,7 +39,7 @@ python check_prepare() {
content.append('process_multilib_options ""')
# qemu args
- qemu_binary = qemu_target_binary(d)
+ qemu_binary = oe.qemu.qemu_target_binary(d)
if not qemu_binary:
bb.fatal("Missing target qemu linux-user binary")
@@ -57,7 +57,7 @@ S = "${WORKDIR}/Python-${PV}"
BBCLASSEXTEND = "native nativesdk"
-inherit autotools pkgconfig qemu ptest multilib_header update-alternatives
+inherit autotools pkgconfig ptest multilib_header update-alternatives
MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
@@ -168,7 +168,7 @@ write_pgo_wrapper() {
cat >pgo-wrapper <<EOF
#!/bin/sh
cd ${B}
-${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])} "\$@"
+${@oe.qemu.qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])} "\$@"
EOF
chmod +x pgo-wrapper
fi
@@ -7,14 +7,12 @@ UNPACKDIR = "${S}"
DEPENDS += "qemu-native"
-inherit qemu
-
do_populate_sysroot[depends] = ""
do_install () {
install -d ${D}${bindir_crossscripts}/
- qemu_binary=${@qemu_target_binary(d)}
+ qemu_binary=${@oe.qemu.qemu_target_binary(d)}
qemu_options='${QEMU_OPTIONS} -E LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir}'
cat >> ${D}${bindir_crossscripts}/${MLPREFIX}qemuwrapper << EOF
@@ -20,7 +20,7 @@ SRC_URI[sha256sum] = "945b57da7ec262e5c266b89e091d14be800cc424277d82a02872b7d794
SRC_URI:append:class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch"
-inherit meson pkgconfig gtk-doc python3targetconfig qemu gobject-introspection-data upstream-version-is-even multilib_script
+inherit meson pkgconfig gtk-doc python3targetconfig gobject-introspection-data upstream-version-is-even multilib_script
GTKDOC_MESON_OPTION = "gtk_doc"
@@ -64,7 +64,7 @@ do_configure:prepend:class-native() {
do_configure:prepend:class-target() {
# Write out a qemu wrapper that will be given to gi-scanner so that it
# can run target helper binaries through that.
- qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
+ qemu_binary="${@oe.qemu.qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
cat > ${B}/g-ir-scanner-qemuwrapper << EOF
#!/bin/sh
# Use a modules directory which doesn't exist so we don't load random things