[meta-virtualization] [PATCH 5/7] xen: GMP recipe for Xen stubdoms

Kurt Bodiker kurt.bodiker at braintrust-us.com
Mon Mar 5 07:35:05 PST 2018


From: kebodiker <kurt.bodiker at braintrust-us.com>

I didn't want to replicate a GMP recipe, but I couldn't figure out how
to append or extend the existing GMP recipe without messing up GMP for
the rest of the system.

GMP is a fast precision arithmetic library targeted for cryptographic
applications.  This GMP recipe creates a static library that is
cross-compiled against that is cross-compiled against MiniOS, Xen, LWIP,
Newlib, and PolarSSL headers and subsquently used during the
cross-compilation and linking of the TPM Emulator and the Xen vTPM and
vTPM Manager stubdomains.

The current Xen source code is hardcoded to fetch a specific version of
this package.  Xen does not currently apply any patches to this package.
This recipe provides the flexibility to change version or create patches
if necessary.

Signed-off-by: Kurt Bodiker <kurt.bodiker at braintrust-us.com>
---
 recipes-extended/xen/stubdom-gmp.inc      | 36 +++++++++++++++++++++++++++++++
 recipes-extended/xen/stubdom-gmp_4.3.2.bb | 20 +++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 recipes-extended/xen/stubdom-gmp.inc
 create mode 100644 recipes-extended/xen/stubdom-gmp_4.3.2.bb

diff --git a/recipes-extended/xen/stubdom-gmp.inc b/recipes-extended/xen/stubdom-gmp.inc
new file mode 100644
index 0000000..c4dd3f8
--- /dev/null
+++ b/recipes-extended/xen/stubdom-gmp.inc
@@ -0,0 +1,36 @@
+# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker at braintrust-us.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+DEPENDS += "\
+    newlib \
+"
+
+# set ABI for x86_32 builds. Ripped from Xen/stubdom/Makefile.
+GMPEXT=""
+GMPEXT_gnutargetarch-i686 = "ABI=32"
+
+do_configure() {
+    # need to modify prefix here otherwise OE-level variables (prefix, libdir, includedir) defined in stubdom.inc get messed up
+    CPPFLAGS="-isystem ${STAGING_DIR_HOST}/cross-root-${XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include ${STUBDOM_CPPFLAGS}" CFLAGS="${STUBDOM_CFLAGS}" CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${GMPEXT}" ${S}/configure \
+        --disable-shared \
+        --enable-static \
+        --disable-fft \
+        --without-readline \
+        --prefix=${prefix}/${GNU_TARGET_ARCH}-xen-elf \
+        --libdir=${libdir} \
+        --build=`$(CC) -dumpmachine` \
+        --host=${GNU_TARGET_ARCH}-xen-elf
+
+    sed -i 's/#define HAVE_OBSTACK_VPRINTF 1/\/\/#define HAVE_OBSTACK_VPRINTF 1/' ${S}/config.h
+}
+    
+do_compile() {
+    ${MAKE}
+}
+
+do_install() {
+    ${MAKE} DESTDIR=${D} install
+    rm -rf ${D}${prefix}/${GNU_TARGET_ARCH}-xen-elf/share
+}
diff --git a/recipes-extended/xen/stubdom-gmp_4.3.2.bb b/recipes-extended/xen/stubdom-gmp_4.3.2.bb
new file mode 100644
index 0000000..bac3415
--- /dev/null
+++ b/recipes-extended/xen/stubdom-gmp_4.3.2.bb
@@ -0,0 +1,20 @@
+# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker at braintrust-us.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "GMP library for Xen vTPM's."
+HOMEPAGE = "http://gmp"
+LICENSE = "GPLv3"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
+
+PROVIDES = "stubdom-gmp"
+RPROVIDES_${PN} = "stubdom-gmp"
+SRC_URI += "\
+    https://gmplib.org/download/gmp/archive/gmp-${PV}.tar.bz2 \
+"
+SRC_URI[md5sum] = "dd60683d7057917e34630b4a787932e8"
+SRC_URI[sha256sum] = "936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775"
+
+S="${WORKDIR}/gmp-${PV}"
+B="${S}"
+
+require stubdom-gmp.inc
-- 
2.14.2


-- 

*This email and all attachments are considered confidential and the 
proprietary information of BrainTrust Holdings.  Unauthorized disclosure is 
prohibited.  *


More information about the meta-virtualization mailing list