From ea94bfc3441cb33b17f4eeac06ff23d450465baf Mon Sep 17 00:00:00 2001 From: Christopher Clark Date: Tue, 25 Feb 2020 16:16:01 -0800 Subject: xen, xen-tools: remove stubs task and use multilib when necessary The stubs task was MACHINE-specific due to the OE variables it accessed which had forced unnecessary rebuild work in OpenXT's multi-MACHINE builds. The stubs task was generating a 32-bit header file to satisfy the Xen tools firmware build to generate the hvmloader binary, which is only needed on x86-64 targets where HVM-mode guests are enabled. Remove this header file generation logic and similar in the configure task, and in the cases where hvmloader is to be built use multilib to provide a 32-bit sysroot and allow the build to obtain the needed 32-bit materials from their source: glibc. Building Xen tools for x86-64 with HVM-guest support enabled now requires the following to be added to a build conf file (eg. distro.conf, or local.conf) : require conf/multilib.conf MULTILIBS = "multilib:lib32" DEFAULTTUNE_virtclass-multilib-lib32 = "x86" Signed-off-by: Christopher Clark Signed-off-by: Bruce Ashfield --- recipes-extended/xen/xen-tools.inc | 48 +++++++++++++++++++++++++++----------- recipes-extended/xen/xen.inc | 4 ---- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc index 00843ca5..864c40cd 100644 --- a/recipes-extended/xen/xen-tools.inc +++ b/recipes-extended/xen/xen-tools.inc @@ -6,6 +6,29 @@ COMPATIBLE_HOST = 'i686-oe-linux|(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux inherit setuptools3 update-rc.d systemd deploy require xen-blktap.inc +# To build hvmloader, which is needed on x86-64 targets when 'hvm' is enabled +# in PACKAGECONFIG, to support running HVM-mode guest VMs, some files from +# 32-bit glibc are needed. +# Add the multilib 32-bit glibc to DEPENDS only when necessary. +# +# To enable multilib, please add the following to your local.conf -: +# +# require conf/multilib.conf +# MULTILIBS = "multilib:lib32" +# DEFAULTTUNE_virtclass-multilib-lib32 = "x86" + +# Use this multilib prefix for x86 32-bit to match local.conf: +MLPREFIX32 = "lib32-" + +# The DEPENDS on a multilib 32-bit glibc is only added when target is x86-64 +# and 'hvm' is enabled in PACKAGECONFIG. +# This x86-64 override is never intended for native use, so clear that. +GLIBC32 = "" +GLIBC32_x86-64 = \ + "${@bb.utils.contains('PACKAGECONFIG', 'hvm', '${MLPREFIX32}glibc', '', d)}" +GLIBC32_class-native = "" +DEPENDS += "${GLIBC32}" + RDEPENDS_${PN} = "\ bash perl xz \ ${PN}-console \ @@ -656,25 +679,24 @@ SYSTEMD_SERVICE_${PN}-xencommons = " \ " SYSTEMD_SERVICE_${PN}-xendomains = "xendomains.service" +# To build hvmloader, which is needed on x86-64 targets when 'hvm' is enabled +# in PACKAGECONFIG, additional CFLAGS are needed to set the 32-bit sysroot. +RECIPE_SYSROOT32 = "${WORKDIR}/${MLPREFIX32}recipe-sysroot" +ADD_SYSROOT32_CFLAGS = "" +ADD_SYSROOT32_CFLAGS_x86-64 = \ + "${@bb.utils.contains('PACKAGECONFIG', 'hvm', \ + 'CFLAGS += "--sysroot=${RECIPE_SYSROOT32}"', '', d)}" +# This x86-64 override is never intended for native use, so clear that. +ADD_SYSROOT32_CFLAGS_class-native = "" + do_configure() { do_configure_common -} -do_stubs() { - # no stubs-32.h in our 64-bit sysroot - hack it into tools/include/gnu - if ! test -f ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-32.h ; then - if test -f ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-64.h ; then - test -d ${S}/tools/include/gnu || mkdir ${S}/tools/include/gnu - cat ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-64.h | grep -v stub_bdflush | grep -v stub_getmsg | grep -v stub_putmsg > ${S}/tools/include/gnu/stubs-32.h - echo \#define __stub___kernel_cosl >> ${S}/tools/include/gnu/stubs-32.h - echo \#define __stub___kernel_sinl >> ${S}/tools/include/gnu/stubs-32.h - echo \#define __stub___kernel_tanl >> ${S}/tools/include/gnu/stubs-32.h - fi + if [ -n '${ADD_SYSROOT32_CFLAGS}' ] ; then + echo '${ADD_SYSROOT32_CFLAGS}' >>"${S}/tools/firmware/Rules.mk" fi } -addtask stubs after do_configure before do_compile - do_compile() { cd ${S} oe_runmake tools PYTHON="${PYTHON}" diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc index 1ac131ed..32e836a9 100644 --- a/recipes-extended/xen/xen.inc +++ b/recipes-extended/xen/xen.inc @@ -223,10 +223,6 @@ do_configure_common() { oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \ EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" \ PYTHON="${PYTHON}" - - if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then - cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h - fi } do_compile_prepend() { -- cgit v1.2.3-54-g00ecf