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 <christopher.clark6@baesystems.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Christopher Clark 2020-02-25 16:16:01 -08:00 committed by Bruce Ashfield
parent a0964e2044
commit ea94bfc344
2 changed files with 35 additions and 17 deletions

View File

@ -6,6 +6,29 @@ COMPATIBLE_HOST = 'i686-oe-linux|(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux
inherit setuptools3 update-rc.d systemd deploy inherit setuptools3 update-rc.d systemd deploy
require xen-blktap.inc 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} = "\ RDEPENDS_${PN} = "\
bash perl xz \ bash perl xz \
${PN}-console \ ${PN}-console \
@ -656,25 +679,24 @@ SYSTEMD_SERVICE_${PN}-xencommons = " \
" "
SYSTEMD_SERVICE_${PN}-xendomains = "xendomains.service" 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() {
do_configure_common do_configure_common
}
do_stubs() { if [ -n '${ADD_SYSROOT32_CFLAGS}' ] ; then
# no stubs-32.h in our 64-bit sysroot - hack it into tools/include/gnu echo '${ADD_SYSROOT32_CFLAGS}' >>"${S}/tools/firmware/Rules.mk"
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
fi fi
} }
addtask stubs after do_configure before do_compile
do_compile() { do_compile() {
cd ${S} cd ${S}
oe_runmake tools PYTHON="${PYTHON}" oe_runmake tools PYTHON="${PYTHON}"

View File

@ -223,10 +223,6 @@ do_configure_common() {
oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \ oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \
EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" \ EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" \
PYTHON="${PYTHON}" 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() { do_compile_prepend() {