Skip to contentSkip to conversation

Xen vTPM stubdomains

PATCH Superseded Kurt Bodiker 5 participants 19 messages Mar 5, 2018 – Mar 22, 2018

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Xen vTPM stubdomains

This patchset introduces the basic recipes necessary to build Xen stubdomains, in particular the vTPM and vTPM Manager stubdomains. vTPM stubdomains provide Xen guest domains access to a virtualized TPM. The vTPM Manager stubdomain manages each of the vTPM domains and seals them to the physical TPM. The intention of this patchset is to provide the ability to build Xen stubdomains separately from the rest of the Xen components since the stubdomains have separate dependencies that are hard-coded within the Xen build and configuration files. Separating the stubdomain recipes and dependencies from the rest of the Xen build gives the ability to use newer or different libraries than what is currently used.

The stubdom.inc file defines a set of CPPFLAGS, CFLAGS, and LDFLAGS common for building all Xen stubdomains. Xen stubdomains are cross-compiled with the MiniOS, which creates some issues when trying to compile stubdomains in an OpenEmbedded environment. To address these issues and to ensure the stubdoms are built as Xen had intended, all of the build flags and build tools that are exported into the environment by OE have been unset. Each of the new recipes introduced here then implements the build flags and the tools as though the build had been run in the bare-metal environment.

Xen vTPM stubdomains have depencencies on static libraries for newlib, polarssl, gmp, and tpm emulator. Xen vTPM Manager stubdomain has dependencies on static libraries for newlib and polarssl.

The newlib, polarssl, gmp, and tpm emulator recipes are constructed to behave the same as a bare-metal build. These recipes are cross-compiled against both the Xen and MiniOS source code.

The xen-vtpm recipe is responsible for building and installing the vTPM and vTPM Manager stubdomain images into the Xen boot directory. xen-vtpm would need to be added to DISTRO_FEATURES the similar for what is done for Xen.

kebodiker (7):
xen: Define the standard values needed for stubdoms
xen: LWIP source code with patches applied for stubdoms
xen: Newlib recipe and patches for Xen stubdoms
xen: PolarSSL recipe and patches for Xen stubdoms
xen: GMP recipe for Xen stubdoms
xen: TPM Emulator for Xen stubdoms
xen: vTPM and vTPM Manager stubdoms for Xen

 .../lwip.dhcp_create_request-hwaddr_len.patch      |   13 +
 recipes-extended/xen/files/lwip.patch-cvs          | 2398 ++++++++++++++++++++
 recipes-extended/xen/files/newlib-chk.patch        |  155 ++
 .../newlib-stdint-size_max-fix-from-1.17.0.patch   |   16 +
 recipes-extended/xen/files/newlib.patch            |  727 ++++++
 recipes-extended/xen/files/polarssl.patch          |   64 +
 recipes-extended/xen/files/tpmemu-0.7.4.patch      |   12 +
 recipes-extended/xen/files/vtpm-bufsize.patch      |   13 +
 recipes-extended/xen/files/vtpm-cmake-Wextra.patch |   21 +
 .../xen/files/vtpm-deepquote-anyloc.patch          |  127 ++
 recipes-extended/xen/files/vtpm-deepquote.patch    |  187 ++
 .../xen/files/vtpm-implicit-fallthrough.patch      |   10 +
 recipes-extended/xen/files/vtpm-locality.patch     |   50 +
 .../xen/files/vtpm-parent-sign-ek.patch            |  196 ++
 recipes-extended/xen/lwip.inc                      |   22 +
 recipes-extended/xen/lwip_1.3.0.bb                 |   22 +
 recipes-extended/xen/newlib.inc                    |   64 +
 recipes-extended/xen/newlib_1.16.0.bb              |   19 +
 recipes-extended/xen/polarssl.inc                  |   25 +
 recipes-extended/xen/polarssl_1.1.4.bb             |   17 +
 recipes-extended/xen/stubdom-gmp.inc               |   36 +
 recipes-extended/xen/stubdom-gmp_4.3.2.bb          |   20 +
 recipes-extended/xen/stubdom.inc                   |  141 ++
 recipes-extended/xen/tpm-emulator.inc              |   31 +
 recipes-extended/xen/tpm-emulator_0.7.4.bb         |   26 +
 recipes-extended/xen/xen-vtpm.inc                  |   97 +
 recipes-extended/xen/xen-vtpm_1.0.bb               |   16 +
 27 files changed, 4525 insertions(+)
 create mode 100644 recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch
 create mode 100644 recipes-extended/xen/files/lwip.patch-cvs
 create mode 100644 recipes-extended/xen/files/newlib-chk.patch
 create mode 100644 recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch
 create mode 100644 recipes-extended/xen/files/newlib.patch
 create mode 100644 recipes-extended/xen/files/polarssl.patch
 create mode 100644 recipes-extended/xen/files/tpmemu-0.7.4.patch
 create mode 100644 recipes-extended/xen/files/vtpm-bufsize.patch
 create mode 100644 recipes-extended/xen/files/vtpm-cmake-Wextra.patch
 create mode 100644 recipes-extended/xen/files/vtpm-deepquote-anyloc.patch
 create mode 100644 recipes-extended/xen/files/vtpm-deepquote.patch
 create mode 100644 recipes-extended/xen/files/vtpm-implicit-fallthrough.patch
 create mode 100644 recipes-extended/xen/files/vtpm-locality.patch
 create mode 100644 recipes-extended/xen/files/vtpm-parent-sign-ek.patch
 create mode 100644 recipes-extended/xen/lwip.inc
 create mode 100644 recipes-extended/xen/lwip_1.3.0.bb
 create mode 100644 recipes-extended/xen/newlib.inc
 create mode 100644 recipes-extended/xen/newlib_1.16.0.bb
 create mode 100644 recipes-extended/xen/polarssl.inc
 create mode 100644 recipes-extended/xen/polarssl_1.1.4.bb
 create mode 100644 recipes-extended/xen/stubdom-gmp.inc
 create mode 100644 recipes-extended/xen/stubdom-gmp_4.3.2.bb
 create mode 100644 recipes-extended/xen/stubdom.inc
 create mode 100644 recipes-extended/xen/tpm-emulator.inc
 create mode 100644 recipes-extended/xen/tpm-emulator_0.7.4.bb
 create mode 100644 recipes-extended/xen/xen-vtpm.inc
 create mode 100644 recipes-extended/xen/xen-vtpm_1.0.bb
Signature · 8 lines
2.14.2


-- 

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

PATCH 1/7 xen: Define the standard values needed for stubdoms

From: kebodiker <[email protected]>

This commit introduces the stubdom.inc file that is required for each recipe that is/will be built for Xen stubdomains. This file defines the standard values to be used such as common dependencies, the version of Xen that is being built by the separate Xen recipe, and unsets every flag and build tool that is exported into the OE environment.

Xen stubdomains are cross-compiled with the MiniOS, which creates some issues when trying to compile stubdomains in an OpenEmbedded environment. To address these issues and to ensure the stubdoms are built as Xen had intended, all of the build flags and build tools that are exported into the environment by OE have been unset. Each of the new recipes introduced here then implements the build flags and the tools as though the build had been run in the bare-metal environment.

---
 recipes-extended/xen/stubdom.inc | 141 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)
 create mode 100644 recipes-extended/xen/stubdom.inc
recipes-extended/xen/stubdom.inc new file +141 -0
new file mode 100644
index 0000000..4bc556d
@@ -0,0 +1,141 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require xen-arch.inc
+
+# Don't want to use the default tools and dependencies from OE
+# and many of these recipes build static instead of shared libraries
+INHIBIT_DEFAULT_DEPS = "1"
+INHIBIT_PACKAGE_STRIP = "0"
+EXCLUDE_FROM_SHLIBS = "1"
+
+# Couldn't find any other way to access the version of Xen used as a dependency. 
+# This version number needs changed to match version of Xen recipe  used in builds.
+XEN_VERSION = "4.9.0"
+
+
+# convenience variable that may or may not be needed for each recipe
+TRANSLATED_PV = "${@d.getVar('PV').replace('.', '_')}"
+
+# mini-os source code for everyone
+SRC_URI += "\
+    git://xenbits.xen.org/mini-os.git;protocol=git;rev=xen-RELEASE-${XEN_VERSION};nobranch=1;destsuffix=mini-os;name=mini-os \
+"
+
+# base set of dependencies
+DEPENDS += "\
+    xen \
+    lwip \
+    virtual/${TARGET_PREFIX}gcc \
+"
+
+
+export XEN_TARGET_ARCH="${@map_xen_arch(d.getVar('TARGET_ARCH'), d)}"
+export XEN_COMPILE_ARCH="${@map_xen_arch(d.getVar('BUILD_ARCH'), d)}"
+
+# Not sure if we need to (or even can) support 32-bit stubdoms
+# If we we do not need to support the 32-bit environment, then this section and the 
+# export statement afterwards can be removed. 
+python () {
+    gnu_dict = {
+            'x86_32': 'i686',
+            'x86_64': 'x86_64',
+        }
+        
+    if d.expand('${XEN_TARGET_ARCH}') == 'x86_32':
+        d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')])
+        d.setVar("PACKAGE_ARCH","core2-32")
+    elif d.expand('${XEN_TARGET_ARCH}') == 'x86_64':
+        d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')])
+}
+export GNU_TARGET_ARCH
+
+# Base set of CPPFLAGS, CFLAGS needed for each component used to build MiniOS-based stubdoms
+# LDFLAGS are only used when building stubdoms, so only used in stubdom recipes
+# Generic name given because each library uses DEF_, BUILD_, TARGET_, and xxxFLAGS differently
+STUBDOM_CPPFLAGS += "-isystem ${WORKDIR}/mini-os/include"
+STUBDOM_CPPFLAGS += "-D__MINIOS__ -DHAVE_LIBC"
+STUBDOM_CPPFLAGS += "-isystem ${WORKDIR}/mini-os/include/posix"
+STUBDOM_CPPFLAGS += "-isystem ${RECIPE_SYSROOT}/usr/include/xenstore-compat"
+STUBDOM_CPPFLAGS += "-isystem ${WORKDIR}/mini-os/include/x86 -isystem ${WORKDIR}/mini-os/include/x86/${XEN_TARGET_ARCH}"
+STUBDOM_CPPFLAGS += "-U __linux__ -U __FreeBSD__ -U __sun__"
+STUBDOM_CPPFLAGS += "-nostdinc"
+CPPFLAGS_INCLUDE_DIR = "-isystem ${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include"
+STUBDOM_CPPFLAGS += "${CPPFLAGS_INCLUDE_DIR}"
+STUBDOM_CPPFLAGS += "-isystem ${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/lwip/include -isystem ${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/lwip/include/ipv4"
+STUBDOM_CPPFLAGS += "-isystem ${RECIPE_SYSROOT}/usr/include/xen"
+
+STUBDOM_CFLAGS += "-mno-red-zone -O1 -fno-omit-frame-pointer -m64 -fno-reorder-blocks -fno-asynchronous-unwind-tables -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -fno-stack-protector -fno-exceptions"
+
+STUBDOM_LDFLAGS = "-nostdlib -L${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/lib"
+
+# unset EVERYTHING from the OE environment. Weird things happen when these are exported into the environment.
+unset CFLAGS
+unset BUILD_CFLAGS
+unset TARGET_CFLAGS
+unset CFLAGS_FOR_BUILD
+
+unset CPPFLAGS
+unset BUILD_CPPFLAGS
+unset TARGET_CPPFLAGS
+unset CPPFLAGS_FOR_BUILD
+
+unset LDFLAGS
+unset BUILD_LDFLAGS
+unset TARGET_LDFLAGS
+unset LDFLAGS_FOR_BUILD
+
+unset CXXFLAGS
+unset TARGET_CXXFLAGS
+unset BUILD_CXXFLAGS
+unset CXXFLAGS_FOR_BUILD
+
+unset BUILD_CC
+unset BUILD_CPP
+unset BUILD_CXX
+unset BUILD_LD
+unset BUILD_AR
+unset BUILD_AS
+unset BUILD_CCLD
+unset BUILD_FC
+unset BUILD_RANLIB
+unset BUILD_NM
+unset BUILD_STRIP
+unset BUILD_READELF
+unset BUILD_OBJCOPY
+unset BUILD_OBJDUMP
+unset CC
+unset CPP
+unset CXX
+unset LD
+unset AR
+unset AS
+unset NM
+unset RANLIB
+unset STRIP
+unset STRINGS
+unset READELF
+unset OBJCOPY
+unset OBJDUMP
+unset READELF
+unset CCLD
+unset FC
+
+# Need to redefine these for stubdom-related builds. It all starts because of the prefix newlib 
+# and then continues because we don't want to cross-contaminate stubdom-related recipes with 
+# headers and libraries in the OE-defined locations
+export prefix="/cross-root-${XEN_TARGET_ARCH}"
+export includedir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/include"
+export libdir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/lib"
+export libexecdir="${libdir}"
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+# These values need defined to trigger some values in the Makefiles
+export debug="y"
+export stubdom="y"
+export XEN_OS="MiniOS"
+
+do_configure_prepend() {
+    ${MAKE} -C ${WORKDIR}/mini-os links
+}
Signature · 8 lines
2.14.2


-- 

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

Re: [PATCH 1/7] xen: Define the standard values needed for stubdoms

On Mon, Mar 5, 2018 at 7:35 AM, Kurt Bodiker <[email protected]

Quoted 10 lines

wrote:

From: kebodiker <[email protected]>

This commit introduces the stubdom.inc file that is required for each recipe that is/will be built for Xen stubdomains.

Quoted 6 lines

+# Couldn't find any other way to access the version of Xen used as a dependency.
+# This version number needs changed to match version of Xen recipe used in builds.
+XEN_VERSION = "4.9.0"

:( I understand the challenge here and sadly I don't have a better recommendation, but: would putting a scope on the DEPEND enable the build to fail fast in case
of a mismatch? ie:

    DEPENDS = "xen (= ${XEN_VERSION}-r0)"

I don't much like the "-r0" tail on that though -- anyone have any better suggestion?

Quoted 5 lines
(quoted diff) +2 -0
+# Not sure if we need to (or even can) support 32-bit stubdoms
+# If we we do not need to support the 32-bit environment, then this

section and the
+# export statement afterwards can be removed.

OpenXT uses 32-bit stubdomains - though they are not based on mini-os. 32-bit PV domains have different isolation properties to 64-bit domains, due to the way the
pagetables are managed and as seen by their differing Meltdown exposure, so please do leave the code to support 32-bit stubdoms in there as they are valued.

I have a slight preference for dropping (or revising) the comment.

Quoted 14 lines
recipes-extended/xen/stubdom.inc new file +4 -0
+STUBDOM_CPPFLAGS += "-isystem ${WORKDIR}/mini-os/include"
+STUBDOM_CPPFLAGS += "-D__MINIOS__ -DHAVE_LIBC"
+STUBDOM_CPPFLAGS += "-isystem ${WORKDIR}/mini-os/include/posix"
+STUBDOM_CPPFLAGS += "-isystem ${RECIPE_SYSROOT}/usr/include/

xenstore-compat"
+STUBDOM_CPPFLAGS += "-isystem ${WORKDIR}/mini-os/include/x86 -isystem ${WORKDIR}/mini-os/include/x86/${XEN_TARGET_ARCH}"

recipes-extended/xen/stubdom.inc new file +3 -0
+STUBDOM_CPPFLAGS += "-U __linux__ -U __FreeBSD__ -U __sun__"
+STUBDOM_CPPFLAGS += "-nostdinc"
+CPPFLAGS_INCLUDE_DIR = "-isystem ${RECIPE_SYSROOT}/cross-root-$

{XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include"

(quoted diff) +2 -1
+STUBDOM_CPPFLAGS += "${CPPFLAGS_INCLUDE_DIR}"
+STUBDOM_CPPFLAGS += "-isystem ${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/lwip/include
-isystem ${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/lwip/
Quoted 3 lines

include/ipv4"
+STUBDOM_CPPFLAGS += "-isystem ${RECIPE_SYSROOT}/usr/include/xen"

The define for CPPFLAGS_INCLUDE_DIR in the middle of the above would better moved elsewhere.

Would a multi-line define would be more OE-style than the series of lines all appending to the same variable?

+

Review

Quoted 6 lines
(quoted diff) +1 -4
+STUBDOM_CFLAGS += "-mno-red-zone -O1 -fno-omit-frame-pointer -m64
-fno-reorder-blocks -fno-asynchronous-unwind-tables -DBUILD_ID
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -fno-stack-protector -fno-exceptions"

The above would also be slightly nicer split over multiple (shorter) lines.

thanks

Christopher

#3 lore raw

Re: [PATCH 1/7] xen: Define the standard values needed for stubdoms

Quoted 25 lines · Christopher Clark
Quoted 8 lines · Kurt Bodiker

From: kebodiker <[email protected]>

This commit introduces the stubdom.inc file that is required for each recipe that is/will be built for Xen stubdomains.

Quoted 6 lines

+# Couldn't find any other way to access the version of Xen used as a dependency.
+# This version number needs changed to match version of Xen recipe used in builds.
+XEN_VERSION = "4.9.0"

:( I understand the challenge here and sadly I don't have a better recommendation, but: would putting a scope on the DEPEND enable the build to fail fast in case
of a mismatch? ie:

Quoted 3 lines
    DEPENDS = "xen (= ${XEN_VERSION}-r0)"

In testing, this constraint of package version doesn't produce the build behaviour I was hoping for: bitbake doesn't enforce the version constraint at build time and from earlier related posts on the mailing list, this behaviour is known, so presumably is intentional.

So: I'll retract the review comment above - ie. there's no need to touch DEPENDS - and the XEN_VERSION variable definition going into the stubdom recipe seems practical and reasonable.

Christopher

#4 lore raw

Re: [PATCH 1/7] xen: Define the standard values needed for stubdoms

Quoted 4 lines · Christopher Clark

In testing, this constraint of package version doesn't produce the build behaviour I was hoping for: bitbake doesn't enforce the version constraint at build time and from earlier related posts on the mailing list, this behaviour is known, so presumably is intentional.

"Intentional" isn't right. We want to support it but have never gotten around to it. Making DEPENDS support version info was the first step which we did, so we can add the info but nothing currently acts on it.

Cheers,

Richard

#5 lore raw

Re: [PATCH 1/7] xen: Define the standard values needed for stubdoms

In reply to Christopher Clark

I think I've come across a better solution than defining a XEN_VERSION variable that needs maintained. I think this solution is a finer, more elegant way to accommodate the dependency on a specific Xen version.

First, the xen-vtpm recipe would be defined using Xen version numbers as we do with the Xen recipe. Instead of the initial recipe for xen-vtpm being xen-vtpm_1.0.bb, this would now be xen-vtpm_X.X.X.bb (where X.X.X is the version of Xen we intend to build stubdoms and vTPMs against. Second, rather than defining Mini-OS in the SRC_URI in stubdom.inc, I would create a mini-os_X.X.X.bb recipe that would create a source pacakge and stubdom.inc (or the appropriate recipe) would then include mini-os as a dependency. Slight manipulation of source dir ($S) would be necessary in the xen-vtpm recipe, but nothing we can't handle. Again, X.X.X would reflect the version of Xen we intend to build against.

This would be the version number maintenance outside of the recipe and allow for easier maintenance. Let me know what you think of this idea and I can implement it in the next patchset that I will submit.

Kurt

Quoted 46 lines · Christopher Clark
Quoted 25 lines · Christopher Clark
Quoted 8 lines · Kurt Bodiker

From: kebodiker <[email protected]>

This commit introduces the stubdom.inc file that is required for each recipe that is/will be built for Xen stubdomains.

Quoted 6 lines

+# Couldn't find any other way to access the version of Xen used as a dependency.
+# This version number needs changed to match version of Xen recipe used in builds.
+XEN_VERSION = "4.9.0"

:( I understand the challenge here and sadly I don't have a better recommendation, but: would putting a scope on the DEPEND enable the build to fail fast in case
of a mismatch? ie:

Quoted 3 lines
    DEPENDS = "xen (= ${XEN_VERSION}-r0)"

In testing, this constraint of package version doesn't produce the build behaviour I was hoping for: bitbake doesn't enforce the version constraint at build time and from earlier related posts on the mailing list, this behaviour is known, so presumably is intentional.

So: I'll retract the review comment above - ie. there's no need to touch DEPENDS - and the XEN_VERSION variable definition going into the stubdom recipe seems practical and reasonable.

Christopher

Signature · 11 lines
Kurt Bodiker
BrainTrust Holdings
www.braintrust-us.com
443-296-2186 office
410-750-2119 fax

-- 

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

PATCH 2/7 xen: LWIP source code with patches applied for stubdoms

In reply to Kurt Bodiker

From: kebodiker <[email protected]>

lwIP is a small implementation of the TCP/IP stack designed for use in embedded systems. This lwIP recipe does not configure nor does it build the product. Instead, this recipe applies the patches normally found in the Xen/stubdom source tree and creates a source package that can be used for cross-compiling for MiniOS.

The current Xen source code is hardcoded to fetch a specific version of this package. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

---
 .../lwip.dhcp_create_request-hwaddr_len.patch      |   13 +
 recipes-extended/xen/files/lwip.patch-cvs          | 2398 ++++++++++++++++++++
 recipes-extended/xen/lwip.inc                      |   22 +
 recipes-extended/xen/lwip_1.3.0.bb                 |   22 +
 4 files changed, 2455 insertions(+)
 create mode 100644 recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch
 create mode 100644 recipes-extended/xen/files/lwip.patch-cvs
 create mode 100644 recipes-extended/xen/lwip.inc
 create mode 100644 recipes-extended/xen/lwip_1.3.0.bb
recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch new file +13 -0
new file mode 100644
index 0000000..c43f282
@@ -0,0 +1,13 @@
+Index: src/core/dhcp.c
+===================================================================
+--- src/core/dhcp.c
++++ src/core/dhcp.c
+@@ -1356,7 +1358,7 @@ dhcp_create_request(struct netif *netif)
+   dhcp->msg_out->giaddr.addr = 0;
+   for (i = 0; i < DHCP_CHADDR_LEN; i++) {
+     /* copy netif hardware address, pad with zeroes */
+-    dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/;
++    dhcp->msg_out->chaddr[i] = (i < (netif->hwaddr_len > NETIF_MAX_HWADDR_LEN ? NETIF_MAX_HWADDR_LEN : netif->hwaddr_len)) ? netif->hwaddr[i] : 0/* pad byte*/;
+   }
+   for (i = 0; i < DHCP_SNAME_LEN; i++) {
+     dhcp->msg_out->sname[i] = 0;
recipes-extended/xen/files/lwip.patch-cvs new file +2398 -0

2,398 lines not on this page · raw message

recipes-extended/xen/lwip.inc new file +22 -0
new file mode 100644
index 0000000..1a897ed
@@ -0,0 +1,22 @@
+# Copyright (C) 2018 kebodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+# Nothing to configure or compile
+# For stubdoms, lwip is basically a source package with a couple of patches applied.
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+# needed because this directory isn't typically part of a sysroot
+SYSROOT_DIRS += "${prefix}/lwip"
+
+FILES_${PN} = "\
+    ${prefix} \
+"
+
+do_install() {
+    install -d ${D}${prefix}/lwip
+    cp -r -t ${D}${prefix}/lwip ${S}/src/*
+}
+
recipes-extended/xen/lwip_1.3.0.bb new file +22 -0
new file mode 100644
index 0000000..12be7e7
@@ -0,0 +1,22 @@
+# Copyright (C) 2018 kebodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "LWIP"
+HOMEPAGE = "https://savannah.nongnu.org/projects/lwip"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59a383b05013356e0c9899b06dc5da3f"
+
+require lwip.inc
+
+# clear this out to break dependency circle
+DEPENDS = ""
+
+TRANSLATED_PV = "${@d.getVar('PV').replace('.', '_')}"
+SRC_URI = "\
+    git://git.savannah.gnu.org/lwip.git;protocol=git;rev=STABLE-${TRANSLATED_PV};nobranch=1;destsuffix=${PN};name=lwip \
+    file://lwip.patch-cvs;striplevel=0 \
+    file://lwip.dhcp_create_request-hwaddr_len.patch;striplevel=0 \
+"
+
+S="${WORKDIR}/${PN}"
+B="${S}"
Signature · 8 lines
2.14.2


-- 

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

PATCH 3/7 xen: Newlib recipe and patches for Xen stubdoms

In reply to Kurt Bodiker

From: kebodiker <[email protected]>

Newlib provides a fast, C library optimized for embedded systems. In the case of Xen stubdomains, we are using MiniOS. This Newlib recipe creates static libraries that are cross-compiled against MiniOS, Xen, and LWIP headers and subsequently used during the cross-compilation and linking of PolarSSL, the stubdom specific GMP, 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. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

---
 recipes-extended/xen/files/newlib-chk.patch        | 155 +++++
 .../newlib-stdint-size_max-fix-from-1.17.0.patch   |  16 +
 recipes-extended/xen/files/newlib.patch            | 727 +++++++++++++++++++++
 recipes-extended/xen/newlib.inc                    |  64 ++
 recipes-extended/xen/newlib_1.16.0.bb              |  19 +
 5 files changed, 981 insertions(+)
 create mode 100644 recipes-extended/xen/files/newlib-chk.patch
 create mode 100644 recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch
 create mode 100644 recipes-extended/xen/files/newlib.patch
 create mode 100644 recipes-extended/xen/newlib.inc
 create mode 100644 recipes-extended/xen/newlib_1.16.0.bb
recipes-extended/xen/files/newlib-chk.patch new file +155 -0
new file mode 100644
index 0000000..848dbd5
@@ -0,0 +1,155 @@
+--- newlib/libc/stdio/fprintf_chk.c	1969-12-31 19:00:00.000000000 -0500
++++ newlib/libc/stdio/fprintf_chk.c	2009-02-26 19:02:53.000000000 -0500
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __fprintf_chk adapted from glibc 2.7.  This 
++ * doesn't actually implement any buffer overflow protection.  It just makes
++ * the linker happy :)
++*/
++int
++__fprintf_chk (FILE *fp, int flag, const char *format, ...)
++{
++  va_list ap;
++  int done;
++
++  va_start (ap, format);
++  done = vfprintf (fp, format, ap);
++  va_end (ap);
++
++  return done;
++}
++
+--- newlib/libc/stdio/Makefile.am	2007-08-02 16:23:06.000000000 -0400
++++ newlib/libc/stdio/Makefile.am	2009-02-26 18:14:53.000000000 -0500
+@@ -20,6 +20,7 @@
+ 	flags.c			\
+ 	fopen.c			\
+ 	fprintf.c			\
++	fprintf_chk.c		\
+ 	fputc.c			\
+ 	fputs.c			\
+ 	fread.c			\
+@@ -65,6 +66,7 @@
+ 	sniprintf.c			\
+ 	snprintf.c			\
+ 	sprintf.c			\
++	sprintf_chk.c			\
+ 	sscanf.c			\
+ 	stdio.c			\
+ 	tmpfile.c			\
+--- newlib/libc/stdio/Makefile.in	2007-12-19 17:36:38.000000000 -0500
++++ newlib/libc/stdio/Makefile.in	2009-02-26 18:43:52.000000000 -0500
+@@ -63,7 +63,8 @@
+ 	lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
+ 	lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
+ 	lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
+-	lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
++	lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
++	lib_a-fputc.$(OBJEXT) \
+ 	lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
+ 	lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
+ 	lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
+@@ -86,6 +87,7 @@
+ 	lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
+ 	lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
+ 	lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
++	lib_a-sprintf_chk.$(OBJEXT) \
+ 	lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
+ 	lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
+ 	lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
+@@ -122,15 +124,15 @@
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
+ 	fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
+-	fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
+-	fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
++	fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \
++	fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
+ 	ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
+ 	getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
+ 	iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
+ 	putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
+ 	rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
+ 	setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
+-	sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
++	sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \
+ 	tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
+ 	viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
+ 	vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
+@@ -344,6 +346,7 @@
+ 	flags.c			\
+ 	fopen.c			\
+ 	fprintf.c			\
++	fprintf_chk.c			\
+ 	fputc.c			\
+ 	fputs.c			\
+ 	fread.c			\
+@@ -389,6 +392,7 @@
+ 	sniprintf.c			\
+ 	snprintf.c			\
+ 	sprintf.c			\
++	sprintf_chk.c			\
+ 	sscanf.c			\
+ 	stdio.c			\
+ 	tmpfile.c			\
+@@ -508,6 +512,7 @@
+ 	siprintf.def		\
+ 	siscanf.def		\
+ 	sprintf.def		\
++	sprintf_chk.def		\
+ 	sscanf.def		\
+ 	tmpfile.def		\
+ 	tmpnam.def		\
+@@ -678,6 +683,12 @@
+ lib_a-fprintf.obj: fprintf.c
+ 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi`
+ 
++lib_a-fprintf_chk.o: fprintf_chk.c
++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c
++
++lib_a-fprintf_chk.obj: fprintf_chk.c
++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi`
++
+ lib_a-fputc.o: fputc.c
+ 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c
+ 
+@@ -948,6 +959,12 @@
+ lib_a-sprintf.obj: sprintf.c
+ 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi`
+ 
++lib_a-sprintf_chk.o: sprintf_chk.c
++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c
++
++lib_a-sprintf_chk.obj: sprintf_chk.c
++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi`
++
+ lib_a-sscanf.o: sscanf.c
+ 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c
+ 
+--- newlib/libc/stdio/sprintf_chk.c	1969-12-31 19:00:00.000000000 -0500
++++ newlib/libc/stdio/sprintf_chk.c	2009-02-26 19:02:26.000000000 -0500
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __sprintf_chk adapted from glibc 2.7.  This 
++ * doesn't actually implement any buffer overflow protection.  It just makes
++ * the linker happy :)
++*/
++int
++__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
++{
++  va_list arg;
++  int done;
++
++  va_start (arg, format);
++  done = vsprintf (s, format, arg);
++  va_end (arg);
++
++  return done;
++}
++
recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch new file +16 -0
new file mode 100644
index 0000000..1054a07
@@ -0,0 +1,16 @@
+--- newlib-1.16.0/newlib/libc/include/stdint.h.orig	2006-08-17 00:39:43.000000000 +0300
++++ newlib-1.16.0/newlib/libc/include/stdint.h	2009-08-25 17:33:23.000000000 +0300
+@@ -348,8 +348,11 @@
+ #endif
+ 
+ /* This must match size_t in stddef.h, currently long unsigned int */
+-#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
+-#define SIZE_MAX __STDINT_EXP(LONG_MAX)
++#ifdef __SIZE_MAX__
++#define SIZE_MAX __SIZE_MAX__
++#else
++#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
++#endif
+ 
+ /* This must match sig_atomic_t in <signal.h> (currently int) */
+ #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
recipes-extended/xen/files/newlib.patch new file +727 -0

727 lines not on this page · raw message

recipes-extended/xen/newlib.inc new file +64 -0

64 lines not on this page · raw message

recipes-extended/xen/newlib_1.16.0.bb new file +19 -0
new file mode 100644
index 0000000..ea80271
@@ -0,0 +1,19 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Newlib is a C library intended for use on embedded systems."
+HOMEPAGE = "http://sourceware.org/newlib"
+LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
+LIC_FILES_CHKSUM = "file://COPYING.NEWLIB;md5=950f50b290e8fcf7a2d3fff61775de9b"
+
+S="${WORKDIR}/newlib"
+B="${WORKDIR}/build"
+
+SRC_URI += "\
+    git://sourceware.org/git/newlib-cygwin.git;protocol=git;rev=newlib-${TRANSLATED_PV};destsuffix=newlib;nobranch=1;name=newlib \
+    file://newlib.patch;striplevel=0 \
+    file://newlib-chk.patch;striplevel=0 \
+    file://newlib-stdint-size_max-fix-from-1.17.0.patch;striplevel=1 \
+"
+
+require newlib.inc
Signature · 8 lines
2.14.2


-- 

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

Re: [PATCH 3/7] xen: Newlib recipe and patches for Xen stubdoms

Quoted 1,020 lines · Kurt Bodiker

From: kebodiker <[email protected]>

Newlib provides a fast, C library optimized for embedded systems. In the case of Xen stubdomains, we are using MiniOS. This Newlib recipe creates static libraries that are cross-compiled against MiniOS, Xen, and LWIP headers and subsequently used during the cross-compilation and linking of PolarSSL, the stubdom specific GMP, 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. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

---
 recipes-extended/xen/files/newlib-chk.patch        | 155 +++++
 .../newlib-stdint-size_max-fix-from-1.17.0.patch   |  16 +
 recipes-extended/xen/files/newlib.patch            | 727 +++++++++++++++++++++
 recipes-extended/xen/newlib.inc                    |  64 ++
 recipes-extended/xen/newlib_1.16.0.bb              |  19 +
 5 files changed, 981 insertions(+)
 create mode 100644 recipes-extended/xen/files/newlib-chk.patch
 create mode 100644 recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch
 create mode 100644 recipes-extended/xen/files/newlib.patch
 create mode 100644 recipes-extended/xen/newlib.inc
 create mode 100644 recipes-extended/xen/newlib_1.16.0.bb
recipes-extended/xen/files/newlib-chk.patch new file +155 -0
new file mode 100644
index 0000000..848dbd5
@@ -0,0 +1,155 @@
+--- newlib/libc/stdio/fprintf_chk.c    1969-12-31 19:00:00.000000000 -0500
++++ newlib/libc/stdio/fprintf_chk.c    2009-02-26 19:02:53.000000000 -0500
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __fprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It just makes
++ * the linker happy :)
++*/
++int
++__fprintf_chk (FILE *fp, int flag, const char *format, ...)
++{
++  va_list ap;
++  int done;
++
++  va_start (ap, format);
++  done = vfprintf (fp, format, ap);
++  va_end (ap);
++
++  return done;
++}
++
+--- newlib/libc/stdio/Makefile.am      2007-08-02 16:23:06.000000000 -0400
++++ newlib/libc/stdio/Makefile.am      2009-02-26 18:14:53.000000000 -0500
+@@ -20,6 +20,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c           \
+       fputc.c                 \
+       fputs.c                 \
+       fread.c                 \
+@@ -65,6 +66,7 @@
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+--- newlib/libc/stdio/Makefile.in      2007-12-19 17:36:38.000000000 -0500
++++ newlib/libc/stdio/Makefile.in      2009-02-26 18:43:52.000000000 -0500
+@@ -63,7 +63,8 @@
+       lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
+       lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
+       lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
+-      lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
++      lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
++      lib_a-fputc.$(OBJEXT) \
+       lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
+       lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
+       lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
+@@ -86,6 +87,7 @@
+       lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
+       lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
+       lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
++      lib_a-sprintf_chk.$(OBJEXT) \
+       lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
+       lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
+       lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
+@@ -122,15 +124,15 @@
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
+       fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
+-      fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
+-      fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
++      fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \
++      fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
+       ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
+       getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
+       iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
+       putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
+       rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
+       setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
+-      sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
++      sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \
+       tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
+       viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
+       vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
+@@ -344,6 +346,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c                   \
+       fputc.c                 \
+       fputs.c                 \
+       fread.c                 \
+@@ -389,6 +392,7 @@
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+@@ -508,6 +512,7 @@
+       siprintf.def            \
+       siscanf.def             \
+       sprintf.def             \
++      sprintf_chk.def         \
+       sscanf.def              \
+       tmpfile.def             \
+       tmpnam.def              \
+@@ -678,6 +683,12 @@
+ lib_a-fprintf.obj: fprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi`
+
++lib_a-fprintf_chk.o: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c
++
++lib_a-fprintf_chk.obj: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi`
++
+ lib_a-fputc.o: fputc.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c
+
+@@ -948,6 +959,12 @@
+ lib_a-sprintf.obj: sprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi`
+
++lib_a-sprintf_chk.o: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c
++
++lib_a-sprintf_chk.obj: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi`
++
+ lib_a-sscanf.o: sscanf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c
+
+--- newlib/libc/stdio/sprintf_chk.c    1969-12-31 19:00:00.000000000 -0500
++++ newlib/libc/stdio/sprintf_chk.c    2009-02-26 19:02:26.000000000 -0500
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __sprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It just makes
++ * the linker happy :)
++*/
++int
++__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
++{
++  va_list arg;
++  int done;
++
++  va_start (arg, format);
++  done = vsprintf (s, format, arg);
++  va_end (arg);
++
++  return done;
++}
++
recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch new file +16 -0
new file mode 100644
index 0000000..1054a07
@@ -0,0 +1,16 @@
+--- newlib-1.16.0/newlib/libc/include/stdint.h.orig    2006-08-17 00:39:43.000000000 +0300
++++ newlib-1.16.0/newlib/libc/include/stdint.h 2009-08-25 17:33:23.000000000 +0300
+@@ -348,8 +348,11 @@
+ #endif
+
+ /* This must match size_t in stddef.h, currently long unsigned int */
+-#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
+-#define SIZE_MAX __STDINT_EXP(LONG_MAX)
++#ifdef __SIZE_MAX__
++#define SIZE_MAX __SIZE_MAX__
++#else
++#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
++#endif
+
+ /* This must match sig_atomic_t in <signal.h> (currently int) */
+ #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
recipes-extended/xen/files/newlib.patch new file +727 -0
new file mode 100644
index 0000000..ee9b6f2
@@ -0,0 +1,727 @@
+There is a mix between longs and long longs.
+
+Index: newlib/libc/include/inttypes.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v
+retrieving revision 1.3
+diff -u -p -r1.3 inttypes.h
+--- newlib/libc/include/inttypes.h     16 Dec 2005 19:03:12 -0000      1.3
++++ newlib/libc/include/inttypes.h     8 Nov 2007 16:32:44 -0000
+@@ -163,12 +163,12 @@
+
+
+ /* 64-bit types */
+-#if __have_longlong64
+-#define __PRI64(x) __STRINGIFY(ll##x)
+-#define __SCN64(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRI64(x) __STRINGIFY(l##x)
+ #define __SCN64(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRI64(x) __STRINGIFY(ll##x)
++#define __SCN64(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRI64(x) __STRINGIFY(x)
+ #define __SCN64(x) __STRINGIFY(x)
+@@ -217,12 +217,12 @@
+ #endif
+
+ /* max-bit types */
+-#if __have_longlong64
+-#define __PRIMAX(x) __STRINGIFY(ll##x)
+-#define __SCNMAX(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIMAX(x) __STRINGIFY(l##x)
+ #define __SCNMAX(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIMAX(x) __STRINGIFY(ll##x)
++#define __SCNMAX(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIMAX(x) __STRINGIFY(x)
+ #define __SCNMAX(x) __STRINGIFY(x)
+@@ -242,12 +242,12 @@
+ #define SCNxMAX               __SCNMAX(x)
+
+ /* ptr types */
+-#if __have_longlong64
+-#define __PRIPTR(x) __STRINGIFY(ll##x)
+-#define __SCNPTR(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIPTR(x) __STRINGIFY(l##x)
+ #define __SCNPTR(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIPTR(x) __STRINGIFY(ll##x)
++#define __SCNPTR(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIPTR(x) __STRINGIFY(x)
+ #define __SCNPTR(x) __STRINGIFY(x)
+
+We don't want u?int32_t to be long as our code assume in a lot of places to be
+int.
+
+Index: newlib/libc/include/stdint.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
+retrieving revision 1.10
+diff -u -p -r1.10 stdint.h
+--- newlib/libc/include/stdint.h       16 Aug 2006 21:39:43 -0000      1.10
++++ newlib/libc/include/stdint.h       12 Feb 2008 13:07:52 -0000
+@@ -38,7 +38,7 @@ extern "C" {
+ #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+ #define __have_long64 1
+ #elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
+-#define __have_long32 1
++/* #define __have_long32 1 */
+ #endif
+
+ #if __STDINT_EXP(SCHAR_MAX) == 0x7f
+
+Define the basic ia64 jump buffer
+
+Index: newlib/libc/include/sys/config.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
+retrieving revision 1.47
+diff -u -p -r1.47 config.h
+--- newlib/libc/include/sys/config.h   15 Mar 2007 21:32:12 -0000      1.47
++++ newlib/libc/include/sys/config.h   8 Nov 2007 16:32:44 -0000
+@@ -71,6 +71,10 @@
+ #endif
+ #endif
+
++#ifndef __DYNAMIC_REENT__
++#define __DYNAMIC_REENT__
++#endif
++
+ #ifdef __mn10200__
+ #define __SMALL_BITFIELDS
+ #endif
+
+Dynamic pointer to our reentrancy zone
+
+Index: newlib/libc/reent/getreent.c
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v
+retrieving revision 1.2
+diff -u -p -r1.2 getreent.c
+--- newlib/libc/reent/getreent.c       7 Sep 2007 00:45:55 -0000       1.2
++++ newlib/libc/reent/getreent.c       8 Nov 2007 16:32:44 -0000
+@@ -3,12 +3,20 @@
+ #include <_ansi.h>
+ #include <reent.h>
+
++#define weak_alias(name, aliasname) \
++  extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
++
+ #ifdef __getreent
+ #undef __getreent
+ #endif
++#ifdef __libc_getreent
++#undef __libc_getreent
++#endif
+
+ struct _reent *
+-_DEFUN_VOID(__getreent)
++__libc_getreent (void)
+ {
+   return _impure_ptr;
+ }
++weak_alias(__libc_getreent,__getreent)
++
+
+We can't provide a red zone in mini-os.
+
+Index: newlib/libc/machine/x86_64/memcpy.S
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v
+retrieving revision 1.1
+diff -u -p -r1.1 memcpy.S
+--- newlib/libc/machine/x86_64/memcpy.S        28 Aug 2007 21:56:49 -0000      1.1
++++ newlib/libc/machine/x86_64/memcpy.S        8 Nov 2007 16:32:44 -0000
+@@ -30,10 +30,18 @@ quadword_aligned:
+   cmpq    $256, rdx
+   jb      quadword_copy
+
++#if 1
++  subq    $32, rsp
++  movq    rax, 24 (rsp)
++  movq    r12, 16 (rsp)
++  movq    r13, 8  (rsp)
++  movq    r14, 0  (rsp)
++#else
+   movq    rax, -8  (rsp)
+   movq    r12, -16 (rsp)
+   movq    r13, -24 (rsp)
+   movq    r14, -32 (rsp)
++#endif
+
+   movq    rdx, rcx                /* Copy 128 bytes at a time with minimum cache polution */
+   shrq    $7, rcx
+@@ -89,10 +97,18 @@ loop:
+   movq    rdx, rcx
+   andq    $127, rcx
+   rep     movsb
++#if 1
++  movq    24 (rsp), rax
++  movq    16 (rsp), r12
++  movq    8  (rsp), r13
++  movq    0  (rsp), r14
++  addq    $32, rsp
++#else
+   movq    -8  (rsp), rax
+   movq    -16 (rsp), r12
+   movq    -24 (rsp), r13
+   movq    -32 (rsp), r14
++#endif
+   ret
+
+
+--- newlib/libc/machine/x86_64/x86_64mach.h.orig       2008-07-11 14:57:23.062269000 +0100
++++ newlib/libc/machine/x86_64/x86_64mach.h    2008-07-11 14:58:01.262503000 +0100
+@@ -22,81 +22,81 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define rax REG(rax)
+-#define rbx REG(rbx)
+-#define rcx REG(rcx)
+-#define rdx REG(rdx)
+-#define rsi REG(rsi)
+-#define rdi REG(rdi)
+-#define rbp REG(rbp)
+-#define rsp REG(rsp)
+-
+-#define r8  REG(r8)
+-#define r9  REG(r9)
+-#define r10 REG(r10)
+-#define r11 REG(r11)
+-#define r12 REG(r12)
+-#define r13 REG(r13)
+-#define r14 REG(r14)
+-#define r15 REG(r15)
+-
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define sil REG(sil)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
+-
+-#define xmm0 REG(xmm0)
+-#define xmm1 REG(xmm1)
+-#define xmm2 REG(xmm2)
+-#define xmm3 REG(xmm3)
+-#define xmm4 REG(xmm4)
+-#define xmm5 REG(xmm5)
+-#define xmm6 REG(xmm6)
+-#define xmm7 REG(xmm7)
+-
+-#define cr0 REG(cr0)
+-#define cr1 REG(cr1)
+-#define cr2 REG(cr2)
+-#define cr3 REG(cr3)
+-#define cr4 REG(cr4)
++#define rax %rax
++#define rbx %rbx
++#define rcx %rcx
++#define rdx %rdx
++#define rsi %rsi
++#define rdi %rdi
++#define rbp %rbp
++#define rsp %rsp
++
++#define r8  %r8
++#define r9  %r9
++#define r10 %r10
++#define r11 %r11
++#define r12 %r12
++#define r13 %r13
++#define r14 %r14
++#define r15 %r15
++
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define sil %sil
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
++
++#define xmm0 %xmm0
++#define xmm1 %xmm1
++#define xmm2 %xmm2
++#define xmm3 %xmm3
++#define xmm4 %xmm4
++#define xmm5 %xmm5
++#define xmm6 %xmm6
++#define xmm7 %xmm7
++
++#define cr0 %cr0
++#define cr1 %cr1
++#define cr2 %cr2
++#define cr3 %cr3
++#define cr4 %cr4
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memcpy.S.orig   2008-07-11 15:12:27.494693000 +0100
++++ newlib/libc/machine/x86_64/memcpy.S        2008-07-11 15:12:29.448706000 +0100
+@@ -60,14 +60,14 @@
+   movq    48 (rsi), r13
+   movq    56 (rsi), r14
+
+-  movntiq rax,    (rdi)
+-  movntiq r8 ,  8 (rdi)
+-  movntiq r9 , 16 (rdi)
+-  movntiq r10, 24 (rdi)
+-  movntiq r11, 32 (rdi)
+-  movntiq r12, 40 (rdi)
+-  movntiq r13, 48 (rdi)
+-  movntiq r14, 56 (rdi)
++  movnti rax,    (rdi)
++  movnti r8 ,  8 (rdi)
++  movnti r9 , 16 (rdi)
++  movnti r10, 24 (rdi)
++  movnti r11, 32 (rdi)
++  movnti r12, 40 (rdi)
++  movnti r13, 48 (rdi)
++  movnti r14, 56 (rdi)
+
+   movq     64 (rsi), rax
+   movq     72 (rsi), r8
+@@ -78,14 +78,14 @@
+   movq    112 (rsi), r13
+   movq    120 (rsi), r14
+
+-  movntiq rax,  64 (rdi)
+-  movntiq r8 ,  72 (rdi)
+-  movntiq r9 ,  80 (rdi)
+-  movntiq r10,  88 (rdi)
+-  movntiq r11,  96 (rdi)
+-  movntiq r12, 104 (rdi)
+-  movntiq r13, 112 (rdi)
+-  movntiq r14, 120 (rdi)
++  movnti rax,  64 (rdi)
++  movnti r8 ,  72 (rdi)
++  movnti r9 ,  80 (rdi)
++  movnti r10,  88 (rdi)
++  movnti r11,  96 (rdi)
++  movnti r12, 104 (rdi)
++  movnti r13, 112 (rdi)
++  movnti r14, 120 (rdi)
+
+   leaq    128 (rsi), rsi
+   leaq    128 (rdi), rdi
+--- newlib/libc/machine/i386/i386mach.h        2000-08-28 18:50:06.000000000 +0100
++++ newlib/libc/machine/i386/i386mach.h        2008-07-11 15:17:13.874409000 +0100
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memset.S        2007-08-28 22:56:49.000000000 +0100
++++ newlib/libc/machine/x86_64/memset.S        2008-07-11 15:16:59.098320000 +0100
+@@ -40,22 +40,22 @@
+
+   .p2align 4
+ loop:
+-  movntiq rax,     (rdi)
+-  movntiq rax,   8 (rdi)
+-  movntiq rax,  16 (rdi)
+-  movntiq rax,  24 (rdi)
+-  movntiq rax,  32 (rdi)
+-  movntiq rax,  40 (rdi)
+-  movntiq rax,  48 (rdi)
+-  movntiq rax,  56 (rdi)
+-  movntiq rax,  64 (rdi)
+-  movntiq rax,  72 (rdi)
+-  movntiq rax,  80 (rdi)
+-  movntiq rax,  88 (rdi)
+-  movntiq rax,  96 (rdi)
+-  movntiq rax, 104 (rdi)
+-  movntiq rax, 112 (rdi)
+-  movntiq rax, 120 (rdi)
++  movnti rax,     (rdi)
++  movnti rax,   8 (rdi)
++  movnti rax,  16 (rdi)
++  movnti rax,  24 (rdi)
++  movnti rax,  32 (rdi)
++  movnti rax,  40 (rdi)
++  movnti rax,  48 (rdi)
++  movnti rax,  56 (rdi)
++  movnti rax,  64 (rdi)
++  movnti rax,  72 (rdi)
++  movnti rax,  80 (rdi)
++  movnti rax,  88 (rdi)
++  movnti rax,  96 (rdi)
++  movnti rax, 104 (rdi)
++  movnti rax, 112 (rdi)
++  movnti rax, 120 (rdi)
+
+   leaq    128 (rdi), rdi
+
+--- newlib/libm/machine/i386/i386mach.h.orig   2008-07-11 15:30:37.367227000 +0100
++++ newlib/libm/machine/i386/i386mach.h        2008-07-11 15:30:55.232337000 +0100
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+
+
+We want to have a 64bit offsets libc even on 32bit platforms.
+
+--- ./newlib/configure.host.orig       2008-08-07 16:01:17.801946000 +0100
++++ ./newlib/configure.host    2008-08-07 16:01:34.181064000 +0100
+@@ -317,6 +317,8 @@
+     oext=lo
+     lpfx=
+     aext=la ;;
++  i[34567]86-xen-elf)
++    stdio64_dir=stdio64 ;;
+   *) ;; #shared library not supported for ${host}
+ esac
+
+--- newlib/libc/include/sys/_types.h.orig      2008-08-07 15:22:44.925008000 +0100
++++ newlib/libc/include/sys/_types.h   2008-08-07 15:22:50.824044000 +0100
+@@ -13,8 +13,12 @@
+ #include <sys/lock.h>
+
+ #ifndef __off_t_defined
++#ifdef __MINIOS__
++typedef long long _off_t;
++#else
+ typedef long _off_t;
+ #endif
++#endif
+
+ #if defined(__rtems__)
+ /* device numbers are 32-bit major and and 32-bit minor */
+--- ./newlib/libc/include/sys/config.h.orig    2008-08-07 14:43:25.915866000 +0100
++++ ./newlib/libc/include/sys/config.h 2008-08-07 14:44:13.508154000 +0100
+@@ -69,6 +69,10 @@
+ /* we use some glibc header files so turn on glibc large file feature */
+ #define _LARGEFILE64_SOURCE 1
+ #endif
++#ifdef __MINIOS__
++#define __LARGE64_FILES 1
++#define _LARGEFILE64_SOURCE 1
++#endif
+ #endif
+
+ #ifndef __DYNAMIC_REENT__
+--- ./newlib/libc/include/sys/_default_fcntl.h.orig    2008-08-07 15:08:22.377836000 +0100
++++ ./newlib/libc/include/sys/_default_fcntl.h 2008-08-07 15:08:31.651890000 +0100
+@@ -170,7 +170,11 @@
+ /* Provide _<systemcall> prototypes for functions provided by some versions
+    of newlib.  */
+ #ifdef _COMPILING_NEWLIB
+-extern int _open _PARAMS ((const char *, int, ...));
++extern int _open _PARAMS ((const char *, int, ...))
++#ifdef __MINIOS__
++    asm("open64")
++#endif
++    ;
+ extern int _fcntl _PARAMS ((int, int, ...));
+ #ifdef __LARGE64_FILES
+ extern int _open64 _PARAMS ((const char *, int, ...));
+--- ./newlib/libc/include/sys/unistd.h.orig    2008-08-07 15:09:36.449280000 +0100
++++ ./newlib/libc/include/sys/unistd.h 2008-08-07 15:09:51.210370000 +0100
+@@ -101,7 +101,11 @@
+ int     _EXFUN(link, (const char *__path1, const char *__path2 ));
+ int   _EXFUN(nice, (int __nice_value ));
+ #if !defined(__INSIDE_CYGWIN__)
+-off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
++off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ))
++#ifdef __MINIOS__
++    asm("lseek64")
++#endif
++    ;
+ #endif
+ #if defined(__SPU__)
+ #define F_ULOCK       0
+--- ./newlib/libc/include/sys/stat.h.orig      2008-08-07 16:08:50.495116000 +0100
++++ ./newlib/libc/include/sys/stat.h   2008-08-07 16:10:21.799753000 +0100
+@@ -49,6 +49,9 @@
+   long        st_spare4[2];
+ #endif
+ };
++#ifdef __MINIOS__
++#define stat64 stat
++#endif
+ #endif
+
+ #define       _IFMT           0170000 /* type of file */
+@@ -132,7 +135,11 @@
+ /* Provide prototypes for most of the _<systemcall> names that are
+    provided in newlib for some compilers.  */
+ #ifdef _COMPILING_NEWLIB
+-int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
++int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ))
++#ifdef __MINIOS__
++    asm("fstat64")
++#endif
++    ;
+ int   _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
+ #ifdef __LARGE64_FILES
+ struct stat64;
+--- ./newlib/libc/include/_syslist.h.orig      2008-08-07 16:24:19.122605000 +0100
++++ ./newlib/libc/include/_syslist.h   2008-08-07 16:24:21.548628000 +0100
+@@ -14,6 +14,7 @@
+ #define _kill kill
+ #define _link link
+ #define _lseek lseek
++#define _lseek64 lseek64
+ #define _open open
+ #define _read read
+ #define _sbrk sbrk
+--- newlib/libc/include/reent.h.orig   2008-08-07 16:28:49.846502000 +0100
++++ newlib/libc/include/reent.h        2008-08-07 16:29:02.096586000 +0100
+@@ -87,6 +87,9 @@
+ #if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB)
+ #define stat64 __stat64
+ #endif
++#if defined(__MINIOS__)
++#define stat64 stat
++#endif
+
+ struct stat64;
+
recipes-extended/xen/newlib.inc new file +64 -0
new file mode 100644
index 0000000..32d79aa
@@ -0,0 +1,64 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+CPPFLAGS_INCLUDE_DIR = "-isystem `${HOST_PREFIX}gcc -print-file-name=include`"
+STUBDOM_CFLAGS += "-D_I386MACH_ALLOW_HW_INTERRUPTS"
+
+export ac_cv_path_CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"
+export CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"
+
+export ac_cv_path_CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}"
+export CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}"
+export CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+export LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_AS_FOR_TARGET="${HOST_PREFIX}as"
+export AS_FOR_TARGET="${HOST_PREFIX}as"
+
+export ac_cv_path_AR_FOR_TARGET="${HOST_PREFIX}ar"
+export AR_FOR_TARGET="${HOST_PREFIX}ar"
+
+export ac_cv_path_NM_FOR_TARGET="${HOST_PREFIX}nm"
+export NM_FOR_TARGET="${HOST_PREFIX}nm"
+
+export ac_cv_path_RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+
+export ac_cv_path_OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+export OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+
+export ac_cv_path_OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+export OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+
+export ac_cv_path_STRIP_FOR_TARGET="${HOST_PREFIX}strip"
+export STRIP_FOR_TARGET="${HOST_PREFIX}strip"
+
+export ac_cv_path_STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+export STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+
+export ac_cv_path_READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+export READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+
+do_configure() {
+    ${S}/configure --verbose --prefix=${prefix} --target=${GNU_TARGET_ARCH}-xen-elf --enable-newlib-io-long-long --disable-multilib
+    find ${S} -type f | xargs perl -i.bak -pe 's/\b_(tzname|daylight|timezone)\b/$1/g'
+}
+
+do_compile() {
+    ${MAKE}
+}
+
+do_install() {
+    ${MAKE} DESTDIR=${D} install
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/share
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/info
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdarg.h -t ${D}/${includedir}
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stddef.h -t ${D}/${includedir}
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdbool.h -t ${D}/${includedir}
+}
recipes-extended/xen/newlib_1.16.0.bb new file +0 -0
new file mode 100644
index 0000000..ea80271

recipes-extended/xen/newlib_1.16.0.bb line 8

Quoted 8 lines
recipes-extended/xen/newlib_1.16.0.bb new file +8 -0
@@ -0,0 +1,19 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Newlib is a C library intended for use on embedded systems."
+HOMEPAGE = "http://sourceware.org/newlib"
+LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
+LIC_FILES_CHKSUM = "file://COPYING.NEWLIB;md5=950f50b290e8fcf7a2d3fff61775de9b"
+

I see newlib in a few other oe layers, but nothing that looks to be common. For my
own understanding (and when someone asks me about this), is there any significant
difference in this newlib implementation/build than you'd find in other newlib use cases ?

recipes-extended/xen/newlib_1.16.0.bb line 13

Quoted 5 lines
recipes-extended/xen/newlib_1.16.0.bb new file +5 -0
+S="${WORKDIR}/newlib"
+B="${WORKDIR}/build"
+
+SRC_URI += "\
+    git://sourceware.org/git/newlib-cygwin.git;protocol=git;rev=newlib-${TRANSLATED_PV};destsuffix=newlib;nobranch=1;name=newlib \

Using tags for SRCREVs is generally frowned upon. Is that what this is doing ? Even if you want to
use the convenience variable you created, it would still be better to explicitly set SRCREV in the
recipes for easier maintenance and to make things more obvious.

recipes-extended/xen/newlib_1.16.0.bb line 15

Quoted 2 lines
recipes-extended/xen/newlib_1.16.0.bb new file +2 -0
+    file://newlib.patch;striplevel=0 \
+    file://newlib-chk.patch;striplevel=0 \

We really shouldn't be specifying striplevel on the patches. Why aren't the patches being
generated in a way that makes then consistent, and that can be applied with the defaults ?

Bruce

Quoted 18 lines
recipes-extended/xen/newlib_1.16.0.bb new file +4 -1
+    file://newlib-stdint-size_max-fix-from-1.17.0.patch;striplevel=1 \
+"
+
+require newlib.inc
--

2.14.2

--

*This email and all attachments are considered confidential and the proprietary information of BrainTrust Holdings. Unauthorized disclosure is prohibited. *
--
_______________________________________________
meta-virtualization mailing list [email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#9 lore raw

Re: [PATCH 3/7] xen: Newlib recipe and patches for Xen stubdoms

Quoted 1,028 lines · Bruce Ashfield
Quoted 1,026 lines · Kurt Bodiker

From: kebodiker <[email protected]>

Newlib provides a fast, C library optimized for embedded systems. In the case of Xen stubdomains, we are using MiniOS. This Newlib recipe creates static libraries that are cross-compiled against MiniOS, Xen, and LWIP headers and subsequently used during the cross-compilation and linking of PolarSSL, the stubdom specific GMP, 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. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

---
 recipes-extended/xen/files/newlib-chk.patch        | 155 +++++
 .../newlib-stdint-size_max-fix-from-1.17.0.patch   |  16 +
 recipes-extended/xen/files/newlib.patch            | 727 +++++++++++++++++++++
 recipes-extended/xen/newlib.inc                    |  64 ++
 recipes-extended/xen/newlib_1.16.0.bb              |  19 +
 5 files changed, 981 insertions(+)
 create mode 100644 recipes-extended/xen/files/newlib-chk.patch
 create mode 100644 recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch
 create mode 100644 recipes-extended/xen/files/newlib.patch
 create mode 100644 recipes-extended/xen/newlib.inc
 create mode 100644 recipes-extended/xen/newlib_1.16.0.bb
recipes-extended/xen/files/newlib-chk.patch new file +155 -0
new file mode 100644
index 0000000..848dbd5
@@ -0,0 +1,155 @@
+--- newlib/libc/stdio/fprintf_chk.c    1969-12-31 19:00:00.000000000 -0500
++++ newlib/libc/stdio/fprintf_chk.c    2009-02-26 19:02:53.000000000 -0500
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __fprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It just makes
++ * the linker happy :)
++*/
++int
++__fprintf_chk (FILE *fp, int flag, const char *format, ...)
++{
++  va_list ap;
++  int done;
++
++  va_start (ap, format);
++  done = vfprintf (fp, format, ap);
++  va_end (ap);
++
++  return done;
++}
++
+--- newlib/libc/stdio/Makefile.am      2007-08-02 16:23:06.000000000 -0400
++++ newlib/libc/stdio/Makefile.am      2009-02-26 18:14:53.000000000 -0500
+@@ -20,6 +20,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c           \
+       fputc.c                 \
+       fputs.c                 \
+       fread.c                 \
+@@ -65,6 +66,7 @@
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+--- newlib/libc/stdio/Makefile.in      2007-12-19 17:36:38.000000000 -0500
++++ newlib/libc/stdio/Makefile.in      2009-02-26 18:43:52.000000000 -0500
+@@ -63,7 +63,8 @@
+       lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
+       lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
+       lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
+-      lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
++      lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
++      lib_a-fputc.$(OBJEXT) \
+       lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
+       lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
+       lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
+@@ -86,6 +87,7 @@
+       lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
+       lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
+       lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
++      lib_a-sprintf_chk.$(OBJEXT) \
+       lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
+       lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
+       lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
+@@ -122,15 +124,15 @@
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
+       fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
+-      fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
+-      fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
++      fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \
++      fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
+       ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
+       getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
+       iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
+       putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
+       rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
+       setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
+-      sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
++      sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \
+       tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
+       viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
+       vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
+@@ -344,6 +346,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c                   \
+       fputc.c                 \
+       fputs.c                 \
+       fread.c                 \
+@@ -389,6 +392,7 @@
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+@@ -508,6 +512,7 @@
+       siprintf.def            \
+       siscanf.def             \
+       sprintf.def             \
++      sprintf_chk.def         \
+       sscanf.def              \
+       tmpfile.def             \
+       tmpnam.def              \
+@@ -678,6 +683,12 @@
+ lib_a-fprintf.obj: fprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi`
+
++lib_a-fprintf_chk.o: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c
++
++lib_a-fprintf_chk.obj: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi`
++
+ lib_a-fputc.o: fputc.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c
+
+@@ -948,6 +959,12 @@
+ lib_a-sprintf.obj: sprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi`
+
++lib_a-sprintf_chk.o: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c
++
++lib_a-sprintf_chk.obj: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi`
++
+ lib_a-sscanf.o: sscanf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c
+
+--- newlib/libc/stdio/sprintf_chk.c    1969-12-31 19:00:00.000000000 -0500
++++ newlib/libc/stdio/sprintf_chk.c    2009-02-26 19:02:26.000000000 -0500
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __sprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It just makes
++ * the linker happy :)
++*/
++int
++__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
++{
++  va_list arg;
++  int done;
++
++  va_start (arg, format);
++  done = vsprintf (s, format, arg);
++  va_end (arg);
++
++  return done;
++}
++
recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch new file +16 -0
new file mode 100644
index 0000000..1054a07
@@ -0,0 +1,16 @@
+--- newlib-1.16.0/newlib/libc/include/stdint.h.orig    2006-08-17 00:39:43.000000000 +0300
++++ newlib-1.16.0/newlib/libc/include/stdint.h 2009-08-25 17:33:23.000000000 +0300
+@@ -348,8 +348,11 @@
+ #endif
+
+ /* This must match size_t in stddef.h, currently long unsigned int */
+-#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
+-#define SIZE_MAX __STDINT_EXP(LONG_MAX)
++#ifdef __SIZE_MAX__
++#define SIZE_MAX __SIZE_MAX__
++#else
++#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
++#endif
+
+ /* This must match sig_atomic_t in <signal.h> (currently int) */
+ #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
recipes-extended/xen/files/newlib.patch new file +727 -0
new file mode 100644
index 0000000..ee9b6f2
@@ -0,0 +1,727 @@
+There is a mix between longs and long longs.
+
+Index: newlib/libc/include/inttypes.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v
+retrieving revision 1.3
+diff -u -p -r1.3 inttypes.h
+--- newlib/libc/include/inttypes.h     16 Dec 2005 19:03:12 -0000      1.3
++++ newlib/libc/include/inttypes.h     8 Nov 2007 16:32:44 -0000
+@@ -163,12 +163,12 @@
+
+
+ /* 64-bit types */
+-#if __have_longlong64
+-#define __PRI64(x) __STRINGIFY(ll##x)
+-#define __SCN64(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRI64(x) __STRINGIFY(l##x)
+ #define __SCN64(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRI64(x) __STRINGIFY(ll##x)
++#define __SCN64(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRI64(x) __STRINGIFY(x)
+ #define __SCN64(x) __STRINGIFY(x)
+@@ -217,12 +217,12 @@
+ #endif
+
+ /* max-bit types */
+-#if __have_longlong64
+-#define __PRIMAX(x) __STRINGIFY(ll##x)
+-#define __SCNMAX(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIMAX(x) __STRINGIFY(l##x)
+ #define __SCNMAX(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIMAX(x) __STRINGIFY(ll##x)
++#define __SCNMAX(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIMAX(x) __STRINGIFY(x)
+ #define __SCNMAX(x) __STRINGIFY(x)
+@@ -242,12 +242,12 @@
+ #define SCNxMAX               __SCNMAX(x)
+
+ /* ptr types */
+-#if __have_longlong64
+-#define __PRIPTR(x) __STRINGIFY(ll##x)
+-#define __SCNPTR(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIPTR(x) __STRINGIFY(l##x)
+ #define __SCNPTR(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIPTR(x) __STRINGIFY(ll##x)
++#define __SCNPTR(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIPTR(x) __STRINGIFY(x)
+ #define __SCNPTR(x) __STRINGIFY(x)
+
+We don't want u?int32_t to be long as our code assume in a lot of places to be
+int.
+
+Index: newlib/libc/include/stdint.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
+retrieving revision 1.10
+diff -u -p -r1.10 stdint.h
+--- newlib/libc/include/stdint.h       16 Aug 2006 21:39:43 -0000      1.10
++++ newlib/libc/include/stdint.h       12 Feb 2008 13:07:52 -0000
+@@ -38,7 +38,7 @@ extern "C" {
+ #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+ #define __have_long64 1
+ #elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
+-#define __have_long32 1
++/* #define __have_long32 1 */
+ #endif
+
+ #if __STDINT_EXP(SCHAR_MAX) == 0x7f
+
+Define the basic ia64 jump buffer
+
+Index: newlib/libc/include/sys/config.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
+retrieving revision 1.47
+diff -u -p -r1.47 config.h
+--- newlib/libc/include/sys/config.h   15 Mar 2007 21:32:12 -0000      1.47
++++ newlib/libc/include/sys/config.h   8 Nov 2007 16:32:44 -0000
+@@ -71,6 +71,10 @@
+ #endif
+ #endif
+
++#ifndef __DYNAMIC_REENT__
++#define __DYNAMIC_REENT__
++#endif
++
+ #ifdef __mn10200__
+ #define __SMALL_BITFIELDS
+ #endif
+
+Dynamic pointer to our reentrancy zone
+
+Index: newlib/libc/reent/getreent.c
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v
+retrieving revision 1.2
+diff -u -p -r1.2 getreent.c
+--- newlib/libc/reent/getreent.c       7 Sep 2007 00:45:55 -0000       1.2
++++ newlib/libc/reent/getreent.c       8 Nov 2007 16:32:44 -0000
+@@ -3,12 +3,20 @@
+ #include <_ansi.h>
+ #include <reent.h>
+
++#define weak_alias(name, aliasname) \
++  extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
++
+ #ifdef __getreent
+ #undef __getreent
+ #endif
++#ifdef __libc_getreent
++#undef __libc_getreent
++#endif
+
+ struct _reent *
+-_DEFUN_VOID(__getreent)
++__libc_getreent (void)
+ {
+   return _impure_ptr;
+ }
++weak_alias(__libc_getreent,__getreent)
++
+
+We can't provide a red zone in mini-os.
+
+Index: newlib/libc/machine/x86_64/memcpy.S
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v
+retrieving revision 1.1
+diff -u -p -r1.1 memcpy.S
+--- newlib/libc/machine/x86_64/memcpy.S        28 Aug 2007 21:56:49 -0000      1.1
++++ newlib/libc/machine/x86_64/memcpy.S        8 Nov 2007 16:32:44 -0000
+@@ -30,10 +30,18 @@ quadword_aligned:
+   cmpq    $256, rdx
+   jb      quadword_copy
+
++#if 1
++  subq    $32, rsp
++  movq    rax, 24 (rsp)
++  movq    r12, 16 (rsp)
++  movq    r13, 8  (rsp)
++  movq    r14, 0  (rsp)
++#else
+   movq    rax, -8  (rsp)
+   movq    r12, -16 (rsp)
+   movq    r13, -24 (rsp)
+   movq    r14, -32 (rsp)
++#endif
+
+   movq    rdx, rcx                /* Copy 128 bytes at a time with minimum cache polution */
+   shrq    $7, rcx
+@@ -89,10 +97,18 @@ loop:
+   movq    rdx, rcx
+   andq    $127, rcx
+   rep     movsb
++#if 1
++  movq    24 (rsp), rax
++  movq    16 (rsp), r12
++  movq    8  (rsp), r13
++  movq    0  (rsp), r14
++  addq    $32, rsp
++#else
+   movq    -8  (rsp), rax
+   movq    -16 (rsp), r12
+   movq    -24 (rsp), r13
+   movq    -32 (rsp), r14
++#endif
+   ret
+
+
+--- newlib/libc/machine/x86_64/x86_64mach.h.orig       2008-07-11 14:57:23.062269000 +0100
++++ newlib/libc/machine/x86_64/x86_64mach.h    2008-07-11 14:58:01.262503000 +0100
+@@ -22,81 +22,81 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define rax REG(rax)
+-#define rbx REG(rbx)
+-#define rcx REG(rcx)
+-#define rdx REG(rdx)
+-#define rsi REG(rsi)
+-#define rdi REG(rdi)
+-#define rbp REG(rbp)
+-#define rsp REG(rsp)
+-
+-#define r8  REG(r8)
+-#define r9  REG(r9)
+-#define r10 REG(r10)
+-#define r11 REG(r11)
+-#define r12 REG(r12)
+-#define r13 REG(r13)
+-#define r14 REG(r14)
+-#define r15 REG(r15)
+-
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define sil REG(sil)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
+-
+-#define xmm0 REG(xmm0)
+-#define xmm1 REG(xmm1)
+-#define xmm2 REG(xmm2)
+-#define xmm3 REG(xmm3)
+-#define xmm4 REG(xmm4)
+-#define xmm5 REG(xmm5)
+-#define xmm6 REG(xmm6)
+-#define xmm7 REG(xmm7)
+-
+-#define cr0 REG(cr0)
+-#define cr1 REG(cr1)
+-#define cr2 REG(cr2)
+-#define cr3 REG(cr3)
+-#define cr4 REG(cr4)
++#define rax %rax
++#define rbx %rbx
++#define rcx %rcx
++#define rdx %rdx
++#define rsi %rsi
++#define rdi %rdi
++#define rbp %rbp
++#define rsp %rsp
++
++#define r8  %r8
++#define r9  %r9
++#define r10 %r10
++#define r11 %r11
++#define r12 %r12
++#define r13 %r13
++#define r14 %r14
++#define r15 %r15
++
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define sil %sil
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
++
++#define xmm0 %xmm0
++#define xmm1 %xmm1
++#define xmm2 %xmm2
++#define xmm3 %xmm3
++#define xmm4 %xmm4
++#define xmm5 %xmm5
++#define xmm6 %xmm6
++#define xmm7 %xmm7
++
++#define cr0 %cr0
++#define cr1 %cr1
++#define cr2 %cr2
++#define cr3 %cr3
++#define cr4 %cr4
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memcpy.S.orig   2008-07-11 15:12:27.494693000 +0100
++++ newlib/libc/machine/x86_64/memcpy.S        2008-07-11 15:12:29.448706000 +0100
+@@ -60,14 +60,14 @@
+   movq    48 (rsi), r13
+   movq    56 (rsi), r14
+
+-  movntiq rax,    (rdi)
+-  movntiq r8 ,  8 (rdi)
+-  movntiq r9 , 16 (rdi)
+-  movntiq r10, 24 (rdi)
+-  movntiq r11, 32 (rdi)
+-  movntiq r12, 40 (rdi)
+-  movntiq r13, 48 (rdi)
+-  movntiq r14, 56 (rdi)
++  movnti rax,    (rdi)
++  movnti r8 ,  8 (rdi)
++  movnti r9 , 16 (rdi)
++  movnti r10, 24 (rdi)
++  movnti r11, 32 (rdi)
++  movnti r12, 40 (rdi)
++  movnti r13, 48 (rdi)
++  movnti r14, 56 (rdi)
+
+   movq     64 (rsi), rax
+   movq     72 (rsi), r8
+@@ -78,14 +78,14 @@
+   movq    112 (rsi), r13
+   movq    120 (rsi), r14
+
+-  movntiq rax,  64 (rdi)
+-  movntiq r8 ,  72 (rdi)
+-  movntiq r9 ,  80 (rdi)
+-  movntiq r10,  88 (rdi)
+-  movntiq r11,  96 (rdi)
+-  movntiq r12, 104 (rdi)
+-  movntiq r13, 112 (rdi)
+-  movntiq r14, 120 (rdi)
++  movnti rax,  64 (rdi)
++  movnti r8 ,  72 (rdi)
++  movnti r9 ,  80 (rdi)
++  movnti r10,  88 (rdi)
++  movnti r11,  96 (rdi)
++  movnti r12, 104 (rdi)
++  movnti r13, 112 (rdi)
++  movnti r14, 120 (rdi)
+
+   leaq    128 (rsi), rsi
+   leaq    128 (rdi), rdi
+--- newlib/libc/machine/i386/i386mach.h        2000-08-28 18:50:06.000000000 +0100
++++ newlib/libc/machine/i386/i386mach.h        2008-07-11 15:17:13.874409000 +0100
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memset.S        2007-08-28 22:56:49.000000000 +0100
++++ newlib/libc/machine/x86_64/memset.S        2008-07-11 15:16:59.098320000 +0100
+@@ -40,22 +40,22 @@
+
+   .p2align 4
+ loop:
+-  movntiq rax,     (rdi)
+-  movntiq rax,   8 (rdi)
+-  movntiq rax,  16 (rdi)
+-  movntiq rax,  24 (rdi)
+-  movntiq rax,  32 (rdi)
+-  movntiq rax,  40 (rdi)
+-  movntiq rax,  48 (rdi)
+-  movntiq rax,  56 (rdi)
+-  movntiq rax,  64 (rdi)
+-  movntiq rax,  72 (rdi)
+-  movntiq rax,  80 (rdi)
+-  movntiq rax,  88 (rdi)
+-  movntiq rax,  96 (rdi)
+-  movntiq rax, 104 (rdi)
+-  movntiq rax, 112 (rdi)
+-  movntiq rax, 120 (rdi)
++  movnti rax,     (rdi)
++  movnti rax,   8 (rdi)
++  movnti rax,  16 (rdi)
++  movnti rax,  24 (rdi)
++  movnti rax,  32 (rdi)
++  movnti rax,  40 (rdi)
++  movnti rax,  48 (rdi)
++  movnti rax,  56 (rdi)
++  movnti rax,  64 (rdi)
++  movnti rax,  72 (rdi)
++  movnti rax,  80 (rdi)
++  movnti rax,  88 (rdi)
++  movnti rax,  96 (rdi)
++  movnti rax, 104 (rdi)
++  movnti rax, 112 (rdi)
++  movnti rax, 120 (rdi)
+
+   leaq    128 (rdi), rdi
+
+--- newlib/libm/machine/i386/i386mach.h.orig   2008-07-11 15:30:37.367227000 +0100
++++ newlib/libm/machine/i386/i386mach.h        2008-07-11 15:30:55.232337000 +0100
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+
+
+We want to have a 64bit offsets libc even on 32bit platforms.
+
+--- ./newlib/configure.host.orig       2008-08-07 16:01:17.801946000 +0100
++++ ./newlib/configure.host    2008-08-07 16:01:34.181064000 +0100
+@@ -317,6 +317,8 @@
+     oext=lo
+     lpfx=
+     aext=la ;;
++  i[34567]86-xen-elf)
++    stdio64_dir=stdio64 ;;
+   *) ;; #shared library not supported for ${host}
+ esac
+
+--- newlib/libc/include/sys/_types.h.orig      2008-08-07 15:22:44.925008000 +0100
++++ newlib/libc/include/sys/_types.h   2008-08-07 15:22:50.824044000 +0100
+@@ -13,8 +13,12 @@
+ #include <sys/lock.h>
+
+ #ifndef __off_t_defined
++#ifdef __MINIOS__
++typedef long long _off_t;
++#else
+ typedef long _off_t;
+ #endif
++#endif
+
+ #if defined(__rtems__)
+ /* device numbers are 32-bit major and and 32-bit minor */
+--- ./newlib/libc/include/sys/config.h.orig    2008-08-07 14:43:25.915866000 +0100
++++ ./newlib/libc/include/sys/config.h 2008-08-07 14:44:13.508154000 +0100
+@@ -69,6 +69,10 @@
+ /* we use some glibc header files so turn on glibc large file feature */
+ #define _LARGEFILE64_SOURCE 1
+ #endif
++#ifdef __MINIOS__
++#define __LARGE64_FILES 1
++#define _LARGEFILE64_SOURCE 1
++#endif
+ #endif
+
+ #ifndef __DYNAMIC_REENT__
+--- ./newlib/libc/include/sys/_default_fcntl.h.orig    2008-08-07 15:08:22.377836000 +0100
++++ ./newlib/libc/include/sys/_default_fcntl.h 2008-08-07 15:08:31.651890000 +0100
+@@ -170,7 +170,11 @@
+ /* Provide _<systemcall> prototypes for functions provided by some versions
+    of newlib.  */
+ #ifdef _COMPILING_NEWLIB
+-extern int _open _PARAMS ((const char *, int, ...));
++extern int _open _PARAMS ((const char *, int, ...))
++#ifdef __MINIOS__
++    asm("open64")
++#endif
++    ;
+ extern int _fcntl _PARAMS ((int, int, ...));
+ #ifdef __LARGE64_FILES
+ extern int _open64 _PARAMS ((const char *, int, ...));
+--- ./newlib/libc/include/sys/unistd.h.orig    2008-08-07 15:09:36.449280000 +0100
++++ ./newlib/libc/include/sys/unistd.h 2008-08-07 15:09:51.210370000 +0100
+@@ -101,7 +101,11 @@
+ int     _EXFUN(link, (const char *__path1, const char *__path2 ));
+ int   _EXFUN(nice, (int __nice_value ));
+ #if !defined(__INSIDE_CYGWIN__)
+-off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
++off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ))
++#ifdef __MINIOS__
++    asm("lseek64")
++#endif
++    ;
+ #endif
+ #if defined(__SPU__)
+ #define F_ULOCK       0
+--- ./newlib/libc/include/sys/stat.h.orig      2008-08-07 16:08:50.495116000 +0100
++++ ./newlib/libc/include/sys/stat.h   2008-08-07 16:10:21.799753000 +0100
+@@ -49,6 +49,9 @@
+   long        st_spare4[2];
+ #endif
+ };
++#ifdef __MINIOS__
++#define stat64 stat
++#endif
+ #endif
+
+ #define       _IFMT           0170000 /* type of file */
+@@ -132,7 +135,11 @@
+ /* Provide prototypes for most of the _<systemcall> names that are
+    provided in newlib for some compilers.  */
+ #ifdef _COMPILING_NEWLIB
+-int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
++int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ))
++#ifdef __MINIOS__
++    asm("fstat64")
++#endif
++    ;
+ int   _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
+ #ifdef __LARGE64_FILES
+ struct stat64;
+--- ./newlib/libc/include/_syslist.h.orig      2008-08-07 16:24:19.122605000 +0100
++++ ./newlib/libc/include/_syslist.h   2008-08-07 16:24:21.548628000 +0100
+@@ -14,6 +14,7 @@
+ #define _kill kill
+ #define _link link
+ #define _lseek lseek
++#define _lseek64 lseek64
+ #define _open open
+ #define _read read
+ #define _sbrk sbrk
+--- newlib/libc/include/reent.h.orig   2008-08-07 16:28:49.846502000 +0100
++++ newlib/libc/include/reent.h        2008-08-07 16:29:02.096586000 +0100
+@@ -87,6 +87,9 @@
+ #if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB)
+ #define stat64 __stat64
+ #endif
++#if defined(__MINIOS__)
++#define stat64 stat
++#endif
+
+ struct stat64;
+
recipes-extended/xen/newlib.inc new file +64 -0
new file mode 100644
index 0000000..32d79aa
@@ -0,0 +1,64 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+CPPFLAGS_INCLUDE_DIR = "-isystem `${HOST_PREFIX}gcc -print-file-name=include`"
+STUBDOM_CFLAGS += "-D_I386MACH_ALLOW_HW_INTERRUPTS"
+
+export ac_cv_path_CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"
+export CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"
+
+export ac_cv_path_CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}"
+export CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}"
+export CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+export LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_AS_FOR_TARGET="${HOST_PREFIX}as"
+export AS_FOR_TARGET="${HOST_PREFIX}as"
+
+export ac_cv_path_AR_FOR_TARGET="${HOST_PREFIX}ar"
+export AR_FOR_TARGET="${HOST_PREFIX}ar"
+
+export ac_cv_path_NM_FOR_TARGET="${HOST_PREFIX}nm"
+export NM_FOR_TARGET="${HOST_PREFIX}nm"
+
+export ac_cv_path_RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+
+export ac_cv_path_OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+export OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+
+export ac_cv_path_OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+export OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+
+export ac_cv_path_STRIP_FOR_TARGET="${HOST_PREFIX}strip"
+export STRIP_FOR_TARGET="${HOST_PREFIX}strip"
+
+export ac_cv_path_STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+export STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+
+export ac_cv_path_READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+export READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+
+do_configure() {
+    ${S}/configure --verbose --prefix=${prefix} --target=${GNU_TARGET_ARCH}-xen-elf --enable-newlib-io-long-long --disable-multilib
+    find ${S} -type f | xargs perl -i.bak -pe 's/\b_(tzname|daylight|timezone)\b/$1/g'
+}
+
+do_compile() {
+    ${MAKE}
+}
+
+do_install() {
+    ${MAKE} DESTDIR=${D} install
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/share
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/info
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdarg.h -t ${D}/${includedir}
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stddef.h -t ${D}/${includedir}
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdbool.h -t ${D}/${includedir}
+}
recipes-extended/xen/newlib_1.16.0.bb new file +6 -0
new file mode 100644
index 0000000..ea80271
@@ -0,0 +1,19 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Newlib is a C library intended for use on embedded systems."
+HOMEPAGE = "http://sourceware.org/newlib"
+LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
Quoted 8 lines

recipes-extended/xen/newlib_1.16.0.bb line 8

Quoted 2 lines
recipes-extended/xen/newlib_1.16.0.bb new file +2 -0
+LIC_FILES_CHKSUM = "file://COPYING.NEWLIB;md5=950f50b290e8fcf7a2d3fff61775de9b"
+

I see newlib in a few other oe layers, but nothing that looks to be common. For my
own understanding (and when someone asks me about this), is there any significant
difference in this newlib implementation/build than you'd find in other newlib use cases ?

This version is old 2008, the latest is 3.0 but not sure if this Xen solution needs 1.7.

- armin

Quoted 41 lines

recipes-extended/xen/newlib_1.16.0.bb line 13

Quoted 6 lines
recipes-extended/xen/newlib_1.16.0.bb new file +5 -0
+S="${WORKDIR}/newlib"
+B="${WORKDIR}/build"
+
+SRC_URI += "\
+    git://sourceware.org/git/newlib-cygwin.git;protocol=git;rev=newlib-${TRANSLATED_PV};destsuffix=newlib;nobranch=1;name=newlib \

Using tags for SRCREVs is generally frowned upon. Is that what this is doing ? Even if you want to
use the convenience variable you created, it would still be better to explicitly set SRCREV in the
recipes for easier maintenance and to make things more obvious.

recipes-extended/xen/newlib_1.16.0.bb line 15

Quoted 2 lines
recipes-extended/xen/newlib_1.16.0.bb new file +2 -0
+    file://newlib.patch;striplevel=0 \
+    file://newlib-chk.patch;striplevel=0 \

We really shouldn't be specifying striplevel on the patches. Why aren't the patches being
generated in a way that makes then consistent, and that can be applied with the defaults ?

Bruce

Quoted 18 lines
recipes-extended/xen/newlib_1.16.0.bb new file +4 -1
+    file://newlib-stdint-size_max-fix-from-1.17.0.patch;striplevel=1 \
+"
+
+require newlib.inc
--

2.14.2

--

*This email and all attachments are considered confidential and the proprietary information of BrainTrust Holdings. Unauthorized disclosure is prohibited. *
--
_______________________________________________
meta-virtualization mailing list [email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

#10 lore raw

Re: [PATCH 3/7] xen: Newlib recipe and patches for Xen stubdoms

The Xen source tree is hardcoded to pull old versions of the necessary dependencies for building various stubdomains. Stubdomains have not been tested using any newer versions of this or any other dependency. I suppose that is work for us to do once the initial baseline for vTPMs has been set.

Kurt

Quoted 1,187 lines · akuster
Quoted 16 lines · Bruce Ashfield
Quoted 14 lines · Kurt Bodiker

From: kebodiker <[email protected]>

Newlib provides a fast, C library optimized for embedded systems. In the case of Xen stubdomains, we are using MiniOS. This Newlib recipe creates static libraries that are cross-compiled against MiniOS, Xen, and LWIP headers and subsequently used during the cross-compilation and linking of PolarSSL, the stubdom specific GMP, 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. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

Quoted 5 lines
Quoted 5 lines
---
 recipes-extended/xen/files/newlib-chk.patch        | 155 +++++
 .../newlib-stdint-size_max-fix-from-1.17.0.patch   |  16 +
 recipes-extended/xen/files/newlib.patch            | 727

+++++++++++++++++++++

Quoted 5 lines
Quoted 5 lines
 recipes-extended/xen/newlib.inc                    |  64 ++
 recipes-extended/xen/newlib_1.16.0.bb              |  19 +
 5 files changed, 981 insertions(+)
 create mode 100644 recipes-extended/xen/files/newlib-chk.patch
 create mode 100644 recipes-extended/xen/files/

newlib-stdint-size_max-fix-from-1.17.0.patch

Quoted 5 lines

Review

Quoted 5 lines
 create mode 100644 recipes-extended/xen/files/newlib.patch
 create mode 100644 recipes-extended/xen/newlib.inc
 create mode 100644 recipes-extended/xen/newlib_1.16.0.bb
(quoted diff) +0 -0

b/recipes-extended/xen/files/newlib-chk.patch

Quoted 6 lines

recipes-extended/xen/files/newlib-chk.patch line 1

Quoted 6 lines

new file mode 100644
index 0000000..848dbd5

recipes-extended/xen/files/newlib-chk.patch new file +1 -0
@@ -0,0 +1,155 @@
+--- newlib/libc/stdio/fprintf_chk.c    1969-12-31 19:00:00.000000000

-0500

Quoted 1 line

recipes-extended/xen/files/newlib-chk.patch line 2

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/fprintf_chk.c    2009-02-26 19:02:53.000000000

-0500

Quoted 7 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 7 lines
recipes-extended/xen/files/newlib-chk.patch new file +7 -0
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __fprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It

just makes

Quoted 8 lines
Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +8 -0
++ * the linker happy :)
++*/
++int
++__fprintf_chk (FILE *fp, int flag, const char *format, ...)
++{
++  va_list ap;
++  int done;
++
Quoted 8 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +8 -0
++  va_start (ap, format);
++  done = vfprintf (fp, format, ap);
++  va_end (ap);
++
++  return done;
++}
++
+--- newlib/libc/stdio/Makefile.am      2007-08-02 16:23:06.000000000

-0400

Quoted 1 line

recipes-extended/xen/files/newlib-chk.patch line 26

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/Makefile.am      2009-02-26 18:14:53.000000000

-0500

Quoted 9 lines
Quoted 9 lines
recipes-extended/xen/files/newlib-chk.patch new file +9 -0
+@@ -20,6 +20,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c           \
+       fputc.c                 \
+       fputs.c                 \
+       fread.c                 \
+@@ -65,6 +66,7 @@
Quoted 8 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +8 -0
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+--- newlib/libc/stdio/Makefile.in      2007-12-19 17:36:38.000000000

-0500

Quoted 1 line

recipes-extended/xen/files/newlib-chk.patch line 44

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/Makefile.in      2009-02-26 18:43:52.000000000

-0500

Quoted 17 lines
Quoted 17 lines
recipes-extended/xen/files/newlib-chk.patch new file +17 -0
+@@ -63,7 +63,8 @@
+       lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
+       lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
+       lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
+-      lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
++      lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
++      lib_a-fputc.$(OBJEXT) \
+       lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
+       lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
+       lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
+@@ -86,6 +87,7 @@
+       lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
+       lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
+       lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
++      lib_a-sprintf_chk.$(OBJEXT) \
+       lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
+       lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
Quoted 8 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +8 -0
+       lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
+@@ -122,15 +124,15 @@
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
+       fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
+-      fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
+-      fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
++      fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo

fputc.lo \

Quoted 1 line

recipes-extended/xen/files/newlib-chk.patch line 70

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++      fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo

fsetpos.lo \

Quoted 8 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +8 -0
+       ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
+       getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
+       iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
+       putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
+       rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
+       setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
+-      sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
++      sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo

stdio.lo \

Quoted 22 lines
Quoted 22 lines
recipes-extended/xen/files/newlib-chk.patch new file +22 -0
+       tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
+       viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
+       vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
+@@ -344,6 +346,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c                   \
+       fputc.c                 \
+       fputs.c                 \
+       fread.c                 \
+@@ -389,6 +392,7 @@
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+@@ -508,6 +512,7 @@
+       siprintf.def            \
+       siscanf.def             \
Quoted 8 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +8 -0
+       sprintf.def             \
++      sprintf_chk.def         \
+       sscanf.def              \
+       tmpfile.def             \
+       tmpnam.def              \
+@@ -678,6 +683,12 @@
+ lib_a-fprintf.obj: fprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi

Quoted 3 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
+
++lib_a-fprintf_chk.o: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o test -f 'fprintf_chk.c' || echo '$(srcdir)/'fprintf_chk.c

Quoted 3 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
++lib_a-fprintf_chk.obj: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi

Quoted 3 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
+ lib_a-fputc.o: fputc.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o test -f 'fputc.c' || echo '$(srcdir)/'fputc.c

Quoted 4 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 4 lines
recipes-extended/xen/files/newlib-chk.patch new file +4 -0
+
+@@ -948,6 +959,12 @@
+ lib_a-sprintf.obj: sprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi

Quoted 3 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
+
++lib_a-sprintf_chk.o: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o test -f 'sprintf_chk.c' || echo '$(srcdir)/'sprintf_chk.c

Quoted 3 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
++lib_a-sprintf_chk.obj: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi

Quoted 3 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
+ lib_a-sscanf.o: sscanf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o test -f 'sscanf.c' || echo '$(srcdir)/'sscanf.c

Quoted 2 lines

recipes-extended/xen/files/newlib-chk.patch line 132

Quoted 2 lines
recipes-extended/xen/files/newlib-chk.patch new file +2 -0
+
+--- newlib/libc/stdio/sprintf_chk.c    1969-12-31 19:00:00.000000000

-0500

Quoted 1 line

recipes-extended/xen/files/newlib-chk.patch line 133

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/sprintf_chk.c    2009-02-26 19:02:26.000000000

-0500

Quoted 7 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 7 lines
recipes-extended/xen/files/newlib-chk.patch new file +7 -0
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __sprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It

just makes

Quoted 4 lines

recipes-extended/xen/files/newlib-chk.patch

Quoted 4 lines
recipes-extended/xen/files/newlib-chk.patch new file +4 -0
++ * the linker happy :)
++*/
++int
++__sprintf_chk (char *s, int flags, size_t slen, const char *format,

...)

Quoted 4 lines
Quoted 4 lines
recipes-extended/xen/files/newlib-chk.patch new file +4 -0
++{
++  va_list arg;
++  int done;
++
Quoted 8 lines

Review

Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +7 -0
++  va_start (arg, format);
++  done = vsprintf (s, format, arg);
++  va_end (arg);
++
++  return done;
++}
++
(quoted diff) +0 -0

b/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch

Quoted 4 lines

recipes-extended/xen/files/newlib-stdint-size_max-fix-

Quoted 4 lines

new file mode 100644
index 0000000..1054a07

recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +0 -0

from-1.17.0.patch

Quoted 2 lines

recipes-extended/xen/files/newlib-stdint-size_max-fix- line 1

Quoted 2 lines
recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +1 -0
@@ -0,0 +1,16 @@
+--- newlib-1.16.0/newlib/libc/include/stdint.h.orig    2006-08-17

00:39:43.000000000 +0300

Quoted 1 line

recipes-extended/xen/files/newlib-stdint-size_max-fix- line 2

Quoted 1 line
recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +1 -0
++++ newlib-1.16.0/newlib/libc/include/stdint.h 2009-08-25

17:33:23.000000000 +0300

Quoted 7 lines
Quoted 7 lines
recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +7 -0
+@@ -348,8 +348,11 @@
+ #endif
+
+ /* This must match size_t in stddef.h, currently long unsigned int */
+-#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
+-#define SIZE_MAX __STDINT_EXP(LONG_MAX)
++#ifdef __SIZE_MAX__
Quoted 8 lines

Review

Quoted 8 lines
recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +7 -0
++#define SIZE_MAX __SIZE_MAX__
++#else
++#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
++#endif
+
+ /* This must match sig_atomic_t in <signal.h> (currently int) */
+ #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
(quoted diff) +0 -0

b/recipes-extended/xen/files/newlib.patch

Quoted 5 lines
Quoted 5 lines

new file mode 100644
index 0000000..ee9b6f2

recipes-extended/xen/files/newlib.patch new file +0 -0
@@ -0,0 +1,727 @@
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+There is a mix between longs and long longs.
+
+Index: newlib/libc/include/inttypes.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v
+retrieving revision 1.3
+diff -u -p -r1.3 inttypes.h
+--- newlib/libc/include/inttypes.h     16 Dec 2005 19:03:12 -0000

1.3

Quoted 46 lines
Quoted 46 lines
recipes-extended/xen/files/newlib.patch new file +46 -0
++++ newlib/libc/include/inttypes.h     8 Nov 2007 16:32:44 -0000
+@@ -163,12 +163,12 @@
+
+
+ /* 64-bit types */
+-#if __have_longlong64
+-#define __PRI64(x) __STRINGIFY(ll##x)
+-#define __SCN64(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRI64(x) __STRINGIFY(l##x)
+ #define __SCN64(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRI64(x) __STRINGIFY(ll##x)
++#define __SCN64(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRI64(x) __STRINGIFY(x)
+ #define __SCN64(x) __STRINGIFY(x)
+@@ -217,12 +217,12 @@
+ #endif
+
+ /* max-bit types */
+-#if __have_longlong64
+-#define __PRIMAX(x) __STRINGIFY(ll##x)
+-#define __SCNMAX(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIMAX(x) __STRINGIFY(l##x)
+ #define __SCNMAX(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIMAX(x) __STRINGIFY(ll##x)
++#define __SCNMAX(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIMAX(x) __STRINGIFY(x)
+ #define __SCNMAX(x) __STRINGIFY(x)
+@@ -242,12 +242,12 @@
+ #define SCNxMAX               __SCNMAX(x)
+
+ /* ptr types */
+-#if __have_longlong64
+-#define __PRIPTR(x) __STRINGIFY(ll##x)
+-#define __SCNPTR(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIPTR(x) __STRINGIFY(l##x)
+ #define __SCNPTR(x) __STRINGIFY(l##x)
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#elif __have_longlong64
++#define __PRIPTR(x) __STRINGIFY(ll##x)
++#define __SCNPTR(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIPTR(x) __STRINGIFY(x)
+ #define __SCNPTR(x) __STRINGIFY(x)
+
+We don't want u?int32_t to be long as our code assume in a lot of

places to be

Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+int.
+
+Index: newlib/libc/include/stdint.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
+retrieving revision 1.10
+diff -u -p -r1.10 stdint.h
+--- newlib/libc/include/stdint.h       16 Aug 2006 21:39:43 -0000

1.10

Quoted 11 lines
Quoted 11 lines
recipes-extended/xen/files/newlib.patch new file +11 -0
++++ newlib/libc/include/stdint.h       12 Feb 2008 13:07:52 -0000
+@@ -38,7 +38,7 @@ extern "C" {
+ #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+ #define __have_long64 1
+ #elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
+-#define __have_long32 1
++/* #define __have_long32 1 */
+ #endif
+
+ #if __STDINT_EXP(SCHAR_MAX) == 0x7f
+
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+Define the basic ia64 jump buffer
+
+Index: newlib/libc/include/sys/config.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
+retrieving revision 1.47
+diff -u -p -r1.47 config.h
+--- newlib/libc/include/sys/config.h   15 Mar 2007 21:32:12 -0000

1.47

Quoted 13 lines
Quoted 13 lines
recipes-extended/xen/files/newlib.patch new file +13 -0
++++ newlib/libc/include/sys/config.h   8 Nov 2007 16:32:44 -0000
+@@ -71,6 +71,10 @@
+ #endif
+ #endif
+
++#ifndef __DYNAMIC_REENT__
++#define __DYNAMIC_REENT__
++#endif
++
+ #ifdef __mn10200__
+ #define __SMALL_BITFIELDS
+ #endif
+
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+Dynamic pointer to our reentrancy zone
+
+Index: newlib/libc/reent/getreent.c
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v
+retrieving revision 1.2
+diff -u -p -r1.2 getreent.c
+--- newlib/libc/reent/getreent.c       7 Sep 2007 00:45:55 -0000

1.2

Quoted 7 lines

recipes-extended/xen/files/newlib.patch

Quoted 7 lines
recipes-extended/xen/files/newlib.patch new file +7 -0
++++ newlib/libc/reent/getreent.c       8 Nov 2007 16:32:44 -0000
+@@ -3,12 +3,20 @@
+ #include <_ansi.h>
+ #include <reent.h>
+
++#define weak_alias(name, aliasname) \
++  extern __typeof (name) aliasname __attribute__ ((weak, alias

(#name)));

Quoted 17 lines
Quoted 17 lines
recipes-extended/xen/files/newlib.patch new file +17 -0
++
+ #ifdef __getreent
+ #undef __getreent
+ #endif
++#ifdef __libc_getreent
++#undef __libc_getreent
++#endif
+
+ struct _reent *
+-_DEFUN_VOID(__getreent)
++__libc_getreent (void)
+ {
+   return _impure_ptr;
+ }
++weak_alias(__libc_getreent,__getreent)
++
+
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+We can't provide a red zone in mini-os.
+
+Index: newlib/libc/machine/x86_64/memcpy.S
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v
+retrieving revision 1.1
+diff -u -p -r1.1 memcpy.S
+--- newlib/libc/machine/x86_64/memcpy.S        28 Aug 2007 21:56:49

-0000 1.1

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 143

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/memcpy.S        8 Nov 2007 16:32:44

-0000

Quoted 10 lines
Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+@@ -30,10 +30,18 @@ quadword_aligned:
+   cmpq    $256, rdx
+   jb      quadword_copy
+
++#if 1
++  subq    $32, rsp
++  movq    rax, 24 (rsp)
++  movq    r12, 16 (rsp)
++  movq    r13, 8  (rsp)
++  movq    r14, 0  (rsp)
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#else
+   movq    rax, -8  (rsp)
+   movq    r12, -16 (rsp)
+   movq    r13, -24 (rsp)
+   movq    r14, -32 (rsp)
++#endif
+
+   movq    rdx, rcx                /* Copy 128 bytes at a time with

minimum cache polution */

Quoted 13 lines
Quoted 13 lines
recipes-extended/xen/files/newlib.patch new file +13 -0
+   shrq    $7, rcx
+@@ -89,10 +97,18 @@ loop:
+   movq    rdx, rcx
+   andq    $127, rcx
+   rep     movsb
++#if 1
++  movq    24 (rsp), rax
++  movq    16 (rsp), r12
++  movq    8  (rsp), r13
++  movq    0  (rsp), r14
++  addq    $32, rsp
++#else
+   movq    -8  (rsp), rax
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+   movq    -16 (rsp), r12
+   movq    -24 (rsp), r13
+   movq    -32 (rsp), r14
++#endif
+   ret
+
+
+--- newlib/libc/machine/x86_64/x86_64mach.h.orig       2008-07-11

14:57:23.062269000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 183

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/x86_64mach.h    2008-07-11

14:58:01.262503000 +0100

Quoted 150 lines
Quoted 150 lines
recipes-extended/xen/files/newlib.patch new file +150 -0
+@@ -22,81 +22,81 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define rax REG(rax)
+-#define rbx REG(rbx)
+-#define rcx REG(rcx)
+-#define rdx REG(rdx)
+-#define rsi REG(rsi)
+-#define rdi REG(rdi)
+-#define rbp REG(rbp)
+-#define rsp REG(rsp)
+-
+-#define r8  REG(r8)
+-#define r9  REG(r9)
+-#define r10 REG(r10)
+-#define r11 REG(r11)
+-#define r12 REG(r12)
+-#define r13 REG(r13)
+-#define r14 REG(r14)
+-#define r15 REG(r15)
+-
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define sil REG(sil)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
+-
+-#define xmm0 REG(xmm0)
+-#define xmm1 REG(xmm1)
+-#define xmm2 REG(xmm2)
+-#define xmm3 REG(xmm3)
+-#define xmm4 REG(xmm4)
+-#define xmm5 REG(xmm5)
+-#define xmm6 REG(xmm6)
+-#define xmm7 REG(xmm7)
+-
+-#define cr0 REG(cr0)
+-#define cr1 REG(cr1)
+-#define cr2 REG(cr2)
+-#define cr3 REG(cr3)
+-#define cr4 REG(cr4)
++#define rax %rax
++#define rbx %rbx
++#define rcx %rcx
++#define rdx %rdx
++#define rsi %rsi
++#define rdi %rdi
++#define rbp %rbp
++#define rsp %rsp
++
++#define r8  %r8
++#define r9  %r9
++#define r10 %r10
++#define r11 %r11
++#define r12 %r12
++#define r13 %r13
++#define r14 %r14
++#define r15 %r15
++
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define sil %sil
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
++
++#define xmm0 %xmm0
++#define xmm1 %xmm1
++#define xmm2 %xmm2
++#define xmm3 %xmm3
++#define xmm4 %xmm4
++#define xmm5 %xmm5
++#define xmm6 %xmm6
++#define xmm7 %xmm7
++
++#define cr0 %cr0
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#define cr1 %cr1
++#define cr2 %cr2
++#define cr3 %cr3
++#define cr4 %cr4
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memcpy.S.orig   2008-07-11

15:12:27.494693000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 342

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/memcpy.S        2008-07-11

15:12:29.448706000 +0100

Quoted 39 lines
Quoted 39 lines
recipes-extended/xen/files/newlib.patch new file +39 -0
+@@ -60,14 +60,14 @@
+   movq    48 (rsi), r13
+   movq    56 (rsi), r14
+
+-  movntiq rax,    (rdi)
+-  movntiq r8 ,  8 (rdi)
+-  movntiq r9 , 16 (rdi)
+-  movntiq r10, 24 (rdi)
+-  movntiq r11, 32 (rdi)
+-  movntiq r12, 40 (rdi)
+-  movntiq r13, 48 (rdi)
+-  movntiq r14, 56 (rdi)
++  movnti rax,    (rdi)
++  movnti r8 ,  8 (rdi)
++  movnti r9 , 16 (rdi)
++  movnti r10, 24 (rdi)
++  movnti r11, 32 (rdi)
++  movnti r12, 40 (rdi)
++  movnti r13, 48 (rdi)
++  movnti r14, 56 (rdi)
+
+   movq     64 (rsi), rax
+   movq     72 (rsi), r8
+@@ -78,14 +78,14 @@
+   movq    112 (rsi), r13
+   movq    120 (rsi), r14
+
+-  movntiq rax,  64 (rdi)
+-  movntiq r8 ,  72 (rdi)
+-  movntiq r9 ,  80 (rdi)
+-  movntiq r10,  88 (rdi)
+-  movntiq r11,  96 (rdi)
+-  movntiq r12, 104 (rdi)
+-  movntiq r13, 112 (rdi)
+-  movntiq r14, 120 (rdi)
++  movnti rax,  64 (rdi)
++  movnti r8 ,  72 (rdi)
++  movnti r9 ,  80 (rdi)
++  movnti r10,  88 (rdi)
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++  movnti r11,  96 (rdi)
++  movnti r12, 104 (rdi)
++  movnti r13, 112 (rdi)
++  movnti r14, 120 (rdi)
+
+   leaq    128 (rsi), rsi
+   leaq    128 (rdi), rdi
+--- newlib/libc/machine/i386/i386mach.h        2000-08-28

18:50:06.000000000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 390

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/i386/i386mach.h        2008-07-11

15:17:13.874409000 +0100

Quoted 80 lines
Quoted 80 lines
recipes-extended/xen/files/newlib.patch new file +80 -0
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memset.S        2007-08-28

22:56:49.000000000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 479

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/memset.S        2008-07-11

15:16:59.098320000 +0100

Quoted 32 lines
Quoted 32 lines
recipes-extended/xen/files/newlib.patch new file +32 -0
+@@ -40,22 +40,22 @@
+
+   .p2align 4
+ loop:
+-  movntiq rax,     (rdi)
+-  movntiq rax,   8 (rdi)
+-  movntiq rax,  16 (rdi)
+-  movntiq rax,  24 (rdi)
+-  movntiq rax,  32 (rdi)
+-  movntiq rax,  40 (rdi)
+-  movntiq rax,  48 (rdi)
+-  movntiq rax,  56 (rdi)
+-  movntiq rax,  64 (rdi)
+-  movntiq rax,  72 (rdi)
+-  movntiq rax,  80 (rdi)
+-  movntiq rax,  88 (rdi)
+-  movntiq rax,  96 (rdi)
+-  movntiq rax, 104 (rdi)
+-  movntiq rax, 112 (rdi)
+-  movntiq rax, 120 (rdi)
++  movnti rax,     (rdi)
++  movnti rax,   8 (rdi)
++  movnti rax,  16 (rdi)
++  movnti rax,  24 (rdi)
++  movnti rax,  32 (rdi)
++  movnti rax,  40 (rdi)
++  movnti rax,  48 (rdi)
++  movnti rax,  56 (rdi)
++  movnti rax,  64 (rdi)
++  movnti rax,  72 (rdi)
++  movnti rax,  80 (rdi)
++  movnti rax,  88 (rdi)
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++  movnti rax,  96 (rdi)
++  movnti rax, 104 (rdi)
++  movnti rax, 112 (rdi)
++  movnti rax, 120 (rdi)
+
+   leaq    128 (rdi), rdi
+
+--- newlib/libm/machine/i386/i386mach.h.orig   2008-07-11

15:30:37.367227000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 520

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libm/machine/i386/i386mach.h        2008-07-11

15:30:55.232337000 +0100

Quoted 84 lines
Quoted 84 lines
recipes-extended/xen/files/newlib.patch new file +84 -0
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+
+
+We want to have a 64bit offsets libc even on 32bit platforms.
+
+--- ./newlib/configure.host.orig       2008-08-07 16:01:17.801946000

+0100

Quoted 11 lines

recipes-extended/xen/files/newlib.patch

Quoted 11 lines
recipes-extended/xen/files/newlib.patch new file +11 -0
++++ ./newlib/configure.host    2008-08-07 16:01:34.181064000 +0100
+@@ -317,6 +317,8 @@
+     oext=lo
+     lpfx=
+     aext=la ;;
++  i[34567]86-xen-elf)
++    stdio64_dir=stdio64 ;;
+   *) ;; #shared library not supported for ${host}
+ esac
+
+--- newlib/libc/include/sys/_types.h.orig      2008-08-07

15:22:44.925008000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 624

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/include/sys/_types.h   2008-08-07 15:22:50.824044000

+0100

Quoted 6 lines
Quoted 6 lines
recipes-extended/xen/files/newlib.patch new file +6 -0
+@@ -13,8 +13,12 @@
+ #include <sys/lock.h>
+
+ #ifndef __off_t_defined
++#ifdef __MINIOS__
++typedef long long _off_t;
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#else
+ typedef long _off_t;
+ #endif
++#endif
+
+ #if defined(__rtems__)
+ /* device numbers are 32-bit major and and 32-bit minor */
+--- ./newlib/libc/include/sys/config.h.orig    2008-08-07

14:43:25.915866000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 639

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/config.h 2008-08-07 14:44:13.508154000

+0100

Quoted 2 lines

recipes-extended/xen/files/newlib.patch line 641

Quoted 2 lines
recipes-extended/xen/files/newlib.patch new file +2 -0
+@@ -69,6 +69,10 @@
+ /* we use some glibc header files so turn on glibc large file feature

*/

Quoted 10 lines

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+ #define _LARGEFILE64_SOURCE 1
+ #endif
++#ifdef __MINIOS__
++#define __LARGE64_FILES 1
++#define _LARGEFILE64_SOURCE 1
++#endif
+ #endif
+
+ #ifndef __DYNAMIC_REENT__
+--- ./newlib/libc/include/sys/_default_fcntl.h.orig    2008-08-07

15:08:22.377836000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 652

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/_default_fcntl.h 2008-08-07

15:08:31.651890000 +0100

Quoted 2 lines

recipes-extended/xen/files/newlib.patch line 654

Quoted 2 lines
recipes-extended/xen/files/newlib.patch new file +2 -0
+@@ -170,7 +170,11 @@
+ /* Provide _<systemcall> prototypes for functions provided by some

versions

Quoted 4 lines
Quoted 4 lines
recipes-extended/xen/files/newlib.patch new file +4 -0
+    of newlib.  */
+ #ifdef _COMPILING_NEWLIB
+-extern int _open _PARAMS ((const char *, int, ...));
++extern int _open _PARAMS ((const char *, int, ...))
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#ifdef __MINIOS__
++    asm("open64")
++#endif
++    ;
+ extern int _fcntl _PARAMS ((int, int, ...));
+ #ifdef __LARGE64_FILES
+ extern int _open64 _PARAMS ((const char *, int, ...));
+--- ./newlib/libc/include/sys/unistd.h.orig    2008-08-07

15:09:36.449280000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 667

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/unistd.h 2008-08-07 15:09:51.210370000

+0100

Quoted 6 lines
Quoted 6 lines
recipes-extended/xen/files/newlib.patch new file +6 -0
+@@ -101,7 +101,11 @@
+ int     _EXFUN(link, (const char *__path1, const char *__path2 ));
+ int   _EXFUN(nice, (int __nice_value ));
+ #if !defined(__INSIDE_CYGWIN__)
+-off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
++off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ))
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#ifdef __MINIOS__
++    asm("lseek64")
++#endif
++    ;
+ #endif
+ #if defined(__SPU__)
+ #define F_ULOCK       0
+--- ./newlib/libc/include/sys/stat.h.orig      2008-08-07

16:08:50.495116000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 682

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/stat.h   2008-08-07 16:10:21.799753000

+0100

Quoted 16 lines
Quoted 16 lines
recipes-extended/xen/files/newlib.patch new file +16 -0
+@@ -49,6 +49,9 @@
+   long        st_spare4[2];
+ #endif
+ };
++#ifdef __MINIOS__
++#define stat64 stat
++#endif
+ #endif
+
+ #define       _IFMT           0170000 /* type of file */
+@@ -132,7 +135,11 @@
+ /* Provide prototypes for most of the _<systemcall> names that are
+    provided in newlib for some compilers.  */
+ #ifdef _COMPILING_NEWLIB
+-int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
++int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ))
Quoted 8 lines

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
++#ifdef __MINIOS__
++    asm("fstat64")
++#endif
++    ;
+ int   _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
+ #ifdef __LARGE64_FILES
+ struct stat64;
+--- ./newlib/libc/include/_syslist.h.orig      2008-08-07

16:24:19.122605000 +0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 707

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/_syslist.h   2008-08-07 16:24:21.548628000

+0100

Quoted 9 lines

recipes-extended/xen/files/newlib.patch

Quoted 9 lines
recipes-extended/xen/files/newlib.patch new file +9 -0
+@@ -14,6 +14,7 @@
+ #define _kill kill
+ #define _link link
+ #define _lseek lseek
++#define _lseek64 lseek64
+ #define _open open
+ #define _read read
+ #define _sbrk sbrk
+--- newlib/libc/include/reent.h.orig   2008-08-07 16:28:49.846502000

+0100

Quoted 1 line

recipes-extended/xen/files/newlib.patch line 717

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/include/reent.h        2008-08-07 16:29:02.096586000

+0100

Quoted 11 lines

Review

Quoted 11 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+@@ -87,6 +87,9 @@
+ #if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB)
+ #define stat64 __stat64
+ #endif
++#if defined(__MINIOS__)
++#define stat64 stat
++#endif
+
+ struct stat64;
+
(quoted diff) +0 -0

b/recipes-extended/xen/newlib.inc

Quoted 11 lines

recipes-extended/xen/newlib.inc line 6

Quoted 11 lines

new file mode 100644
index 0000000..32d79aa

recipes-extended/xen/newlib.inc new file +6 -0
@@ -0,0 +1,64 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+CPPFLAGS_INCLUDE_DIR = "-isystem `${HOST_PREFIX}gcc

-print-file-name=include`"

Quoted 3 lines

recipes-extended/xen/newlib.inc

Quoted 3 lines
recipes-extended/xen/newlib.inc new file +3 -0
+STUBDOM_CFLAGS += "-D_I386MACH_ALLOW_HW_INTERRUPTS"
+
+export ac_cv_path_CC_FOR_TARGET="${HOST_PREFIX}gcc

--sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"

Quoted 1 line

recipes-extended/xen/newlib.inc line 10

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+export CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}

${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"

Quoted 2 lines

recipes-extended/xen/newlib.inc line 12

Quoted 2 lines
recipes-extended/xen/newlib.inc new file +2 -0
+
+export ac_cv_path_CXX_FOR_TARGET="${HOST_PREFIX}g++

--sysroot=${RECIPE_SYSROOT}"

Quoted 3 lines

recipes-extended/xen/newlib.inc

Quoted 3 lines
recipes-extended/xen/newlib.inc new file +3 -0
+export CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_CPP_FOR_TARGET="${HOST_PREFIX}gcc -E

--sysroot=${RECIPE_SYSROOT}"

Quoted 1 line

recipes-extended/xen/newlib.inc line 16

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+export CPP_FOR_TARGET="${HOST_PREFIX}gcc -E

--sysroot=${RECIPE_SYSROOT}"

Quoted 2 lines

recipes-extended/xen/newlib.inc line 18

Quoted 2 lines
recipes-extended/xen/newlib.inc new file +2 -0
+
+export ac_cv_path_LD_FOR_TARGET="${HOST_PREFIX}ld

--sysroot=${RECIPE_SYSROOT}"

Quoted 23 lines
Quoted 23 lines
recipes-extended/xen/newlib.inc new file +23 -0
+export LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_AS_FOR_TARGET="${HOST_PREFIX}as"
+export AS_FOR_TARGET="${HOST_PREFIX}as"
+
+export ac_cv_path_AR_FOR_TARGET="${HOST_PREFIX}ar"
+export AR_FOR_TARGET="${HOST_PREFIX}ar"
+
+export ac_cv_path_NM_FOR_TARGET="${HOST_PREFIX}nm"
+export NM_FOR_TARGET="${HOST_PREFIX}nm"
+
+export ac_cv_path_RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+
+export ac_cv_path_OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+export OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+
+export ac_cv_path_OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+export OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+
+export ac_cv_path_STRIP_FOR_TARGET="${HOST_PREFIX}strip"
+export STRIP_FOR_TARGET="${HOST_PREFIX}strip"
+
Quoted 8 lines

recipes-extended/xen/newlib.inc

Quoted 8 lines
recipes-extended/xen/newlib.inc new file +8 -0
+export ac_cv_path_STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+export STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+
+export ac_cv_path_READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+export READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+
+do_configure() {
+    ${S}/configure --verbose --prefix=${prefix}

--target=${GNU_TARGET_ARCH}-xen-elf --enable-newlib-io-long-long --disable-multilib

Quoted 1 line

recipes-extended/xen/newlib.inc line 50

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+    find ${S} -type f | xargs perl -i.bak -pe 's/\b_(tzname|daylight|

timezone)\b/$1/g'

Quoted 11 lines

recipes-extended/xen/newlib.inc

Quoted 11 lines
recipes-extended/xen/newlib.inc new file +11 -0
+}
+
+do_compile() {
+    ${MAKE}
+}
+
+do_install() {
+    ${MAKE} DESTDIR=${D} install
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/share
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/info
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdarg.h

-t ${D}/${includedir}

Quoted 1 line

recipes-extended/xen/newlib.inc line 62

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stddef.h

-t ${D}/${includedir}

Quoted 1 line

recipes-extended/xen/newlib.inc line 63

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdbool.h

-t ${D}/${includedir}

Quoted 2 lines

Review

Quoted 2 lines
recipes-extended/xen/newlib.inc new file +1 -0
+}
(quoted diff) +0 -0

b/recipes-extended/xen/newlib_1.16.0.bb

Quoted 9 lines

recipes-extended/xen/newlib_1.16.0.bb line 4

Quoted 9 lines

new file mode 100644
index 0000000..ea80271

recipes-extended/xen/newlib_1.16.0.bb new file +4 -0
@@ -0,0 +1,19 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Newlib is a C library intended for use on embedded

systems."

Quoted 3 lines

recipes-extended/xen/newlib_1.16.0.bb

Quoted 3 lines
recipes-extended/xen/newlib_1.16.0.bb new file +3 -0
+HOMEPAGE = "http://sourceware.org/newlib"
+LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
+LIC_FILES_CHKSUM = "file://COPYING.NEWLIB;md5=

950f50b290e8fcf7a2d3fff61775de9b"

Quoted 7 lines

recipes-extended/xen/newlib_1.16.0.bb line 8

Quoted 1 line
recipes-extended/xen/newlib_1.16.0.bb new file +1 -0
+

I see newlib in a few other oe layers, but nothing that looks to be common. For my
own understanding (and when someone asks me about this), is there any significant
difference in this newlib implementation/build than you'd find in other newlib use cases ?

This version is old 2008, the latest is 3.0 but not sure if this Xen solution needs 1.7.

- armin

Quoted 6 lines

recipes-extended/xen/newlib_1.16.0.bb

Quoted 6 lines
recipes-extended/xen/newlib_1.16.0.bb new file +5 -0
+S="${WORKDIR}/newlib"
+B="${WORKDIR}/build"
+
+SRC_URI += "\
+    git://sourceware.org/git/newlib-cygwin.git;protocol=

git;rev=newlib-${TRANSLATED_PV};destsuffix=newlib;nobranch=1;name=newlib \

Quoted 23 lines

Using tags for SRCREVs is generally frowned upon. Is that what this is doing ? Even if you want to
use the convenience variable you created, it would still be better to explicitly set SRCREV in the
recipes for easier maintenance and to make things more obvious.

recipes-extended/xen/newlib_1.16.0.bb line 15

Quoted 2 lines
recipes-extended/xen/newlib_1.16.0.bb new file +2 -0
+    file://newlib.patch;striplevel=0 \
+    file://newlib-chk.patch;striplevel=0 \

We really shouldn't be specifying striplevel on the patches. Why aren't the patches being
generated in a way that makes then consistent, and that can be applied with the defaults ?

Bruce

Quoted 8 lines
recipes-extended/xen/newlib_1.16.0.bb new file +4 -1
+    file://newlib-stdint-size_max-fix-from-1.17.0.patch;striplevel=1 \
+"
+
+require newlib.inc
--

2.14.2

Quoted 4 lines
Quoted 4 lines

--

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

disclosure is

Quoted 8 lines
Quoted 6 lines

prohibited. *
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 11 lines
Kurt Bodiker
BrainTrust Holdings
www.braintrust-us.com
443-296-2186 office
410-750-2119 fax

-- 

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

Re: [PATCH 3/7] xen: Newlib recipe and patches for Xen stubdoms

In reply to Bruce Ashfield

Regarding the patches, these files were not created by me. Instead, these files were copied directly out of the Xen source tree. I was trying to mimic the Xen/stubdom/Makefile targets/recipes and minimize the deviations and any necessary maintenance to the files. I claim no ownership on the implementation of the patches, so I'll modify the patchfiles as noted by Bruce unless I receive direction otherwise.

Thanks for the feedback and comments.

Kurt

Quoted 1,182 lines · Bruce Ashfield
Quoted 14 lines · Kurt Bodiker

From: kebodiker <[email protected]>

Newlib provides a fast, C library optimized for embedded systems. In the case of Xen stubdomains, we are using MiniOS. This Newlib recipe creates static libraries that are cross-compiled against MiniOS, Xen, and LWIP headers and subsequently used during the cross-compilation and linking of PolarSSL, the stubdom specific GMP, 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. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

Quoted 5 lines
---
 recipes-extended/xen/files/newlib-chk.patch        | 155 +++++
 .../newlib-stdint-size_max-fix-from-1.17.0.patch   |  16 +
 recipes-extended/xen/files/newlib.patch            | 727

+++++++++++++++++++++

Quoted 5 lines
 recipes-extended/xen/newlib.inc                    |  64 ++
 recipes-extended/xen/newlib_1.16.0.bb              |  19 +
 5 files changed, 981 insertions(+)
 create mode 100644 recipes-extended/xen/files/newlib-chk.patch
 create mode 100644 recipes-extended/xen/files/

newlib-stdint-size_max-fix-from-1.17.0.patch

Review

Quoted 5 lines
 create mode 100644 recipes-extended/xen/files/newlib.patch
 create mode 100644 recipes-extended/xen/newlib.inc
 create mode 100644 recipes-extended/xen/newlib_1.16.0.bb
(quoted diff) +0 -0

b/recipes-extended/xen/files/newlib-chk.patch

recipes-extended/xen/files/newlib-chk.patch line 1

Quoted 6 lines

new file mode 100644
index 0000000..848dbd5

recipes-extended/xen/files/newlib-chk.patch new file +1 -0
@@ -0,0 +1,155 @@
+--- newlib/libc/stdio/fprintf_chk.c    1969-12-31 19:00:00.000000000

-0500

recipes-extended/xen/files/newlib-chk.patch line 2

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/fprintf_chk.c    2009-02-26 19:02:53.000000000

-0500

recipes-extended/xen/files/newlib-chk.patch

Quoted 7 lines
recipes-extended/xen/files/newlib-chk.patch new file +7 -0
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __fprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It just

makes

Quoted 6 lines
recipes-extended/xen/files/newlib-chk.patch new file +6 -0
++ * the linker happy :)
++*/
++int
++__fprintf_chk (FILE *fp, int flag, const char *format, ...)
++{
++  va_list ap;

recipes-extended/xen/files/newlib-chk.patch

Quoted 10 lines
recipes-extended/xen/files/newlib-chk.patch new file +10 -0
++  int done;
++
++  va_start (ap, format);
++  done = vfprintf (fp, format, ap);
++  va_end (ap);
++
++  return done;
++}
++
+--- newlib/libc/stdio/Makefile.am      2007-08-02 16:23:06.000000000

-0400

recipes-extended/xen/files/newlib-chk.patch line 26

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/Makefile.am      2009-02-26 18:14:53.000000000

-0500

Quoted 7 lines
recipes-extended/xen/files/newlib-chk.patch new file +7 -0
+@@ -20,6 +20,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c           \
+       fputc.c                 \
+       fputs.c                 \

recipes-extended/xen/files/newlib-chk.patch

Quoted 10 lines
recipes-extended/xen/files/newlib-chk.patch new file +10 -0
+       fread.c                 \
+@@ -65,6 +66,7 @@
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+--- newlib/libc/stdio/Makefile.in      2007-12-19 17:36:38.000000000

-0500

recipes-extended/xen/files/newlib-chk.patch line 44

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/Makefile.in      2009-02-26 18:43:52.000000000

-0500

Quoted 15 lines
recipes-extended/xen/files/newlib-chk.patch new file +15 -0
+@@ -63,7 +63,8 @@
+       lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
+       lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
+       lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
+-      lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
++      lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
++      lib_a-fputc.$(OBJEXT) \
+       lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
+       lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
+       lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
+@@ -86,6 +87,7 @@
+       lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
+       lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
+       lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
++      lib_a-sprintf_chk.$(OBJEXT) \

recipes-extended/xen/files/newlib-chk.patch

Quoted 10 lines
recipes-extended/xen/files/newlib-chk.patch new file +10 -0
+       lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
+       lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
+       lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
+@@ -122,15 +124,15 @@
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
+       fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
+-      fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
+-      fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
++      fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo

\

recipes-extended/xen/files/newlib-chk.patch line 70

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++      fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo

fsetpos.lo \

recipes-extended/xen/files/newlib-chk.patch

Quoted 8 lines
recipes-extended/xen/files/newlib-chk.patch new file +8 -0
+       ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
+       getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
+       iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
+       putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
+       rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
+       setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
+-      sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
++      sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo

stdio.lo \

Quoted 20 lines
recipes-extended/xen/files/newlib-chk.patch new file +20 -0
+       tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
+       viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
+       vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
+@@ -344,6 +346,7 @@
+       flags.c                 \
+       fopen.c                 \
+       fprintf.c                       \
++      fprintf_chk.c                   \
+       fputc.c                 \
+       fputs.c                 \
+       fread.c                 \
+@@ -389,6 +392,7 @@
+       sniprintf.c                     \
+       snprintf.c                      \
+       sprintf.c                       \
++      sprintf_chk.c                   \
+       sscanf.c                        \
+       stdio.c                 \
+       tmpfile.c                       \
+@@ -508,6 +512,7 @@

recipes-extended/xen/files/newlib-chk.patch

Quoted 10 lines
recipes-extended/xen/files/newlib-chk.patch new file +10 -0
+       siprintf.def            \
+       siscanf.def             \
+       sprintf.def             \
++      sprintf_chk.def         \
+       sscanf.def              \
+       tmpfile.def             \
+       tmpnam.def              \
+@@ -678,6 +683,12 @@
+ lib_a-fprintf.obj: fprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
+
++lib_a-fprintf_chk.o: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o test -f 'fprintf_chk.c' || echo '$(srcdir)/'fprintf_chk.c

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
++lib_a-fprintf_chk.obj: fprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
+ lib_a-fputc.o: fputc.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o test -f 'fputc.c' || echo '$(srcdir)/'fputc.c

recipes-extended/xen/files/newlib-chk.patch

Quoted 4 lines
recipes-extended/xen/files/newlib-chk.patch new file +4 -0
+
+@@ -948,6 +959,12 @@
+ lib_a-sprintf.obj: sprintf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
+
++lib_a-sprintf_chk.o: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o test -f 'sprintf_chk.c' || echo '$(srcdir)/'sprintf_chk.c

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
++lib_a-sprintf_chk.obj: sprintf_chk.c
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi

recipes-extended/xen/files/newlib-chk.patch

Quoted 3 lines
recipes-extended/xen/files/newlib-chk.patch new file +3 -0
++
+ lib_a-sscanf.o: sscanf.c
+       $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)

$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o test -f 'sscanf.c' || echo '$(srcdir)/'sscanf.c

recipes-extended/xen/files/newlib-chk.patch line 132

Quoted 2 lines
recipes-extended/xen/files/newlib-chk.patch new file +2 -0
+
+--- newlib/libc/stdio/sprintf_chk.c    1969-12-31 19:00:00.000000000

-0500

recipes-extended/xen/files/newlib-chk.patch line 133

Quoted 1 line
recipes-extended/xen/files/newlib-chk.patch new file +1 -0
++++ newlib/libc/stdio/sprintf_chk.c    2009-02-26 19:02:26.000000000

-0500

recipes-extended/xen/files/newlib-chk.patch

Quoted 7 lines
recipes-extended/xen/files/newlib-chk.patch new file +7 -0
+@@ -0,0 +1,21 @@
++#include <stdarg.h>
++#include <stdio.h>
++
++/*
++ * Stub implementation of __sprintf_chk adapted from glibc 2.7.  This
++ * doesn't actually implement any buffer overflow protection.  It just

makes

recipes-extended/xen/files/newlib-chk.patch

Quoted 4 lines
recipes-extended/xen/files/newlib-chk.patch new file +4 -0
++ * the linker happy :)
++*/
++int
++__sprintf_chk (char *s, int flags, size_t slen, const char *format,

...)

Review

Quoted 12 lines
recipes-extended/xen/files/newlib-chk.patch new file +11 -0
++{
++  va_list arg;
++  int done;
++
++  va_start (arg, format);
++  done = vsprintf (s, format, arg);
++  va_end (arg);
++
++  return done;
++}
++
(quoted diff) +0 -0

b/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch

recipes-extended/xen/files/newlib-stdint-size_max-fix-

Quoted 4 lines

new file mode 100644
index 0000000..1054a07

recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +0 -0

from-1.17.0.patch

recipes-extended/xen/files/newlib-stdint-size_max-fix- line 1

Quoted 2 lines
recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +1 -0
@@ -0,0 +1,16 @@
+--- newlib-1.16.0/newlib/libc/include/stdint.h.orig    2006-08-17

00:39:43.000000000 +0300

recipes-extended/xen/files/newlib-stdint-size_max-fix- line 2

Quoted 1 line
recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +1 -0
++++ newlib-1.16.0/newlib/libc/include/stdint.h 2009-08-25

17:33:23.000000000 +0300

Review

Quoted 15 lines
recipes-extended/xen/files/newlib-stdint-size_max-fix- new file +14 -0
+@@ -348,8 +348,11 @@
+ #endif
+
+ /* This must match size_t in stddef.h, currently long unsigned int */
+-#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
+-#define SIZE_MAX __STDINT_EXP(LONG_MAX)
++#ifdef __SIZE_MAX__
++#define SIZE_MAX __SIZE_MAX__
++#else
++#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
++#endif
+
+ /* This must match sig_atomic_t in <signal.h> (currently int) */
+ #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
(quoted diff) +0 -0

b/recipes-extended/xen/files/newlib.patch

recipes-extended/xen/files/newlib.patch line 8

Quoted 13 lines

new file mode 100644
index 0000000..ee9b6f2

recipes-extended/xen/files/newlib.patch new file +8 -0
@@ -0,0 +1,727 @@
+There is a mix between longs and long longs.
+
+Index: newlib/libc/include/inttypes.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v
+retrieving revision 1.3
+diff -u -p -r1.3 inttypes.h
+--- newlib/libc/include/inttypes.h     16 Dec 2005 19:03:12 -0000

1.3

Quoted 44 lines
recipes-extended/xen/files/newlib.patch new file +44 -0
++++ newlib/libc/include/inttypes.h     8 Nov 2007 16:32:44 -0000
+@@ -163,12 +163,12 @@
+
+
+ /* 64-bit types */
+-#if __have_longlong64
+-#define __PRI64(x) __STRINGIFY(ll##x)
+-#define __SCN64(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRI64(x) __STRINGIFY(l##x)
+ #define __SCN64(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRI64(x) __STRINGIFY(ll##x)
++#define __SCN64(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRI64(x) __STRINGIFY(x)
+ #define __SCN64(x) __STRINGIFY(x)
+@@ -217,12 +217,12 @@
+ #endif
+
+ /* max-bit types */
+-#if __have_longlong64
+-#define __PRIMAX(x) __STRINGIFY(ll##x)
+-#define __SCNMAX(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIMAX(x) __STRINGIFY(l##x)
+ #define __SCNMAX(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIMAX(x) __STRINGIFY(ll##x)
++#define __SCNMAX(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIMAX(x) __STRINGIFY(x)
+ #define __SCNMAX(x) __STRINGIFY(x)
+@@ -242,12 +242,12 @@
+ #define SCNxMAX               __SCNMAX(x)
+
+ /* ptr types */
+-#if __have_longlong64
+-#define __PRIPTR(x) __STRINGIFY(ll##x)
+-#define __SCNPTR(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+ #define __PRIPTR(x) __STRINGIFY(l##x)
+ #define __SCNPTR(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIPTR(x) __STRINGIFY(ll##x)
++#define __SCNPTR(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIPTR(x) __STRINGIFY(x)
+ #define __SCNPTR(x) __STRINGIFY(x)
+
+We don't want u?int32_t to be long as our code assume in a lot of

places to be

recipes-extended/xen/files/newlib.patch

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+int.
+
+Index: newlib/libc/include/stdint.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
+retrieving revision 1.10
+diff -u -p -r1.10 stdint.h
+--- newlib/libc/include/stdint.h       16 Aug 2006 21:39:43 -0000

1.10

Quoted 9 lines
recipes-extended/xen/files/newlib.patch new file +9 -0
++++ newlib/libc/include/stdint.h       12 Feb 2008 13:07:52 -0000
+@@ -38,7 +38,7 @@ extern "C" {
+ #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+ #define __have_long64 1
+ #elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
+-#define __have_long32 1
++/* #define __have_long32 1 */
+ #endif
+

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+ #if __STDINT_EXP(SCHAR_MAX) == 0x7f
+
+Define the basic ia64 jump buffer
+
+Index: newlib/libc/include/sys/config.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
+retrieving revision 1.47
+diff -u -p -r1.47 config.h
+--- newlib/libc/include/sys/config.h   15 Mar 2007 21:32:12 -0000

1.47

Quoted 11 lines
recipes-extended/xen/files/newlib.patch new file +11 -0
++++ newlib/libc/include/sys/config.h   8 Nov 2007 16:32:44 -0000
+@@ -71,6 +71,10 @@
+ #endif
+ #endif
+
++#ifndef __DYNAMIC_REENT__
++#define __DYNAMIC_REENT__
++#endif
++
+ #ifdef __mn10200__
+ #define __SMALL_BITFIELDS

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+ #endif
+
+Dynamic pointer to our reentrancy zone
+
+Index: newlib/libc/reent/getreent.c
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v
+retrieving revision 1.2
+diff -u -p -r1.2 getreent.c
+--- newlib/libc/reent/getreent.c       7 Sep 2007 00:45:55 -0000

1.2

recipes-extended/xen/files/newlib.patch

Quoted 7 lines
recipes-extended/xen/files/newlib.patch new file +7 -0
++++ newlib/libc/reent/getreent.c       8 Nov 2007 16:32:44 -0000
+@@ -3,12 +3,20 @@
+ #include <_ansi.h>
+ #include <reent.h>
+
++#define weak_alias(name, aliasname) \
++  extern __typeof (name) aliasname __attribute__ ((weak, alias

(#name)));

Quoted 15 lines
recipes-extended/xen/files/newlib.patch new file +15 -0
++
+ #ifdef __getreent
+ #undef __getreent
+ #endif
++#ifdef __libc_getreent
++#undef __libc_getreent
++#endif
+
+ struct _reent *
+-_DEFUN_VOID(__getreent)
++__libc_getreent (void)
+ {
+   return _impure_ptr;
+ }
++weak_alias(__libc_getreent,__getreent)

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++
+
+We can't provide a red zone in mini-os.
+
+Index: newlib/libc/machine/x86_64/memcpy.S
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v
+retrieving revision 1.1
+diff -u -p -r1.1 memcpy.S
+--- newlib/libc/machine/x86_64/memcpy.S        28 Aug 2007 21:56:49

-0000 1.1

recipes-extended/xen/files/newlib.patch line 143

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/memcpy.S        8 Nov 2007 16:32:44

-0000

Quoted 8 lines
recipes-extended/xen/files/newlib.patch new file +8 -0
+@@ -30,10 +30,18 @@ quadword_aligned:
+   cmpq    $256, rdx
+   jb      quadword_copy
+
++#if 1
++  subq    $32, rsp
++  movq    rax, 24 (rsp)
++  movq    r12, 16 (rsp)

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++  movq    r13, 8  (rsp)
++  movq    r14, 0  (rsp)
++#else
+   movq    rax, -8  (rsp)
+   movq    r12, -16 (rsp)
+   movq    r13, -24 (rsp)
+   movq    r14, -32 (rsp)
++#endif
+
+   movq    rdx, rcx                /* Copy 128 bytes at a time with

minimum cache polution */

Quoted 11 lines
recipes-extended/xen/files/newlib.patch new file +11 -0
+   shrq    $7, rcx
+@@ -89,10 +97,18 @@ loop:
+   movq    rdx, rcx
+   andq    $127, rcx
+   rep     movsb
++#if 1
++  movq    24 (rsp), rax
++  movq    16 (rsp), r12
++  movq    8  (rsp), r13
++  movq    0  (rsp), r14
++  addq    $32, rsp

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++#else
+   movq    -8  (rsp), rax
+   movq    -16 (rsp), r12
+   movq    -24 (rsp), r13
+   movq    -32 (rsp), r14
++#endif
+   ret
+
+
+--- newlib/libc/machine/x86_64/x86_64mach.h.orig       2008-07-11

14:57:23.062269000 +0100

recipes-extended/xen/files/newlib.patch line 183

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/x86_64mach.h    2008-07-11

14:58:01.262503000 +0100

Quoted 148 lines
recipes-extended/xen/files/newlib.patch new file +148 -0
+@@ -22,81 +22,81 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define rax REG(rax)
+-#define rbx REG(rbx)
+-#define rcx REG(rcx)
+-#define rdx REG(rdx)
+-#define rsi REG(rsi)
+-#define rdi REG(rdi)
+-#define rbp REG(rbp)
+-#define rsp REG(rsp)
+-
+-#define r8  REG(r8)
+-#define r9  REG(r9)
+-#define r10 REG(r10)
+-#define r11 REG(r11)
+-#define r12 REG(r12)
+-#define r13 REG(r13)
+-#define r14 REG(r14)
+-#define r15 REG(r15)
+-
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define sil REG(sil)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
+-
+-#define xmm0 REG(xmm0)
+-#define xmm1 REG(xmm1)
+-#define xmm2 REG(xmm2)
+-#define xmm3 REG(xmm3)
+-#define xmm4 REG(xmm4)
+-#define xmm5 REG(xmm5)
+-#define xmm6 REG(xmm6)
+-#define xmm7 REG(xmm7)
+-
+-#define cr0 REG(cr0)
+-#define cr1 REG(cr1)
+-#define cr2 REG(cr2)
+-#define cr3 REG(cr3)
+-#define cr4 REG(cr4)
++#define rax %rax
++#define rbx %rbx
++#define rcx %rcx
++#define rdx %rdx
++#define rsi %rsi
++#define rdi %rdi
++#define rbp %rbp
++#define rsp %rsp
++
++#define r8  %r8
++#define r9  %r9
++#define r10 %r10
++#define r11 %r11
++#define r12 %r12
++#define r13 %r13
++#define r14 %r14
++#define r15 %r15
++
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define sil %sil
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
++
++#define xmm0 %xmm0
++#define xmm1 %xmm1
++#define xmm2 %xmm2
++#define xmm3 %xmm3
++#define xmm4 %xmm4
++#define xmm5 %xmm5
++#define xmm6 %xmm6
++#define xmm7 %xmm7

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++
++#define cr0 %cr0
++#define cr1 %cr1
++#define cr2 %cr2
++#define cr3 %cr3
++#define cr4 %cr4
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memcpy.S.orig   2008-07-11

15:12:27.494693000 +0100

recipes-extended/xen/files/newlib.patch line 342

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/memcpy.S        2008-07-11

15:12:29.448706000 +0100

Quoted 37 lines
recipes-extended/xen/files/newlib.patch new file +37 -0
+@@ -60,14 +60,14 @@
+   movq    48 (rsi), r13
+   movq    56 (rsi), r14
+
+-  movntiq rax,    (rdi)
+-  movntiq r8 ,  8 (rdi)
+-  movntiq r9 , 16 (rdi)
+-  movntiq r10, 24 (rdi)
+-  movntiq r11, 32 (rdi)
+-  movntiq r12, 40 (rdi)
+-  movntiq r13, 48 (rdi)
+-  movntiq r14, 56 (rdi)
++  movnti rax,    (rdi)
++  movnti r8 ,  8 (rdi)
++  movnti r9 , 16 (rdi)
++  movnti r10, 24 (rdi)
++  movnti r11, 32 (rdi)
++  movnti r12, 40 (rdi)
++  movnti r13, 48 (rdi)
++  movnti r14, 56 (rdi)
+
+   movq     64 (rsi), rax
+   movq     72 (rsi), r8
+@@ -78,14 +78,14 @@
+   movq    112 (rsi), r13
+   movq    120 (rsi), r14
+
+-  movntiq rax,  64 (rdi)
+-  movntiq r8 ,  72 (rdi)
+-  movntiq r9 ,  80 (rdi)
+-  movntiq r10,  88 (rdi)
+-  movntiq r11,  96 (rdi)
+-  movntiq r12, 104 (rdi)
+-  movntiq r13, 112 (rdi)
+-  movntiq r14, 120 (rdi)
++  movnti rax,  64 (rdi)
++  movnti r8 ,  72 (rdi)

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++  movnti r9 ,  80 (rdi)
++  movnti r10,  88 (rdi)
++  movnti r11,  96 (rdi)
++  movnti r12, 104 (rdi)
++  movnti r13, 112 (rdi)
++  movnti r14, 120 (rdi)
+
+   leaq    128 (rsi), rsi
+   leaq    128 (rdi), rdi
+--- newlib/libc/machine/i386/i386mach.h        2000-08-28

18:50:06.000000000 +0100

recipes-extended/xen/files/newlib.patch line 390

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/i386/i386mach.h        2008-07-11

15:17:13.874409000 +0100

Quoted 78 lines
recipes-extended/xen/files/newlib.patch new file +78 -0
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5
++#define mm6 %mm6
++#define mm7 %mm7
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+--- newlib/libc/machine/x86_64/memset.S        2007-08-28

22:56:49.000000000 +0100

recipes-extended/xen/files/newlib.patch line 479

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/machine/x86_64/memset.S        2008-07-11

15:16:59.098320000 +0100

Quoted 30 lines
recipes-extended/xen/files/newlib.patch new file +30 -0
+@@ -40,22 +40,22 @@
+
+   .p2align 4
+ loop:
+-  movntiq rax,     (rdi)
+-  movntiq rax,   8 (rdi)
+-  movntiq rax,  16 (rdi)
+-  movntiq rax,  24 (rdi)
+-  movntiq rax,  32 (rdi)
+-  movntiq rax,  40 (rdi)
+-  movntiq rax,  48 (rdi)
+-  movntiq rax,  56 (rdi)
+-  movntiq rax,  64 (rdi)
+-  movntiq rax,  72 (rdi)
+-  movntiq rax,  80 (rdi)
+-  movntiq rax,  88 (rdi)
+-  movntiq rax,  96 (rdi)
+-  movntiq rax, 104 (rdi)
+-  movntiq rax, 112 (rdi)
+-  movntiq rax, 120 (rdi)
++  movnti rax,     (rdi)
++  movnti rax,   8 (rdi)
++  movnti rax,  16 (rdi)
++  movnti rax,  24 (rdi)
++  movnti rax,  32 (rdi)
++  movnti rax,  40 (rdi)
++  movnti rax,  48 (rdi)
++  movnti rax,  56 (rdi)
++  movnti rax,  64 (rdi)
++  movnti rax,  72 (rdi)

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++  movnti rax,  80 (rdi)
++  movnti rax,  88 (rdi)
++  movnti rax,  96 (rdi)
++  movnti rax, 104 (rdi)
++  movnti rax, 112 (rdi)
++  movnti rax, 120 (rdi)
+
+   leaq    128 (rdi), rdi
+
+--- newlib/libm/machine/i386/i386mach.h.orig   2008-07-11

15:30:37.367227000 +0100

recipes-extended/xen/files/newlib.patch line 520

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libm/machine/i386/i386mach.h        2008-07-11

15:30:55.232337000 +0100

Quoted 82 lines
recipes-extended/xen/files/newlib.patch new file +82 -0
+@@ -27,46 +27,46 @@
+
+ #define REG(x) CONCAT1(__REG_PREFIX__, x)
+
+-#define eax REG(eax)
+-#define ebx REG(ebx)
+-#define ecx REG(ecx)
+-#define edx REG(edx)
+-#define esi REG(esi)
+-#define edi REG(edi)
+-#define ebp REG(ebp)
+-#define esp REG(esp)
+-
+-#define st0 REG(st)
+-#define st1 REG(st(1))
+-#define st2 REG(st(2))
+-#define st3 REG(st(3))
+-#define st4 REG(st(4))
+-#define st5 REG(st(5))
+-#define st6 REG(st(6))
+-#define st7 REG(st(7))
+-
+-#define ax REG(ax)
+-#define bx REG(bx)
+-#define cx REG(cx)
+-#define dx REG(dx)
+-
+-#define ah REG(ah)
+-#define bh REG(bh)
+-#define ch REG(ch)
+-#define dh REG(dh)
+-
+-#define al REG(al)
+-#define bl REG(bl)
+-#define cl REG(cl)
+-#define dl REG(dl)
+-
+-#define mm1 REG(mm1)
+-#define mm2 REG(mm2)
+-#define mm3 REG(mm3)
+-#define mm4 REG(mm4)
+-#define mm5 REG(mm5)
+-#define mm6 REG(mm6)
+-#define mm7 REG(mm7)
++#define eax %eax
++#define ebx %ebx
++#define ecx %ecx
++#define edx %edx
++#define esi %esi
++#define edi %edi
++#define ebp %ebp
++#define esp %esp
++
++#define st0 %st
++#define st1 %st(1)
++#define st2 %st(2)
++#define st3 %st(3)
++#define st4 %st(4)
++#define st5 %st(5)
++#define st6 %st(6)
++#define st7 %st(7)
++
++#define ax %ax
++#define bx %bx
++#define cx %cx
++#define dx %dx
++
++#define ah %ah
++#define bh %bh
++#define ch %ch
++#define dh %dh
++
++#define al %al
++#define bl %bl
++#define cl %cl
++#define dl %dl
++
++#define mm1 %mm1
++#define mm2 %mm2
++#define mm3 %mm3
++#define mm4 %mm4
++#define mm5 %mm5

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++#define mm6 %mm6
++#define mm7 %mm7
+
+ #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
+ #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
+
+
+We want to have a 64bit offsets libc even on 32bit platforms.
+
+--- ./newlib/configure.host.orig       2008-08-07 16:01:17.801946000

+0100

recipes-extended/xen/files/newlib.patch

Quoted 11 lines
recipes-extended/xen/files/newlib.patch new file +11 -0
++++ ./newlib/configure.host    2008-08-07 16:01:34.181064000 +0100
+@@ -317,6 +317,8 @@
+     oext=lo
+     lpfx=
+     aext=la ;;
++  i[34567]86-xen-elf)
++    stdio64_dir=stdio64 ;;
+   *) ;; #shared library not supported for ${host}
+ esac
+
+--- newlib/libc/include/sys/_types.h.orig      2008-08-07

15:22:44.925008000 +0100

recipes-extended/xen/files/newlib.patch line 624

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/include/sys/_types.h   2008-08-07 15:22:50.824044000

+0100

Quoted 4 lines
recipes-extended/xen/files/newlib.patch new file +4 -0
+@@ -13,8 +13,12 @@
+ #include <sys/lock.h>
+
+ #ifndef __off_t_defined

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
++#ifdef __MINIOS__
++typedef long long _off_t;
++#else
+ typedef long _off_t;
+ #endif
++#endif
+
+ #if defined(__rtems__)
+ /* device numbers are 32-bit major and and 32-bit minor */
+--- ./newlib/libc/include/sys/config.h.orig    2008-08-07

14:43:25.915866000 +0100

recipes-extended/xen/files/newlib.patch line 639

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/config.h 2008-08-07 14:44:13.508154000

+0100

recipes-extended/xen/files/newlib.patch line 641

Quoted 2 lines
recipes-extended/xen/files/newlib.patch new file +2 -0
+@@ -69,6 +69,10 @@
+ /* we use some glibc header files so turn on glibc large file feature

*/

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+ #define _LARGEFILE64_SOURCE 1
+ #endif
++#ifdef __MINIOS__
++#define __LARGE64_FILES 1
++#define _LARGEFILE64_SOURCE 1
++#endif
+ #endif
+
+ #ifndef __DYNAMIC_REENT__
+--- ./newlib/libc/include/sys/_default_fcntl.h.orig    2008-08-07

15:08:22.377836000 +0100

recipes-extended/xen/files/newlib.patch line 652

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/_default_fcntl.h 2008-08-07

15:08:31.651890000 +0100

recipes-extended/xen/files/newlib.patch line 654

Quoted 2 lines
recipes-extended/xen/files/newlib.patch new file +2 -0
+@@ -170,7 +170,11 @@
+ /* Provide _<systemcall> prototypes for functions provided by some

versions

recipes-extended/xen/files/newlib.patch

Quoted 12 lines
recipes-extended/xen/files/newlib.patch new file +12 -0
+    of newlib.  */
+ #ifdef _COMPILING_NEWLIB
+-extern int _open _PARAMS ((const char *, int, ...));
++extern int _open _PARAMS ((const char *, int, ...))
++#ifdef __MINIOS__
++    asm("open64")
++#endif
++    ;
+ extern int _fcntl _PARAMS ((int, int, ...));
+ #ifdef __LARGE64_FILES
+ extern int _open64 _PARAMS ((const char *, int, ...));
+--- ./newlib/libc/include/sys/unistd.h.orig    2008-08-07

15:09:36.449280000 +0100

recipes-extended/xen/files/newlib.patch line 667

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/unistd.h 2008-08-07 15:09:51.210370000

+0100

Quoted 4 lines
recipes-extended/xen/files/newlib.patch new file +4 -0
+@@ -101,7 +101,11 @@
+ int     _EXFUN(link, (const char *__path1, const char *__path2 ));
+ int   _EXFUN(nice, (int __nice_value ));
+ #if !defined(__INSIDE_CYGWIN__)

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+-off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
++off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ))
++#ifdef __MINIOS__
++    asm("lseek64")
++#endif
++    ;
+ #endif
+ #if defined(__SPU__)
+ #define F_ULOCK       0
+--- ./newlib/libc/include/sys/stat.h.orig      2008-08-07

16:08:50.495116000 +0100

recipes-extended/xen/files/newlib.patch line 682

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/sys/stat.h   2008-08-07 16:10:21.799753000

+0100

Quoted 14 lines
recipes-extended/xen/files/newlib.patch new file +14 -0
+@@ -49,6 +49,9 @@
+   long        st_spare4[2];
+ #endif
+ };
++#ifdef __MINIOS__
++#define stat64 stat
++#endif
+ #endif
+
+ #define       _IFMT           0170000 /* type of file */
+@@ -132,7 +135,11 @@
+ /* Provide prototypes for most of the _<systemcall> names that are
+    provided in newlib for some compilers.  */
+ #ifdef _COMPILING_NEWLIB

recipes-extended/xen/files/newlib.patch

Quoted 10 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+-int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
++int   _EXFUN(_fstat,( int __fd, struct stat *__sbuf ))
++#ifdef __MINIOS__
++    asm("fstat64")
++#endif
++    ;
+ int   _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
+ #ifdef __LARGE64_FILES
+ struct stat64;
+--- ./newlib/libc/include/_syslist.h.orig      2008-08-07

16:24:19.122605000 +0100

recipes-extended/xen/files/newlib.patch line 707

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ ./newlib/libc/include/_syslist.h   2008-08-07 16:24:21.548628000

+0100

recipes-extended/xen/files/newlib.patch

Quoted 9 lines
recipes-extended/xen/files/newlib.patch new file +9 -0
+@@ -14,6 +14,7 @@
+ #define _kill kill
+ #define _link link
+ #define _lseek lseek
++#define _lseek64 lseek64
+ #define _open open
+ #define _read read
+ #define _sbrk sbrk
+--- newlib/libc/include/reent.h.orig   2008-08-07 16:28:49.846502000

+0100

recipes-extended/xen/files/newlib.patch line 717

Quoted 1 line
recipes-extended/xen/files/newlib.patch new file +1 -0
++++ newlib/libc/include/reent.h        2008-08-07 16:29:02.096586000

+0100

Review

Quoted 11 lines
recipes-extended/xen/files/newlib.patch new file +10 -0
+@@ -87,6 +87,9 @@
+ #if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB)
+ #define stat64 __stat64
+ #endif
++#if defined(__MINIOS__)
++#define stat64 stat
++#endif
+
+ struct stat64;
+
(quoted diff) +0 -0

b/recipes-extended/xen/newlib.inc

recipes-extended/xen/newlib.inc line 6

Quoted 11 lines

new file mode 100644
index 0000000..32d79aa

recipes-extended/xen/newlib.inc new file +6 -0
@@ -0,0 +1,64 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+CPPFLAGS_INCLUDE_DIR = "-isystem `${HOST_PREFIX}gcc

-print-file-name=include`"

recipes-extended/xen/newlib.inc

Quoted 3 lines
recipes-extended/xen/newlib.inc new file +3 -0
+STUBDOM_CFLAGS += "-D_I386MACH_ALLOW_HW_INTERRUPTS"
+
+export ac_cv_path_CC_FOR_TARGET="${HOST_PREFIX}gcc

--sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"

recipes-extended/xen/newlib.inc line 10

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+export CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}

${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"

recipes-extended/xen/newlib.inc line 12

Quoted 2 lines
recipes-extended/xen/newlib.inc new file +2 -0
+
+export ac_cv_path_CXX_FOR_TARGET="${HOST_PREFIX}g++

--sysroot=${RECIPE_SYSROOT}"

recipes-extended/xen/newlib.inc

Quoted 3 lines
recipes-extended/xen/newlib.inc new file +3 -0
+export CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_CPP_FOR_TARGET="${HOST_PREFIX}gcc -E

--sysroot=${RECIPE_SYSROOT}"

recipes-extended/xen/newlib.inc line 16

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+export CPP_FOR_TARGET="${HOST_PREFIX}gcc -E

--sysroot=${RECIPE_SYSROOT}"

recipes-extended/xen/newlib.inc line 18

Quoted 2 lines
recipes-extended/xen/newlib.inc new file +2 -0
+
+export ac_cv_path_LD_FOR_TARGET="${HOST_PREFIX}ld

--sysroot=${RECIPE_SYSROOT}"

Quoted 21 lines
recipes-extended/xen/newlib.inc new file +21 -0
+export LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+
+export ac_cv_path_AS_FOR_TARGET="${HOST_PREFIX}as"
+export AS_FOR_TARGET="${HOST_PREFIX}as"
+
+export ac_cv_path_AR_FOR_TARGET="${HOST_PREFIX}ar"
+export AR_FOR_TARGET="${HOST_PREFIX}ar"
+
+export ac_cv_path_NM_FOR_TARGET="${HOST_PREFIX}nm"
+export NM_FOR_TARGET="${HOST_PREFIX}nm"
+
+export ac_cv_path_RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+
+export ac_cv_path_OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+export OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump"
+
+export ac_cv_path_OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+export OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy"
+
+export ac_cv_path_STRIP_FOR_TARGET="${HOST_PREFIX}strip"

recipes-extended/xen/newlib.inc

Quoted 10 lines
recipes-extended/xen/newlib.inc new file +10 -0
+export STRIP_FOR_TARGET="${HOST_PREFIX}strip"
+
+export ac_cv_path_STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+export STRINGS_FOR_TARGET="${HOST_PREFIX}strings"
+
+export ac_cv_path_READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+export READELF_FOR_TARGET="${HOST_PREFIX}readelf"
+
+do_configure() {
+    ${S}/configure --verbose --prefix=${prefix}

--target=${GNU_TARGET_ARCH}-xen-elf --enable-newlib-io-long-long --disable-multilib

recipes-extended/xen/newlib.inc line 50

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+    find ${S} -type f | xargs perl -i.bak -pe 's/\b_(tzname|daylight|

timezone)\b/$1/g'

recipes-extended/xen/newlib.inc

Quoted 11 lines
recipes-extended/xen/newlib.inc new file +11 -0
+}
+
+do_compile() {
+    ${MAKE}
+}
+
+do_install() {
+    ${MAKE} DESTDIR=${D} install
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/share
+    rm -rf ${D}/cross-root-${XEN_TARGET_ARCH}/info
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdarg.h

-t ${D}/${includedir}

recipes-extended/xen/newlib.inc line 62

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stddef.h

-t ${D}/${includedir}

recipes-extended/xen/newlib.inc line 63

Quoted 1 line
recipes-extended/xen/newlib.inc new file +1 -0
+    install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdbool.h

-t ${D}/${includedir}

Review

Quoted 2 lines
recipes-extended/xen/newlib.inc new file +1 -0
+}
(quoted diff) +0 -0

b/recipes-extended/xen/newlib_1.16.0.bb

recipes-extended/xen/newlib_1.16.0.bb line 4

Quoted 9 lines

new file mode 100644
index 0000000..ea80271

recipes-extended/xen/newlib_1.16.0.bb new file +4 -0
@@ -0,0 +1,19 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Newlib is a C library intended for use on embedded

systems."

recipes-extended/xen/newlib_1.16.0.bb

Quoted 3 lines
recipes-extended/xen/newlib_1.16.0.bb new file +3 -0
+HOMEPAGE = "http://sourceware.org/newlib"
+LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
+LIC_FILES_CHKSUM = "file://COPYING.NEWLIB;md5=

950f50b290e8fcf7a2d3fff61775de9b"

recipes-extended/xen/newlib_1.16.0.bb line 8

Quoted 1 line
recipes-extended/xen/newlib_1.16.0.bb new file +1 -0
+

I see newlib in a few other oe layers, but nothing that looks to be common. For my
own understanding (and when someone asks me about this), is there any significant
difference in this newlib implementation/build than you'd find in other newlib use cases ?

recipes-extended/xen/newlib_1.16.0.bb

Quoted 5 lines
recipes-extended/xen/newlib_1.16.0.bb new file +5 -0
+S="${WORKDIR}/newlib"
+B="${WORKDIR}/build"
+
+SRC_URI += "\
+    git://sourceware.org/git/newlib-cygwin.git;protocol=

git;rev=newlib-${TRANSLATED_PV};destsuffix=newlib;nobranch=1;name=newlib \

Using tags for SRCREVs is generally frowned upon. Is that what this is doing ? Even if you want to
use the convenience variable you created, it would still be better to explicitly set SRCREV in the
recipes for easier maintenance and to make things more obvious.

recipes-extended/xen/newlib_1.16.0.bb line 15

Quoted 2 lines
recipes-extended/xen/newlib_1.16.0.bb new file +2 -0
+    file://newlib.patch;striplevel=0 \
+    file://newlib-chk.patch;striplevel=0 \

We really shouldn't be specifying striplevel on the patches. Why aren't the patches being
generated in a way that makes then consistent, and that can be applied with the defaults ?

Bruce

Quoted 8 lines
recipes-extended/xen/newlib_1.16.0.bb new file +4 -1
+    file://newlib-stdint-size_max-fix-from-1.17.0.patch;striplevel=1 \
+"
+
+require newlib.inc
--

2.14.2

Quoted 4 lines

--

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

is

Quoted 6 lines

prohibited. *
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

Signature · 11 lines
Kurt Bodiker
BrainTrust Holdings
www.braintrust-us.com
443-296-2186 office
410-750-2119 fax

-- 

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

PATCH 4/7 xen: PolarSSL recipe and patches for Xen stubdoms

In reply to Kurt Bodiker

From: kebodiker <[email protected]>

PolarSSL (now mbedTLS) is a lightweight SSL library optimized for embedded systems. In the case of Xen stubdomains, we are using MiniOS. This PolarSSL recipe creates a static library that is cross-compiled against MiniOS, Xen, LWIP, and Newlib headers and subsequently used during the cross-compilation and linking of the stubdom specific GMP, 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. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

---
 recipes-extended/xen/files/polarssl.patch | 64 +++++++++++++++++++++++++++++++
 recipes-extended/xen/polarssl.inc         | 25 ++++++++++++
 recipes-extended/xen/polarssl_1.1.4.bb    | 17 ++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 recipes-extended/xen/files/polarssl.patch
 create mode 100644 recipes-extended/xen/polarssl.inc
 create mode 100644 recipes-extended/xen/polarssl_1.1.4.bb
recipes-extended/xen/files/polarssl.patch new file +64 -0
new file mode 100644
index 0000000..d387d4e
@@ -0,0 +1,64 @@
+diff -Naur polarssl-1.1.4/include/polarssl/config.h polarssl-x86_64/include/polarssl/config.h
+--- polarssl-1.1.4/include/polarssl/config.h	2011-12-22 05:06:27.000000000 -0500
++++ polarssl-x86_64/include/polarssl/config.h	2012-10-30 17:18:07.567001000 -0400
+@@ -164,8 +164,8 @@
+  * application.
+  *
+  * Uncomment this macro to prevent loading of default entropy functions.
+-#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES
+  */
++#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES
+
+ /**
+  * \def POLARSSL_NO_PLATFORM_ENTROPY
+@@ -175,8 +175,8 @@
+  * standards like the /dev/urandom or Windows CryptoAPI.
+  *
+  * Uncomment this macro to disable the built-in platform entropy functions.
+-#define POLARSSL_NO_PLATFORM_ENTROPY
+  */
++#define POLARSSL_NO_PLATFORM_ENTROPY
+
+ /**
+  * \def POLARSSL_PKCS1_V21
+@@ -426,8 +426,8 @@
+  * Requires: POLARSSL_TIMING_C
+  *
+  * This module enables the HAVEGE random number generator.
+- */
+ #define POLARSSL_HAVEGE_C
++ */
+
+ /**
+  * \def POLARSSL_MD_C
+@@ -490,7 +490,7 @@
+  *
+  * This module provides TCP/IP networking routines.
+  */
+-#define POLARSSL_NET_C
++//#define POLARSSL_NET_C
+
+ /**
+  * \def POLARSSL_PADLOCK_C
+@@ -644,8 +644,8 @@
+  * Caller:  library/havege.c
+  *
+  * This module is used by the HAVEGE random number generator.
+- */
+ #define POLARSSL_TIMING_C
++ */
+
+ /**
+  * \def POLARSSL_VERSION_C
+diff -Naur polarssl-1.1.4/library/bignum.c polarssl-x86_64/library/bignum.c
+--- polarssl-1.1.4/library/bignum.c	2012-04-29 16:15:55.000000000 -0400
++++ polarssl-x86_64/library/bignum.c	2012-10-30 17:21:52.135000999 -0400
+@@ -1101,7 +1101,7 @@
+             Z.p[i - t - 1] = ~0;
+         else
+         {
+-#if defined(POLARSSL_HAVE_LONGLONG)
++#if 0 //defined(POLARSSL_HAVE_LONGLONG)
+             t_udbl r;
+
+             r  = (t_udbl) X.p[i] << biL;
recipes-extended/xen/polarssl.inc new file +25 -0
new file mode 100644
index 0000000..f90cd2f
@@ -0,0 +1,25 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+DEPENDS += "\
+    newlib \
+"
+STUBDOM_CFLAGS += "-Wno-memset-elt-size -Wno-implicit-fallthrough"
+
+# even though there's nothing to configure, we still need this to run the "make links" target in mini-os
+do_configure(){
+}
+
+do_compile() {
+    ${MAKE} CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"
+}
+
+do_install() {
+    install -d ${D}${includedir}
+    cp -r -t ${D}${includedir} ${S}/include/polarssl
+
+    install -d ${D}/${libdir}
+    install -m 644 -t ${D}/${libdir} ${S}/library/libpolarssl.a
+}
recipes-extended/xen/polarssl_1.1.4.bb new file +17 -0
new file mode 100644
index 0000000..2d4c2e0
@@ -0,0 +1,17 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "PolarSSL (now 'mbed TLS') is an open source, portable, easy to use, readable and flexible SSL library."
+HOMEPAGE = "https://tls.mbed.org"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe"
+
+S="${WORKDIR}/${PN}"
+B="${S}/library"
+
+SRC_URI += "\
+    git://github.com/ARMmbed/mbedtls.git;protocol=https;rev=${PN}-${PV};destsuffix=${PN};nobranch=1;name=${PN} \
+    file://polarssl.patch;striplevel=1 \
+"
+
+require polarssl.inc
Signature · 8 lines
2.14.2


-- 

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

Re: [PATCH 4/7] xen: PolarSSL recipe and patches for Xen stubdoms

Quoted 106 lines · Kurt Bodiker

From: kebodiker <[email protected]>

PolarSSL (now mbedTLS) is a lightweight SSL library optimized for embedded systems. In the case of Xen stubdomains, we are using MiniOS. This PolarSSL recipe creates a static library that is cross-compiled against MiniOS, Xen, LWIP, and Newlib headers and subsequently used during the cross-compilation and linking of the stubdom specific GMP, 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. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

---
 recipes-extended/xen/files/polarssl.patch | 64 +++++++++++++++++++++++++++++++
 recipes-extended/xen/polarssl.inc         | 25 ++++++++++++
 recipes-extended/xen/polarssl_1.1.4.bb    | 17 ++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 recipes-extended/xen/files/polarssl.patch
 create mode 100644 recipes-extended/xen/polarssl.inc
 create mode 100644 recipes-extended/xen/polarssl_1.1.4.bb
recipes-extended/xen/files/polarssl.patch new file +64 -0
new file mode 100644
index 0000000..d387d4e
@@ -0,0 +1,64 @@
+diff -Naur polarssl-1.1.4/include/polarssl/config.h polarssl-x86_64/include/polarssl/config.h
+--- polarssl-1.1.4/include/polarssl/config.h   2011-12-22 05:06:27.000000000 -0500
++++ polarssl-x86_64/include/polarssl/config.h  2012-10-30 17:18:07.567001000 -0400
+@@ -164,8 +164,8 @@
+  * application.
+  *
+  * Uncomment this macro to prevent loading of default entropy functions.
+-#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES
+  */
++#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES
+
+ /**
+  * \def POLARSSL_NO_PLATFORM_ENTROPY
+@@ -175,8 +175,8 @@
+  * standards like the /dev/urandom or Windows CryptoAPI.
+  *
+  * Uncomment this macro to disable the built-in platform entropy functions.
+-#define POLARSSL_NO_PLATFORM_ENTROPY
+  */
++#define POLARSSL_NO_PLATFORM_ENTROPY
+
+ /**
+  * \def POLARSSL_PKCS1_V21
+@@ -426,8 +426,8 @@
+  * Requires: POLARSSL_TIMING_C
+  *
+  * This module enables the HAVEGE random number generator.
+- */
+ #define POLARSSL_HAVEGE_C
++ */
+
+ /**
+  * \def POLARSSL_MD_C
+@@ -490,7 +490,7 @@
+  *
+  * This module provides TCP/IP networking routines.
+  */
+-#define POLARSSL_NET_C
++//#define POLARSSL_NET_C
+
+ /**
+  * \def POLARSSL_PADLOCK_C
+@@ -644,8 +644,8 @@
+  * Caller:  library/havege.c
+  *
+  * This module is used by the HAVEGE random number generator.
+- */
+ #define POLARSSL_TIMING_C
++ */
+
+ /**
+  * \def POLARSSL_VERSION_C
+diff -Naur polarssl-1.1.4/library/bignum.c polarssl-x86_64/library/bignum.c
+--- polarssl-1.1.4/library/bignum.c    2012-04-29 16:15:55.000000000 -0400
++++ polarssl-x86_64/library/bignum.c   2012-10-30 17:21:52.135000999 -0400
+@@ -1101,7 +1101,7 @@
+             Z.p[i - t - 1] = ~0;
+         else
+         {
+-#if defined(POLARSSL_HAVE_LONGLONG)
++#if 0 //defined(POLARSSL_HAVE_LONGLONG)
+             t_udbl r;
+
+             r  = (t_udbl) X.p[i] << biL;
recipes-extended/xen/polarssl.inc new file +6 -0
new file mode 100644
index 0000000..f90cd2f
@@ -0,0 +1,25 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+DEPENDS += "\

recipes-extended/xen/polarssl.inc line 16

Quoted 10 lines
recipes-extended/xen/polarssl.inc new file +10 -0
+    newlib \
+"
+STUBDOM_CFLAGS += "-Wno-memset-elt-size -Wno-implicit-fallthrough"
+
+# even though there's nothing to configure, we still need this to run the "make links" target in mini-os
+do_configure(){
+}
+
+do_compile() {
+    ${MAKE} CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}"

Is there a reason why oe_runmake doesn't work here ?

Quoted 19 lines
recipes-extended/xen/polarssl.inc new file +9 -0
+}
+
+do_install() {
+    install -d ${D}${includedir}
+    cp -r -t ${D}${includedir} ${S}/include/polarssl
+
+    install -d ${D}/${libdir}
+    install -m 644 -t ${D}/${libdir} ${S}/library/libpolarssl.a
+}
recipes-extended/xen/polarssl_1.1.4.bb new file +4 -0
new file mode 100644
index 0000000..2d4c2e0
@@ -0,0 +1,17 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "PolarSSL (now 'mbed TLS') is an open source, portable, easy to use, readable and flexible SSL library."

recipes-extended/xen/polarssl_1.1.4.bb line 14

Quoted 10 lines
recipes-extended/xen/polarssl_1.1.4.bb new file +10 -0
+HOMEPAGE = "https://tls.mbed.org"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe"
+
+S="${WORKDIR}/${PN}"
+B="${S}/library"
+
+SRC_URI += "\
+    git://github.com/ARMmbed/mbedtls.git;protocol=https;rev=${PN}-${PV};destsuffix=${PN};nobranch=1;name=${PN} \
+    file://polarssl.patch;striplevel=1 \

same striplevel comment.

Bruce

Quoted 17 lines
recipes-extended/xen/polarssl_1.1.4.bb new file +3 -1
+"
+
+require polarssl.inc
--

2.14.2

--

*This email and all attachments are considered confidential and the proprietary information of BrainTrust Holdings. Unauthorized disclosure is prohibited. *
--
_______________________________________________
meta-virtualization mailing list [email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#14 lore raw

PATCH 5/7 xen: GMP recipe for Xen stubdoms

In reply to Kurt Bodiker

From: kebodiker <[email protected]>

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.

---
 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
recipes-extended/xen/stubdom-gmp.inc new file +36 -0
new file mode 100644
index 0000000..c4dd3f8
@@ -0,0 +1,36 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# 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
+}
recipes-extended/xen/stubdom-gmp_4.3.2.bb new file +20 -0
new file mode 100644
index 0000000..bac3415
@@ -0,0 +1,20 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# 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
Signature · 8 lines
2.14.2


-- 

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

PATCH 6/7 xen: TPM Emulator for Xen stubdoms

In reply to Kurt Bodiker

From: kebodiker <[email protected]>

TPM Emulator is a software-based TPM and MTM emulator. This TPM Emulator recipe creates a static library that is cross-compiled against MiniOS, Xen, LWIP, Newlib, PolarSSL, and the stubdom-specific GMP headers and subsequently used during the cross-compilation and linking of the Xen vTPM and vTPM Manager stubdomains.

The current Xen source code is hardcoded to fetch a specific version of this package. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches.

---
 recipes-extended/xen/files/tpmemu-0.7.4.patch      |  12 ++
 recipes-extended/xen/files/vtpm-bufsize.patch      |  13 ++
 recipes-extended/xen/files/vtpm-cmake-Wextra.patch |  21 +++
 .../xen/files/vtpm-deepquote-anyloc.patch          | 127 +++++++++++++
 recipes-extended/xen/files/vtpm-deepquote.patch    | 187 ++++++++++++++++++++
 .../xen/files/vtpm-implicit-fallthrough.patch      |  10 ++
 recipes-extended/xen/files/vtpm-locality.patch     |  50 ++++++
 .../xen/files/vtpm-parent-sign-ek.patch            | 196 +++++++++++++++++++++
 recipes-extended/xen/tpm-emulator.inc              |  31 ++++
 recipes-extended/xen/tpm-emulator_0.7.4.bb         |  26 +++
 10 files changed, 673 insertions(+)
 create mode 100644 recipes-extended/xen/files/tpmemu-0.7.4.patch
 create mode 100644 recipes-extended/xen/files/vtpm-bufsize.patch
 create mode 100644 recipes-extended/xen/files/vtpm-cmake-Wextra.patch
 create mode 100644 recipes-extended/xen/files/vtpm-deepquote-anyloc.patch
 create mode 100644 recipes-extended/xen/files/vtpm-deepquote.patch
 create mode 100644 recipes-extended/xen/files/vtpm-implicit-fallthrough.patch
 create mode 100644 recipes-extended/xen/files/vtpm-locality.patch
 create mode 100644 recipes-extended/xen/files/vtpm-parent-sign-ek.patch
 create mode 100644 recipes-extended/xen/tpm-emulator.inc
 create mode 100644 recipes-extended/xen/tpm-emulator_0.7.4.bb
recipes-extended/xen/files/tpmemu-0.7.4.patch new file +12 -0
new file mode 100644
index 0000000..b84eff1
@@ -0,0 +1,12 @@
+diff -Naur tpm_emulator-x86_64-back/tpm/tpm_emulator_extern.c tpm_emulator-x86_64/tpm/tpm_emulator_extern.c
+--- tpm_emulator-x86_64-back/tpm/tpm_emulator_extern.c	2012-04-27 10:55:46.581963398 -0400
++++ tpm_emulator-x86_64/tpm/tpm_emulator_extern.c	2012-04-27 10:56:02.193034152 -0400
+@@ -249,7 +249,7 @@
+ #else /* TPM_NO_EXTERN */
+
+ int (*tpm_extern_init)(void)                                      = NULL;
+-int (*tpm_extern_release)(void)                                   = NULL;
++void (*tpm_extern_release)(void)                                   = NULL;
+ void* (*tpm_malloc)(size_t size)                                  = NULL;
+ void (*tpm_free)(/*const*/ void *ptr)                             = NULL;
+ void (*tpm_log)(int priority, const char *fmt, ...)               = NULL;
recipes-extended/xen/files/vtpm-bufsize.patch new file +13 -0
new file mode 100644
index 0000000..9c9304c
@@ -0,0 +1,13 @@
+diff --git a/config.h.in b/config.h.in
+index d16a997..8088a2a 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -27,7 +27,7 @@
+ #define TPM_STORAGE_NAME "${TPM_STORAGE_NAME}"
+ #define TPM_DEVICE_NAME  "${TPM_DEVICE_NAME}"
+ #define TPM_LOG_FILE     "${TPM_LOG_FILE}"
+-#define TPM_CMD_BUF_SIZE 4096
++#define TPM_CMD_BUF_SIZE 4088
+ 
+ #endif /* _CONFIG_H_ */
+ 
recipes-extended/xen/files/vtpm-cmake-Wextra.patch new file +21 -0
new file mode 100644
index 0000000..a603654
@@ -0,0 +1,21 @@
+---
+ CMakeLists.txt |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: tpm_emulator-x86_64/CMakeLists.txt
+===================================================================
+--- tpm_emulator-x86_64.orig/CMakeLists.txt
++++ tpm_emulator-x86_64/CMakeLists.txt
+@@ -40,10 +40,11 @@ set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_e
+ set(TPM_DEVICE_NAME "/dev/tpm")
+ endif()
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+-add_definitions(-Wall -Werror -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
++add_definitions(-Wall -Werror)
+ if("${CMAKE_SYSTEM}" MATCHES "Linux")
+     add_definitions(-Wextra)
+ endif()
++add_definitions(-Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
+ if(USE_OPENSSL)
+     add_definitions(-DUSE_OPENSSL)
+ endif()
recipes-extended/xen/files/vtpm-deepquote-anyloc.patch new file +127 -0

127 lines not on this page · raw message

recipes-extended/xen/files/vtpm-deepquote.patch new file +187 -0

187 lines not on this page · raw message

recipes-extended/xen/files/vtpm-implicit-fallthrough.patch new file +10 -0
new file mode 100644
index 0000000..db97be5
@@ -0,0 +1,10 @@
+--- tpm_emulator-x86_64/tpm/tpm_cmd_handler.c.orig	2017-04-27 13:37:14.408000000 +0200
++++ tpm_emulator-x86_64/tpm/tpm_cmd_handler.c	2017-04-27 13:39:53.585000000 +0200
+@@ -3397,6 +3397,7 @@
+                   sizeof(rsp->auth2->nonceOdd.nonce));
+       tpm_hmac_update(&hmac, (BYTE*)&rsp->auth2->continueAuthSession, 1);
+       tpm_hmac_final(&hmac, rsp->auth2->auth);
++      /* fall-thru */
+     case TPM_TAG_RSP_AUTH1_COMMAND:
+       tpm_hmac_init(&hmac, rsp->auth1->secret, sizeof(rsp->auth1->secret));
+       tpm_hmac_update(&hmac, rsp->auth1->digest, sizeof(rsp->auth1->digest));
recipes-extended/xen/files/vtpm-locality.patch new file +50 -0

50 lines not on this page · raw message

recipes-extended/xen/files/vtpm-parent-sign-ek.patch new file +196 -0

196 lines not on this page · raw message

recipes-extended/xen/tpm-emulator.inc new file +31 -0
new file mode 100644
index 0000000..5cc4f02
@@ -0,0 +1,31 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+DEPENDS += "\
+    cmake-native \
+    newlib \
+    stubdom-gmp \
+"
+
+# even though there's nothing to configure, we still need this to run the "make links" target in mini-os
+do_configure(){
+}
+
+export CMAKE_C_FLAGS = "-std=c99 -DTPM_NO_EXTERN ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS} -Wno-declaration-after-statement -Wno-implicit-fallthrough"
+
+do_compile() {
+    CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" cmake .. -DCMAKE_C_FLAGS:STRING="${CMAKE_C_FLAGS}"
+    ${MAKE} VERBOSE=1 tpm_crypto tpm
+}
+
+do_install() {
+    install -d ${D}/${libdir}
+    install -m 644 -t ${D}/${libdir} ${B}/crypto/libtpm_crypto.a
+    install -m 644 -t ${D}/${libdir} ${B}/tpm/libtpm.a
+
+    install -D -m 644 -t ${D}/${includedir}/tpm-emulator/build ${S}/build/config.h
+    install -D -m 644 -t ${D}/${includedir}/tpm-emulator/crypto ${S}/crypto/*.h
+    install -D -m 644 -t ${D}/${includedir}/tpm-emulator/tpm ${S}/tpm/*.h    
+}
recipes-extended/xen/tpm-emulator_0.7.4.bb new file +26 -0
new file mode 100644
index 0000000..ec14e51
@@ -0,0 +1,26 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "TPM Emulator"
+HOMEPAGE = "http://xenbits.xen.org/xen-extfiles"
+LICENSE = "GPL"
+LIC_FILES_CHKSUM = "file://README;md5=eeabd77cf8fd8a8bc42983884cb09863"
+
+SRC_URI += "\
+    http://xenbits.xen.org/xen-extfiles/tpm_emulator-${PV}.tar.gz;name=${PN} \
+    file://tpmemu-0.7.4.patch;striplevel=1 \
+    file://vtpm-bufsize.patch;striplevel=1 \
+    file://vtpm-locality.patch;striplevel=1 \
+    file://vtpm-parent-sign-ek.patch;striplevel=1 \
+    file://vtpm-deepquote.patch;striplevel=1 \
+    file://vtpm-deepquote-anyloc.patch;striplevel=1 \
+    file://vtpm-cmake-Wextra.patch;striplevel=1 \
+    file://vtpm-implicit-fallthrough.patch;striplevel=1 \
+"
+SRC_URI[tpm-emulator.md5sum] = "e26becb8a6a2b6695f6b3e8097593db8"
+SRC_URI[tpm-emulator.sha256sum] = "4e48ea0d83dd9441cc1af04ab18cd6c961b9fa54d5cbf2c2feee038988dea459"
+
+S="${WORKDIR}/tpm_emulator-${PV}"
+B="${S}/build"
+
+require tpm-emulator.inc
Signature · 8 lines
2.14.2


-- 

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

PATCH 7/7 xen: vTPM and vTPM Manager stubdoms for Xen

In reply to Kurt Bodiker

From: kebodiker <[email protected]>

The vTPM stubdomain allows a virtual TPM to be created and used to provide TPM functionality to Xen guest domains. The vTPM Manager stubdomain seals the secrets of each vTPM to the physical TPM, thereby extending the chain of trust to the virtual machines in Xen. More information on Xen vTPMs found at
https://xenbits.xen.org/docs/unstable/man/xen-vtpm.7.html This xen-vtpm recipe uses Xen/stubdom source tree to build the Xen vTPM and vTPM Manager binaries and MiniOS source tree to build the Xen vTPM and vTPM Manager stubdomains.

---
 recipes-extended/xen/xen-vtpm.inc    | 97 ++++++++++++++++++++++++++++++++++++
 recipes-extended/xen/xen-vtpm_1.0.bb | 16 ++++++
 2 files changed, 113 insertions(+)
 create mode 100644 recipes-extended/xen/xen-vtpm.inc
 create mode 100644 recipes-extended/xen/xen-vtpm_1.0.bb
recipes-extended/xen/xen-vtpm.inc new file +97 -0
new file mode 100644
index 0000000..4337bb9
@@ -0,0 +1,97 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require stubdom.inc
+
+DEPENDS += "\
+    newlib \
+    lwip \
+    polarssl \
+    stubdom-gmp \
+    tpm-emulator \
+"
+
+# redefine everything ??? maybe just need to blank out HOST_CC_ARCH, HOST_LD_ARCH, HOST_AS_ARCH?
+export CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}"
+export CCLD="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}"
+export CXX="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}"
+export CPP="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}"
+export LD="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+export LD_LTO="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}"
+export AS="${HOST_PREFIX}as"
+export AR="${HOST_PREFIX}ar"
+export NM="${HOST_PREFIX}nm"
+export RANLIB="${HOST_PREFIX}ranlib"
+export OBJDUMP="${HOST_PREFIX}objdump"
+export OBJCOPY="${HOST_PREFIX}objcopy"
+export STRIP="${HOST_PREFIX}strip"
+export STRINGS="${HOST_PREFIX}strings"
+export READELF="${HOST_PREFIX}readelf"
+
+
+# Required for some of the config stuff ---> still?
+export STUBDOM_TARGETS="vtpm vtpmmgr"
+
+VTPM_CPPFLAGS = "-I${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/build"
+VTPM_CPPFLAGS += "-I${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/crypto"
+VTPM_CPPFLAGS += "-I${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/tpm"
+VTPM_CPPFLAGS += "-I${RECIPE_SYSROOT}/cross-root-${XEN_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator"
+
+# including from here instead of recipe sysroot prevents us from poisoning our includes.
+STUBDOM_CPPFLAGS += "-isystem ${WORKDIR}/xen/tools/xenstore/include/"
+
+do_configure() {
+
+    # GCC 7 fails linking header defined inlines if not declared 'static' or 'extern'
+    # This was fixed in Xen 4.10.0+, so we need to look at version of Xen source we're using
+    # to determine if we need to modify inline declarations.
+    # 'echo -e' to enable interpretation of backslashes
+    # 'sort -V' to natural sort version numbers
+    # 'head -n1' to capture the first line of output from sort command
+    if [ "${XEN_VERSION}" = `echo -e "${XEN_VERSION}\n4.9.999" | sort -V | head -n1` ]; then
+        sed -i "s/^inline/static inline/g" ${WORKDIR}/xen/stubdom/vtpmmgr/*.h
+    fi
+
+    for i in AR AS NM RANLIB OBJDUMP OBJCOPY STRIP STRINGS READELF CXX LD LD_LTO CC CPP; do
+        sed -i "s/^\($i\s\s*\).*=/\1?=/" ${WORKDIR}/xen/config/StdGNU.mk
+        sed -i "s/^\($i\s\s*\).*=/\1?=/" ${WORKDIR}/mini-os/Config.mk
+    done
+
+    # replicate the TARGETS_MINIOS target in xen/stubdom/Makefile
+    for i in ${STUBDOM_TARGETS}; do
+        [ -d ${WORKDIR}/xen/stubdom/mini-os-${XEN_TARGET_ARCH}-$i ] ||
+        for j in $(cd ${WORKDIR}/mini-os ; find . -type d) ; do \
+                mkdir -p ${WORKDIR}/xen/stubdom/mini-os-${XEN_TARGET_ARCH}-$i/$j; \
+        done    
+    done
+
+    ${MAKE} MINIOS_CONFIG="${WORKDIR}/xen/stubdom/vtpm/minios.cfg" CONFIG_FILE="${WORKDIR}/xen/stubdom/vtpm-minios-config.mk" DESTDIR= -C ${WORKDIR}/mini-os config
+    ${MAKE} MINIOS_CONFIG="${WORKDIR}/xen/stubdom/vtpmmgr/minios.cfg" CONFIG_FILE="${WORKDIR}/xen/stubdom/vtpmmgr-minios-config.mk" DESTDIR= -C ${WORKDIR}/mini-os config
+}
+
+do_compile() {
+
+    
+    CPPFLAGS="`cat ${WORKDIR}/xen/stubdom/vtpm-minios-config.mk` ${STUBDOM_CPPFLAGS} ${VTPM_CPPFLAGS}" CFLAGS="${STUBDOM_CFLAGS}" ${MAKE} -C ${WORKDIR}/xen/stubdom/vtpm
+    DEF_CPPFLAGS="${STUBDOM_CPPFLAGS}" DEF_CFLAGS="${STUBDOM_CFLAGS}" DEF_LDFLAGS="${STUBDOM_LDFLAGS}" MINIOS_CONFIG="${WORKDIR}/xen/stubdom/vtpm/minios.cfg" ${MAKE} -C ${WORKDIR}/mini-os OBJ_DIR=${WORKDIR}/xen/stubdom/mini-os-x86_64-vtpm APP_OBJS="${WORKDIR}/xen/stubdom/vtpm/vtpm.a" APP_LDLIBS="-ltpm -ltpm_crypto -lgmp -lpolarssl"
+
+    CPPFLAGS="`cat ${WORKDIR}/xen/stubdom/vtpmmgr-minios-config.mk` ${STUBDOM_CPPFLAGS}" CFLAGS="${STUBDOM_CFLAGS}" ${MAKE} -C ${WORKDIR}/xen/stubdom/vtpmmgr
+    DEF_CPPFLAGS="${STUBDOM_CPPFLAGS}" DEF_CFLAGS="${STUBDOM_CFLAGS}" DEF_LDFLAGS="${STUBDOM_LDFLAGS}" MINIOS_CONFIG="${WORKDIR}/xen/stubdom/vtpmmgr/minios.cfg" ${MAKE} -C ${WORKDIR}/mini-os OBJ_DIR=${WORKDIR}/xen/stubdom/mini-os-x86_64-vtpmmgr APP_OBJS="${WORKDIR}/xen/stubdom/vtpmmgr/vtpmmgr.a" APP_LDLIBS="-lm -lpolarssl"
+}
+
+PACKAGES = "\
+    ${PN}-vtpm-stubdom \
+    ${PN}-vtpmmgr-stubdom \
+"
+FILES_${PN}-vtpm-stubdom="\
+    ${libdir}/xen/boot/vtpm-stubdom.gz \
+"
+    
+FILES_${PN}-vtpmmgr-stubdom="\
+    ${libdir}/xen/boot/vtpmmgr-stubdom.gz \
+"
+    
+do_install() {
+    install -m 644 -D ${B}/stubdom/mini-os-${XEN_TARGET_ARCH}-vtpm/mini-os.gz ${D}${libdir}/xen/boot/vtpm-stubdom.gz
+    install -m 644 -D ${B}/stubdom/mini-os-${XEN_TARGET_ARCH}-vtpmmgr/mini-os.gz ${D}${libdir}/xen/boot/vtpmmgr-stubdom.gz
+}
recipes-extended/xen/xen-vtpm_1.0.bb new file +16 -0
new file mode 100644
index 0000000..f5b21b4
@@ -0,0 +1,16 @@
+# Copyright (C) 2017 Kurt Bodiker <[email protected]>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "MiniOS-based vTPMs for Xen"
+HOMEPAGE = "https://www.xenproject.org"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095"
+
+SRC_URI += "\
+    git://xenbits.xen.org/xen.git;protocol=git;rev=RELEASE-${XEN_VERSION};nobranch=1;destsuffix=xen;name=xen \
+"
+
+S="${WORKDIR}/xen"
+B="${S}"
+
+require xen-vtpm.inc
Signature · 8 lines
2.14.2


-- 

*This email and all attachments are considered confidential and the 
proprietary information of BrainTrust Holdings.  Unauthorized disclosure is 
prohibited.  *
#17 lore raw
In reply to Kurt Bodiker
Quoted 26 lines · Kurt Bodiker

This patchset introduces the basic recipes necessary to build Xen stubdomains, in particular the vTPM and vTPM Manager stubdomains. vTPM stubdomains provide Xen guest domains access to a virtualized TPM. The vTPM Manager stubdomain manages each of the vTPM domains and seals them to the physical TPM. The intention of this patchset is to provide the ability to build Xen stubdomains separately from the rest of the Xen components since the stubdomains have separate dependencies that are hard-coded within the Xen build and configuration files. Separating the stubdomain recipes and dependencies from the rest of the Xen build gives the ability to use newer or different libraries than what is currently used.

The stubdom.inc file defines a set of CPPFLAGS, CFLAGS, and LDFLAGS common for building all Xen stubdomains. Xen stubdomains are cross-compiled with the MiniOS, which creates some issues when trying to compile stubdomains in an OpenEmbedded environment. To address these issues and to ensure the stubdoms are built as Xen had intended, all of the build flags and build tools that are exported into the environment by OE have been unset. Each of the new recipes introduced here then implements the build flags and the tools as though the build had been run in the bare-metal environment.

Xen vTPM stubdomains have depencencies on static libraries for newlib, polarssl, gmp, and tpm emulator. Xen vTPM Manager stubdomain has dependencies on static libraries for newlib and polarssl.

Quoted 8 lines

The newlib, polarssl, gmp, and tpm emulator recipes are constructed to behave the same as a bare-metal build. These recipes are cross-compiled against both the Xen and MiniOS source code.

The xen-vtpm recipe is responsible for building and installing the vTPM and vTPM Manager stubdomain images into the Xen boot directory. xen-vtpm would need to be added to DISTRO_FEATURES the similar for what is done for Xen.

I don't have any major issues with the series, I'll wait another day or so to see
if there are any comments, and will merge it after that.

Cheers,

Bruce

Quoted 81 lines

kebodiker (7):
xen: Define the standard values needed for stubdoms
xen: LWIP source code with patches applied for stubdoms
xen: Newlib recipe and patches for Xen stubdoms
xen: PolarSSL recipe and patches for Xen stubdoms
xen: GMP recipe for Xen stubdoms
xen: TPM Emulator for Xen stubdoms
xen: vTPM and vTPM Manager stubdoms for Xen

 .../lwip.dhcp_create_request-hwaddr_len.patch      |   13 +
 recipes-extended/xen/files/lwip.patch-cvs          | 2398 ++++++++++++++++++++
 recipes-extended/xen/files/newlib-chk.patch        |  155 ++
 .../newlib-stdint-size_max-fix-from-1.17.0.patch   |   16 +
 recipes-extended/xen/files/newlib.patch            |  727 ++++++
 recipes-extended/xen/files/polarssl.patch          |   64 +
 recipes-extended/xen/files/tpmemu-0.7.4.patch      |   12 +
 recipes-extended/xen/files/vtpm-bufsize.patch      |   13 +
 recipes-extended/xen/files/vtpm-cmake-Wextra.patch |   21 +
 .../xen/files/vtpm-deepquote-anyloc.patch          |  127 ++
 recipes-extended/xen/files/vtpm-deepquote.patch    |  187 ++
 .../xen/files/vtpm-implicit-fallthrough.patch      |   10 +
 recipes-extended/xen/files/vtpm-locality.patch     |   50 +
 .../xen/files/vtpm-parent-sign-ek.patch            |  196 ++
 recipes-extended/xen/lwip.inc                      |   22 +
 recipes-extended/xen/lwip_1.3.0.bb                 |   22 +
 recipes-extended/xen/newlib.inc                    |   64 +
 recipes-extended/xen/newlib_1.16.0.bb              |   19 +
 recipes-extended/xen/polarssl.inc                  |   25 +
 recipes-extended/xen/polarssl_1.1.4.bb             |   17 +
 recipes-extended/xen/stubdom-gmp.inc               |   36 +
 recipes-extended/xen/stubdom-gmp_4.3.2.bb          |   20 +
 recipes-extended/xen/stubdom.inc                   |  141 ++
 recipes-extended/xen/tpm-emulator.inc              |   31 +
 recipes-extended/xen/tpm-emulator_0.7.4.bb         |   26 +
 recipes-extended/xen/xen-vtpm.inc                  |   97 +
 recipes-extended/xen/xen-vtpm_1.0.bb               |   16 +
 27 files changed, 4525 insertions(+)
 create mode 100644 recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch
 create mode 100644 recipes-extended/xen/files/lwip.patch-cvs
 create mode 100644 recipes-extended/xen/files/newlib-chk.patch
 create mode 100644 recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch
 create mode 100644 recipes-extended/xen/files/newlib.patch
 create mode 100644 recipes-extended/xen/files/polarssl.patch
 create mode 100644 recipes-extended/xen/files/tpmemu-0.7.4.patch
 create mode 100644 recipes-extended/xen/files/vtpm-bufsize.patch
 create mode 100644 recipes-extended/xen/files/vtpm-cmake-Wextra.patch
 create mode 100644 recipes-extended/xen/files/vtpm-deepquote-anyloc.patch
 create mode 100644 recipes-extended/xen/files/vtpm-deepquote.patch
 create mode 100644 recipes-extended/xen/files/vtpm-implicit-fallthrough.patch
 create mode 100644 recipes-extended/xen/files/vtpm-locality.patch
 create mode 100644 recipes-extended/xen/files/vtpm-parent-sign-ek.patch
 create mode 100644 recipes-extended/xen/lwip.inc
 create mode 100644 recipes-extended/xen/lwip_1.3.0.bb
 create mode 100644 recipes-extended/xen/newlib.inc
 create mode 100644 recipes-extended/xen/newlib_1.16.0.bb
 create mode 100644 recipes-extended/xen/polarssl.inc
 create mode 100644 recipes-extended/xen/polarssl_1.1.4.bb
 create mode 100644 recipes-extended/xen/stubdom-gmp.inc
 create mode 100644 recipes-extended/xen/stubdom-gmp_4.3.2.bb
 create mode 100644 recipes-extended/xen/stubdom.inc
 create mode 100644 recipes-extended/xen/tpm-emulator.inc
 create mode 100644 recipes-extended/xen/tpm-emulator_0.7.4.bb
 create mode 100644 recipes-extended/xen/xen-vtpm.inc
 create mode 100644 recipes-extended/xen/xen-vtpm_1.0.bb

--
2.14.2

--

*This email and all attachments are considered confidential and the proprietary information of BrainTrust Holdings. Unauthorized disclosure is prohibited. *
--
_______________________________________________
meta-virtualization mailing list [email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#18 lore raw
Quoted 32 lines · Bruce Ashfield
Quoted 30 lines · Kurt Bodiker

This patchset introduces the basic recipes necessary to build Xen stubdomains, in particular the vTPM and vTPM Manager stubdomains. vTPM stubdomains provide Xen guest domains access to a virtualized TPM. The vTPM Manager stubdomain manages each of the vTPM domains and seals them to the physical TPM. The intention of this patchset is to provide the ability to build Xen stubdomains separately from the rest of the Xen components since the stubdomains have separate dependencies that are hard-coded within the Xen build and configuration files. Separating the stubdomain recipes and dependencies from the rest of the Xen build gives the ability to use newer or different libraries than what is currently used.

The stubdom.inc file defines a set of CPPFLAGS, CFLAGS, and LDFLAGS common for building all Xen stubdomains. Xen stubdomains are cross-compiled with the MiniOS, which creates some issues when trying to compile stubdomains in an OpenEmbedded environment. To address these issues and to ensure the stubdoms are built as Xen had intended, all of the build flags and build tools that are exported into the environment by OE have been unset. Each of the new recipes introduced here then implements the build flags and the tools as though the build had been run in the bare-metal environment.

Xen vTPM stubdomains have depencencies on static libraries for newlib, polarssl, gmp, and tpm emulator. Xen vTPM Manager stubdomain has dependencies on static libraries for newlib and polarssl.

The newlib, polarssl, gmp, and tpm emulator recipes are constructed to behave the same as a bare-metal build. These recipes are cross-compiled against both the Xen and MiniOS source code.

Quoted 9 lines
Quoted 4 lines

The xen-vtpm recipe is responsible for building and installing the vTPM and vTPM Manager stubdomain images into the Xen boot directory. xen-vtpm would need to be added to DISTRO_FEATURES the similar for what is done for Xen.

I don't have any major issues with the series, I'll wait another day or so to see
if there are any comments, and will merge it after that.

I'm supportive of this work going into meta-virtualization.

The recipes are well-structured, clear, commented and comprehensible. The components of the stubdom are built with individual OE recipes, which is good, and much preferred over driving a single build with the monolithic upstream Makefile: it will make it easier to work with the individual recipes to upgrade component versions in a standard OE manner.

Location of recipe files:
This series introduces many recipes into recipes-extended/xen. I think that is fair and appropriate to locate them there - they are the set of external components and versions specified in the Xen stubdom code base, they are built to be deployed in conjunction with the Xen binaries, and it makes sense to co-locate them.

README:
It think it would helpful to add some introduction text to recipes-extended/xen/README to explain that the recipes for these components are there because they are the software specified in the upstream Xen stubdom tree, and also include some of the text from this series's cover letter -- in particular noting that the build for these recipes will proceed with the host machine's compiler and build tools, not those of OE native due to the minios cross-compile challenges.

Christopher