[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] firmware: don't build hvmloader if it is not needed



On Thu, 18 Feb 2021, Jan Beulich wrote:
> On 18.02.2021 00:45, Stefano Stabellini wrote:
> > Given this, I take there is no 32bit build env? A bit of Googling tells
> > me that gcc on Alpine Linux is compiled without multilib support.
> > 
> > 
> > That said I was looking at the Alpine Linux APKBUILD script:
> > https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/xen/APKBUILD
> > 
> > And I noticed this patch that looks suspicious:
> > https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/xen/musl-hvmloader-fix-stdint.patch
> 
> Indeed. I find it very odd that they have a bimodal gcc (allowing
> -m32) but no suitable further infrastructure (headers). So perhaps
> configure should probe for "gcc -m32" producing a uint64_t that is
> actually 64 bits wide, and disable hvmloader building otherwise
> (and - important - no matter whether it would actually be needed;
> alternative being to fail configuring altogether)? Until - as said
> before - we've made hvmloader properly freestanding.

OK it took me a lot longer than expected (I have never had the dubious
pleasure of working with autoconf before) but the following seems to
work, tested on both Alpine Linux and Debian Unstable. Of course I had
to run autoreconf first.


diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 48bd9ab731..d5e4f1679f 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -50,6 +50,7 @@ CONFIG_OVMF         := @ovmf@
 CONFIG_ROMBIOS      := @rombios@
 CONFIG_SEABIOS      := @seabios@
 CONFIG_IPXE         := @ipxe@
+CONFIG_HVMLOADER    := @hvmloader@
 CONFIG_QEMU_TRAD    := @qemu_traditional@
 CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@
diff --git a/tools/Makefile b/tools/Makefile
index 757a560be0..6cff5766f3 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -14,7 +14,7 @@ SUBDIRS-y += examples
 SUBDIRS-y += hotplug
 SUBDIRS-y += xentrace
 SUBDIRS-$(CONFIG_XCUTILS) += xcutils
-SUBDIRS-$(CONFIG_X86) += firmware
+SUBDIRS-$(CONFIG_HVMLOADER) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
 SUBDIRS-y += xentop
diff --git a/tools/configure.ac b/tools/configure.ac
index 6b611deb13..a3a52cec41 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -307,6 +307,10 @@ AC_ARG_VAR([AWK], [Path to awk tool])
 
 # Checks for programs.
 AC_PROG_CC
+AC_LANG(C)
+AC_LANG_CONFTEST([AC_LANG_SOURCE([[int main() { return 0;}]])])
+AS_IF([gcc -m32 conftest.c -o - 2>/dev/null], [hvmloader=y], 
[AC_MSG_WARN(hvmloader build disabled as the compiler cannot build 32bit 
binaries)])
+AC_SUBST(hvmloader)
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AC_PATH_PROG([FLEX], [flex])



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.