aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/xen-stubdom')
-rw-r--r--app-emulation/xen-stubdom/Manifest6
-rw-r--r--app-emulation/xen-stubdom/files/newlib-implicits.patch149
-rw-r--r--app-emulation/xen-stubdom/files/xen-4-CVE-2012-6075-XSA-41.patch39
-rw-r--r--app-emulation/xen-stubdom/files/xen-4-fix_dotconfig-gcc.patch245
-rw-r--r--app-emulation/xen-stubdom/files/xen-4.2.0-jserver.patch32
-rw-r--r--app-emulation/xen-stubdom/files/xen-4.2.1-externals.patch74
-rw-r--r--app-emulation/xen-stubdom/xen-stubdom-4.2.1.ebuild112
7 files changed, 657 insertions, 0 deletions
diff --git a/app-emulation/xen-stubdom/Manifest b/app-emulation/xen-stubdom/Manifest
new file mode 100644
index 0000000..713c70e
--- /dev/null
+++ b/app-emulation/xen-stubdom/Manifest
@@ -0,0 +1,6 @@
+DIST grub-0.97.tar.gz 971783 SHA256 4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b SHA512 c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a3628bd00ba4d14a54742bc04848110eb3ae8ca25dbfbaabadb WHIRLPOOL 0ad7f5dc035e2a3ad5fd29b6388f06fd12a8cc694117b4cbd42b5302433aa522db23566222d35219fe17fb95edb5090553156198507f70208eda5d858fd52dd5
+DIST lwip-1.3.0.tar.gz 398933 SHA256 772e4d550e07826665ed0528c071dd5404ef7dbe1825a38c8adbc2a00bca948f SHA512 1465b58279af1647f909450e394fe002ca165f0ff4a0254bfa9fe0e64316f50facdde2729d79a4e632565b4500cf4d6c74192ac0dd3bc9fe09129bbd67ba089d WHIRLPOOL 63bdd9eb70f168ba2006a8f4bbe166b68528abe8364b23cdc1d468ccc4b137bb3447bf90695920f016e09d53d3b93ccf6e3697b3c46840f00b794789cb424acc
+DIST newlib-1.16.0.tar.gz 12024353 SHA256 db426394965c48c1d29023e1cc6d965ea6b9a9035d8a849be2750ca4659a3d07 SHA512 40eb96bbc6736a16b6399e0cdb73e853d0d90b685c967e77899183446664d64570277a633fdafdefc351b46ce210a99115769a1d9f47ac749d7e82837d4d1ac3 WHIRLPOOL 47f7afd525f482d79d9e964f0e75ee8a77e59551bd19cd94f9b95ac3af9406afa381c9d8d224f76eb568441ab613b2b194f8e5be50aa222f9ed2d9b9761829db
+DIST pciutils-2.2.9.tar.bz2 212265 SHA256 f60ae61cfbd5da1d849d0beaa21f593c38dac9359f0b3ddc612f447408265b24 SHA512 2b3d98d027e46d8c08037366dde6f0781ca03c610ef2b380984639e4ef39899ed8d8b8e4cd9c9dc54df101279b95879bd66bfd4d04ad07fef41e847ea7ae32b5 WHIRLPOOL ce801947fcf7ba0b56710029f25e746d3e03a80699af9d3570efcd417b12b546264f286b2e78b1402cca766c08e35bdd0ff0a692ab4ad419295f00bcfe91130e
+DIST xen-4.2.1.tar.gz 15593695 SHA256 fb8df5827ce3e2d2d3b078d9e5afde502beb5e7ab9442e51a94087061bd450c6 SHA512 fe27a965e2b34035bd025482eda9fc4d4e82523c929323fd30813367d5ffbe2fa1ed3d7d4479f2632e8b5625972448b7bd6a7768e8dc1dcd1b6747d281cc1a9e WHIRLPOOL 226bbed059541e804f1a44e721023ffbc04bae43000653b1d7d6a9bfec0d9efbf7a48b1b0a7ad3fcb8e34f8b91e1c620c2a8eddf97baad487e9db37d49a58f37
+DIST zlib-1.2.3.tar.gz 496597 SHA256 1795c7d067a43174113fdf03447532f373e1c6c57c08d61d9e4e9be5e244b05e SHA512 021b958fcd0d346c4ba761bcf0cc40f3522de6186cf5a0a6ea34a70504ce9622b1c2626fce40675bc8282cf5f5ade18473656abc38050f72f5d6480507a2106e WHIRLPOOL 8fd7010faf6a48a9c7ff4bcfe3ce4fe9061eb541259e0a2d0def214e8c4becf2b22e8d6f96f65ca827abffeaa9d96e95ed2402844f99835f7b079fc9f3e84276
diff --git a/app-emulation/xen-stubdom/files/newlib-implicits.patch b/app-emulation/xen-stubdom/files/newlib-implicits.patch
new file mode 100644
index 0000000..73c0493
--- /dev/null
+++ b/app-emulation/xen-stubdom/files/newlib-implicits.patch
@@ -0,0 +1,149 @@
+diff -ur newlib-1.16.0.orig/newlib/libc/stdlib/wcstoull.c newlib-1.16.0/newlib/libc/stdlib/wcstoull.c
+--- newlib/libc/stdlib/wcstoull.c 2007-07-07 04:03:28.000000000 +0800
++++ newlib/libc/stdlib/wcstoull.c 2012-12-02 14:19:40.905136553 +0800
+@@ -124,7 +124,7 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <reent.h>
+-
++#include <wchar.h>
+ #ifndef _REENT_ONLY
+
+ unsigned long long
+diff -ur newlib-1.16.0.orig/newlib/doc/makedoc.c
+newlib-1.16.0/newlib/doc/makedoc.c
+--- newlib/doc/makedoc.c 2007-01-03 01:59:59.000000000 +0900
++++ newlib/doc/makedoc.c 2012-12-02 16:53:42.700289294 +0800
+@@ -39,7 +39,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <ctype.h>
+-
++#include <string.h>
+ #define DEF_SIZE 5000
+ #define STACK 50
+
+diff -ur newlib-1.16.0.orig/newlib/libc/reent/lseek64r.c newlib-1.16.0/newlib/libc/reent/lseek64r.c
+--- newlib/libc/reent/lseek64r.c 2003-06-04 03:48:07.000000000 +0800
++++ newlib/libc/reent/lseek64r.c 2012-12-02 18:29:45.435760985 +0800
+@@ -1,8 +1,8 @@
+ /* Reentrant versions of lseek system call. */
+
+-#include <reent.h>
++#include "../include/reent.h"
+ #include <unistd.h>
+-#include <_syslist.h>
++#include "../include/_syslist.h"
+
+ /* Some targets provides their own versions of this functions. Those
+ targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
+diff -ur newlib-1.16.0.orig/newlib/libc/stdio64/fseeko64.c newlib-1.16.0/newlib/libc/stdio64/fseeko64.c
+--- newlib/libc/stdio64/fseeko64.c 2007-07-14 04:37:53.000000000 +0800
++++ newlib/libc/stdio64/fseeko64.c 2012-12-02 18:26:29.955778906 +0800
+@@ -119,7 +119,7 @@
+ ptr->_errno = EOVERFLOW;
+ return EOF;
+ }
+- return (_off64_t) _fseeko_r (ptr, fp, offset, whence);
++ return (_off64_t) _fseeko64_r (ptr, fp, offset, whence);
+ }
+
+ /* Make sure stdio is set up. */
+
+diff -ur newlib-1.16.0.orig/newlib/libc/reent/fstat64r.c newlib-1.16.0/newlib/libc/reent/fstat64r.c
+--- newlib/libc/reent/fstat64r.c 2012-12-03 13:17:26.569703981 +0800
++++ newlib/libc/reent/fstat64r.c 2003-06-04 03:48:07.000000000 +0800
+@@ -1,10 +1,10 @@
+ /* Reentrant versions of fstat system call. This implementation just
+ calls the fstat system call. */
+
+-#include <reent.h>
++#include "../include/reent.h">
+ #include <unistd.h>
+ #include <sys/stat.h>
+-#include <_syslist.h>
++#include "../include/_syslist.h"
+
+ #ifdef __LARGE64_FILES
+
+diff -ur newlib-1.16.0.orig/libgloss/i386/cygmon-gmon.c newlib-1.16.0/libgloss/i386/cygmon-gmon.c
+--- libgloss/i386/cygmon-gmon.c 2002-10-26 03:18:46.000000000 +0800
++++ libgloss/i386/cygmon-gmon.c 2012-12-03 14:38:41.454257066 +0800
+@@ -68,6 +68,9 @@
+
+ #include "cygmon-gmon.h"
+
++#include <unistd.h>
++#include <stdlib.h>
++#include <strings.h>
+ /*
+ * froms is actually a bunch of unsigned shorts indexing tos
+ */
+@@ -78,6 +78,8 @@
+ static char *s_lowpc = 0;
+ static char *s_highpc = 0;
+ static unsigned long s_textsize = 0;
++extern void profil_write(int, char*, int);
++extern int moncontrol (int);
+
+ static int ssiz;
+ static char *sbuf;
+diff -ur newlib-1.16.0.orig/newlib/libc/include/_syslist.h
+newlib-1.16.0/newlib/libc/include/_syslist.h
+--- newlib/libc/include/_syslist.h 2005-08-23 05:13:35.000000000 +0800
++++ newlib/libc/include/_syslist.h 2012-12-03 17:20:03.092369483 +0800
+@@ -2,6 +2,7 @@
+ and only provide C names, so that we end up in violation of ANSI */
+ #ifndef __SYSLIST_H
+ #define __SYSLIST_H
++#include <sys/types.h>
+
+ #ifdef MISSING_SYSCALL_NAMES
+ #define _close close
+
+#diff -ur newlib-1.16.0.orig/newlib/libc/Makefile.in newlib-1.16.0/newlib/libc/Makefile.in
+#--- newlib/libc/Makefile.in 2007-05-25 01:33:30.000000000 +0800
+#+++ newlib/libc/Makefile.in 2012-12-03 21:52:05.621873084 +0800
+diff -ur newlib-1.16.0.orig/newlib/libc/stdio64/ftello64.c newlib-1.16.0/newlib/libc/stdio64/ftello64.c
+--- newlib/libc/stdio64/ftello64.c 2007-07-14 04:37:53.000000000 +0800
++++ newlib/libc/stdio64/ftello64.c 2012-12-04 18:34:46.491509484 +0800
+@@ -93,7 +93,7 @@
+
+ /* Only do 64-bit tell on large file. */
+ if (!(fp->_flags & __SL64))
+- return (_off64_t) _ftello_r (ptr, fp);
++ return (_off64_t) _ftello64_r (ptr, fp);
+
+ /* Ensure stdio is set up. */
+
+diff -ur newlib-1.16.0.orig/newlib/libc/reent/open64r.c newlib-1.16.0/newlib/libc/reent/open64r.c
+--- newlib/libc/reent/open64r.c 2002-08-27 02:56:06.000000000 +0800
++++ newlib/libc/reent/open64r.c 2012-12-04 20:06:10.044006769 +0800
+@@ -1,8 +1,8 @@
+ /* Reentrant versions of open system call. */
+
+-#include <reent.h>
++#include "../include/reent.h">
+ #include <unistd.h>
+-#include <fcntl.h>
++#include <sys/_default_fcntl.h>
+ #include <_syslist.h>
+
+ #ifdef __LARGE64_FILES
+diff -ur newlib-1.16.0.orig/newlib/libc/reent/signalr.c newlib-1.16.0/newlib/libc/reent/signalr.c
+--- newlib/libc/reent/signalr.c 2012-12-05 07:33:25.623393126 +0800
++++ newlib/libc/reent/signalr.c 2012-12-05 07:34:03.943389613 +0800
+@@ -1,10 +1,10 @@
+ /* Reentrant versions of syscalls need to support signal/raise.
+ These implementations just call the usual system calls. */
+
+-#include <reent.h>
++#include "../include/reent.h"
+ #include <signal.h>
+ #include <unistd.h>
+-#include <_syslist.h>
++#include "../include/_syslist.h"
+
+ /* Some targets provides their own versions of these functions. Those
+ targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
+
diff --git a/app-emulation/xen-stubdom/files/xen-4-CVE-2012-6075-XSA-41.patch b/app-emulation/xen-stubdom/files/xen-4-CVE-2012-6075-XSA-41.patch
new file mode 100644
index 0000000..7513ac3
--- /dev/null
+++ b/app-emulation/xen-stubdom/files/xen-4-CVE-2012-6075-XSA-41.patch
@@ -0,0 +1,39 @@
+authorMichael Contreras <michael@inetric.com>
+ Mon, 3 Dec 2012 04:11:22 +0000 (20:11 -0800)
+committerAnthony Liguori <aliguori@us.ibm.com>
+ Mon, 3 Dec 2012 14:14:10 +0000 (08:14 -0600)
+
+The e1000_receive function for the e1000 needs to discard packets longer than
+1522 bytes if the SBP and LPE flags are disabled. The linux driver assumes
+this behavior and allocates memory based on this assumption.
+
+Signed-off-by: Michael Contreras <michael@inetric.com>
+Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
+hw/e1000.c
+
+--- tools/qemu-xen/hw/e1000.c
++++ tools/qemu-xen/hw/e1000.c
+@@ -59,6 +59,9 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
+ #define PNPMMIO_SIZE 0x20000
+ #define MIN_BUF_SIZE 60 /* Min. octets in an ethernet frame sans FCS */
+
++/* this is the size past which hardware will drop packets when setting LPE=0 */
++#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
++
+ /*
+ * HW models:
+ * E1000_DEV_ID_82540EM works with Windows and Linux
+@@ -805,6 +808,13 @@ e1000_receive(NetClientState *nc, const uint8_t *buf, size_t size)
+ size = sizeof(min_buf);
+ }
+
++ /* Discard oversized packets if !LPE and !SBP. */
++ if (size > MAXIMUM_ETHERNET_VLAN_SIZE
++ && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)
++ && !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
++ return size;
++ }
++
+ if (!receive_filter(s, buf, size))
+ return size;
+
diff --git a/app-emulation/xen-stubdom/files/xen-4-fix_dotconfig-gcc.patch b/app-emulation/xen-stubdom/files/xen-4-fix_dotconfig-gcc.patch
new file mode 100644
index 0000000..4e08a30
--- /dev/null
+++ b/app-emulation/xen-stubdom/files/xen-4-fix_dotconfig-gcc.patch
@@ -0,0 +1,245 @@
+# Fix gcc-4.6
+diff -ur xen-4.2.0.orig/extras/mini-os/minios.mk xen-4.2.0/extras/mini-os/minios.mk
+--- extras/mini-os/minios.mk 2012-09-17 18:21:17.000000000 +0800
++++ extras/mini-os/minios.mk 2012-12-05 14:01:10.653260260 +0800
+@@ -6,7 +6,7 @@
+
+ # Define some default flags.
+ # NB. '-Wcast-qual' is nasty, so I omitted it.
+-DEF_CFLAGS += -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format -Wno-redundant-decls
++DEF_CFLAGS += -fno-builtin -Wall -Wredundant-decls -Wno-format -Wno-redundant-decls
+ DEF_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
+ DEF_CFLAGS += $(call cc-option,$(CC),-fgnu89-inline)
+ DEF_CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
+diff -ur xen-4.2.0.orig/tools/libxc/Makefile xen-4.2.0/tools/libxc/Makefile
+--- tools/libxc/Makefile 2012-09-17 18:21:18.000000000 +0800
++++ tools/libxc/Makefile 2012-12-05 14:01:10.653260260 +0800
+@@ -73,7 +73,7 @@
+
+ -include $(XEN_TARGET_ARCH)/Makefile
+
+-CFLAGS += -Werror -Wmissing-prototypes
++CFLAGS += -Wmissing-prototypes
+ CFLAGS += -I. $(CFLAGS_xeninclude)
+
+ # Needed for posix_fadvise64() in xc_linux.c
+# Drop .config
+diff -ur xen-4.2.0.orig/Config.mk xen-4.2.0/Config.mk
+--- Config.mk 2012-09-17 18:23:12.000000000 +0800
++++ Config.mk 2012-12-05 14:01:10.641260261 +0800
+@@ -7,7 +7,6 @@ Drop .config
+ # fallback for older make
+ realpath = $(wildcard $(foreach file,$(1),$(shell cd -P $(dir $(file)) && echo "$$PWD/$(notdir $(file))")))
+
+--include $(XEN_ROOT)/.config
+
+ # A debug build of Xen and tools?
+ debug ?= n
+@@ -24,7 +24,7 @@
+
+ # Tools to run on system hosting the build
+ HOSTCC = gcc
+-HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
++HOSTCFLAGS = -Wstrict-prototypes -O2 -fomit-frame-pointer
+ HOSTCFLAGS += -fno-strict-aliasing
+
+ DISTDIR ?= $(XEN_ROOT)/dist
+@@ -156,7 +156,7 @@
+
+ CFLAGS += -std=gnu99
+
+-CFLAGS += -Wall -Wstrict-prototypes
++CFLAGS += -Wstrict-prototypes
+
+ # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
+ # and is over-zealous with the printf format lint
+diff -ur xen-4.2.1.orig/tools/blktap2/drivers/Makefile xen-4.2.1/tools/blktap2/drivers/Makefile
+--- tools/blktap2/drivers/Makefile 2012-12-17 23:00:11.000000000 +0800
++++ tools/blktap2/drivers/Makefile 2013-01-30 12:31:43.539941099 +0800
+@@ -9,7 +9,7 @@
+ LOCK_UTIL = lock-util
+ INST_DIR = $(SBINDIR)
+
+-CFLAGS += -Werror -g
++CFLAGS += -g
+ CFLAGS += -Wno-unused
+ CFLAGS += -fno-strict-aliasing
+ CFLAGS += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
+diff -ur xen-4.2.1.orig/tools/debugger/gdbsx/Rules.mk xen-4.2.1/tools/debugger/gdbsx/Rules.mk
+--- tools/debugger/gdbsx/Rules.mk 2012-12-17 23:00:22.000000000 +0800
++++ tools/debugger/gdbsx/Rules.mk 2013-01-30 12:31:43.516941098 +0800
+@@ -1,4 +1,4 @@
+ include $(XEN_ROOT)/tools/Rules.mk
+
+-CFLAGS += -Werror -Wmissing-prototypes
++CFLAGS += -Wmissing-prototypes
+ # (gcc 4.3x and later) -Wconversion -Wno-sign-conversion
+diff -ur xen-4.2.1.orig/tools/debugger/xenitp/Makefile xen-4.2.1/tools/debugger/xenitp/Makefile
+--- tools/debugger/xenitp/Makefile 2012-12-17 23:00:22.000000000 +0800
++++ tools/debugger/xenitp/Makefile 2013-01-30 12:31:43.516941098 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=$(CURDIR)/../../..
+ include $(XEN_ROOT)/tools/Rules.mk
+
+-#CFLAGS += -Werror -g -O0
++#CFLAGS += -g -O0
+
+ CFLAGS += $(CFLAGS_libxenctrl)
+
+diff -ur xen-4.2.1.orig/tools/libaio/harness/Makefile xen-4.2.1/tools/libaio/harness/Makefile
+--- tools/libaio/harness/Makefile 2012-12-17 23:00:35.000000000 +0800
++++ tools/libaio/harness/Makefile 2013-01-30 12:31:43.541941099 +0800
+@@ -4,7 +4,7 @@
+ HARNESS_SRCS:=main.c
+ # io_queue.c
+
+-CFLAGS=-Wall -Werror -g -O -laio
++CFLAGS=-Wall -g -O -laio
+ #-lpthread -lrt
+
+ all: $(PROGS)
+diff -ur xen-4.2.1.orig/tools/libfsimage/Rules.mk xen-4.2.1/tools/libfsimage/Rules.mk
+--- tools/libfsimage/Rules.mk 2012-12-17 23:00:36.000000000 +0800
++++ tools/libfsimage/Rules.mk 2013-01-30 12:31:43.515941097 +0800
+@@ -1,7 +1,7 @@
+ include $(XEN_ROOT)/tools/Rules.mk
+
+ CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
+-CFLAGS += -Werror -D_GNU_SOURCE
++CFLAGS += -D_GNU_SOURCE
+ LDFLAGS += -L../common/
+
+ PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
+diff -ur xen-4.2.1.orig/tools/libxl/Makefile xen-4.2.1/tools/libxl/Makefile
+--- tools/libxl/Makefile 2012-12-17 23:01:08.000000000 +0800
++++ tools/libxl/Makefile 2013-01-30 12:31:43.541941099 +0800
+@@ -11,7 +11,7 @@
+ XLUMAJOR = 1.0
+ XLUMINOR = 1
+
+-CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \
++CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
+ -Wno-declaration-after-statement -Wformat-nonliteral
+ CFLAGS += -I. -fPIC
+
+diff -ur xen-4.2.1.orig/tools/qemu-xen/pc-bios/optionrom/Makefile xen-4.2.1/tools/qemu-xen/pc-bios/optionrom/Makefile
+--- tools/qemu-xen/pc-bios/optionrom/Makefile 2012-09-11 02:10:52.000000000 +0800
++++ tools/qemu-xen/pc-bios/optionrom/Makefile 2013-01-30 12:31:43.528941098 +0800
+@@ -9,7 +9,7 @@
+
+ .PHONY : all clean build-all
+
+-CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
++CFLAGS := -Wall -Wstrict-prototypes -fomit-frame-pointer -fno-builtin
+ CFLAGS += -I$(SRC_PATH)
+ CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector)
+ QEMU_CFLAGS = $(CFLAGS)
+diff -ur xen-4.2.1.orig/tools/vtpm/Rules.mk xen-4.2.1/tools/vtpm/Rules.mk
+--- tools/vtpm/Rules.mk 2012-12-17 23:01:35.000000000 +0800
++++ tools/vtpm/Rules.mk 2013-01-30 12:31:43.515941097 +0800
+@@ -6,7 +6,7 @@
+ #
+
+ # General compiler flags
+-CFLAGS = -Werror -g3
++CFLAGS = -g3
+
+ # Generic project files
+ HDRS = $(wildcard *.h)
+diff -ur xen-4.2.1.orig/tools/vtpm_manager/Rules.mk xen-4.2.1/tools/vtpm_manager/Rules.mk
+--- tools/vtpm_manager/Rules.mk 2012-12-17 23:01:35.000000000 +0800
++++ tools/vtpm_manager/Rules.mk 2013-01-30 12:31:43.511941097 +0800
+@@ -6,7 +6,7 @@
+ #
+
+ # General compiler flags
+-CFLAGS = -Werror -g3
++CFLAGS = -g3
+
+ # Generic project files
+ HDRS = $(wildcard *.h)
+diff -ur xen-4.2.1.orig/tools/xenstat/xentop/Makefile xen-4.2.1/tools/xenstat/xentop/Makefile
+--- tools/xenstat/xentop/Makefile 2012-12-17 23:01:35.000000000 +0800
++++ tools/xenstat/xentop/Makefile 2013-01-30 12:31:43.535941098 +0800
+@@ -18,7 +18,7 @@
+ all install xentop:
+ else
+
+-CFLAGS += -DGCC_PRINTF -Wall -Werror $(CFLAGS_libxenstat)
++CFLAGS += -DGCC_PRINTF -Wall $(CFLAGS_libxenstat)
+ LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(SOCKET_LIBS)
+ CFLAGS += -DHOST_$(XEN_OS)
+
+diff -ur xen-4.2.1.orig/xen/arch/arm/Rules.mk xen-4.2.1/xen/arch/arm/Rules.mk
+--- xen/arch/arm/Rules.mk 2012-12-17 23:01:37.000000000 +0800
++++ xen/arch/arm/Rules.mk 2013-01-30 12:31:43.498941097 +0800
+@@ -9,7 +9,7 @@
+ HAS_DEVICE_TREE := y
+
+ CFLAGS += -fno-builtin -fno-common -Wredundant-decls
+-CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
++CFLAGS += -iwithprefix include -Wno-pointer-arith -pipe
+ CFLAGS += -I$(BASEDIR)/include
+
+ # Prevent floating-point variables from creeping into Xen.
+diff -ur xen-4.2.1.orig/xen/arch/x86/Rules.mk xen-4.2.1/xen/arch/x86/Rules.mk
+--- xen/arch/x86/Rules.mk 2012-12-17 23:01:37.000000000 +0800
++++ xen/arch/x86/Rules.mk 2013-01-30 12:31:43.490941096 +0800
+@@ -24,7 +24,7 @@
+ endif
+
+ CFLAGS += -fno-builtin -fno-common -Wredundant-decls
+-CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
++CFLAGS += -iwithprefix include -Wno-pointer-arith -pipe
+ CFLAGS += -I$(BASEDIR)/include
+ CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
+ CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
+diff -ur xen-4.2.1.orig/xen/include/Makefile xen-4.2.1/xen/include/Makefile
+--- xen/include/Makefile 2012-12-17 23:01:55.000000000 +0800
++++ xen/include/Makefile 2013-01-30 12:31:43.502941097 +0800
+@@ -78,7 +78,7 @@
+ all: headers.chk
+
+ headers.chk: $(filter-out public/arch-% public/%ctl.h public/xsm/% public/%hvm/save.h, $(wildcard public/*.h public/*/*.h) $(public-y)) Makefile
+- for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wall -W -Werror -S -o /dev/null -xc $$i || exit 1; echo $$i; done >$@.new
++ for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wall -W -S -o /dev/null -xc $$i || exit 1; echo $$i; done >$@.new
+ mv $@.new $@
+
+ endif
+diff -ur xen-4.2.1.orig/tools/tests/mce-test/tools/Makefile xen-4.2.1/tools/tests/mce-test/tools/Makefile
+--- tools/tests/mce-test/tools/Makefile 2012-12-17 23:01:35.000000000 +0800
++++ tools/tests/mce-test/tools/Makefile 2013-01-30 13:01:44.890020152 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=$(CURDIR)/../../../..
+ include $(XEN_ROOT)/tools/Rules.mk
+
+-CFLAGS += -Werror
++CFLAGS +=
+ CFLAGS += $(CFLAGS_libxenctrl)
+ CFLAGS += $(CFLAGS_libxenguest)
+ CFLAGS += $(CFLAGS_libxenstore)
+diff -ur xen-4.2.1.orig/tools/tests/mem-sharing/Makefile xen-4.2.1/tools/tests/mem-sharing/Makefile
+--- tools/tests/mem-sharing/Makefile 2012-12-17 23:01:35.000000000 +0800
++++ tools/tests/mem-sharing/Makefile 2013-01-30 13:01:44.890020152 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=$(CURDIR)/../../..
+ include $(XEN_ROOT)/tools/Rules.mk
+
+-CFLAGS += -Werror
++CFLAGS +=
+
+ CFLAGS += $(CFLAGS_libxenctrl)
+ CFLAGS += $(CFLAGS_xeninclude)
+diff -ur xen-4.2.1.orig/tools/tests/xen-access/Makefile xen-4.2.1/tools/tests/xen-access/Makefile
+--- tools/tests/xen-access/Makefile 2012-12-17 23:01:35.000000000 +0800
++++ tools/tests/xen-access/Makefile 2013-01-30 13:01:44.891020152 +0800
+@@ -1,7 +1,7 @@
+ XEN_ROOT=$(CURDIR)/../../..
+ include $(XEN_ROOT)/tools/Rules.mk
+
+-CFLAGS += -Werror
++CFLAGS +=
+
+ CFLAGS += $(CFLAGS_libxenctrl)
+ CFLAGS += $(CFLAGS_libxenguest)
+
diff --git a/app-emulation/xen-stubdom/files/xen-4.2.0-jserver.patch b/app-emulation/xen-stubdom/files/xen-4.2.0-jserver.patch
new file mode 100644
index 0000000..514fd05
--- /dev/null
+++ b/app-emulation/xen-stubdom/files/xen-4.2.0-jserver.patch
@@ -0,0 +1,32 @@
+diff -ur xen-4.2.0.orig/tools/tests/x86_emulator/Makefile xen-4.2.0/tools/tests/x86_emulator/Makefile
+--- tools/tests/x86_emulator/Makefile 2012-09-17 18:21:19.000000000 +0800
++++ tools/tests/x86_emulator/Makefile 2012-11-24 05:06:24.355778737 +0800
+@@ -14,13 +14,13 @@
+ .PHONY: blowfish.h
+ blowfish.h:
+ rm -f blowfish.bin
+- XEN_TARGET_ARCH=x86_32 make -f blowfish.mk all
++ XEN_TARGET_ARCH=x86_32 $(MAKE) -f blowfish.mk all
+ (echo "static unsigned int blowfish32_code[] = {"; \
+ od -v -t x blowfish.bin | sed 's/^[0-9]* /0x/' | sed 's/ /, 0x/g' | sed 's/$$/,/';\
+ echo "};") >$@
+ rm -f blowfish.bin
+ ifeq ($(XEN_COMPILE_ARCH),x86_64)
+- XEN_TARGET_ARCH=x86_64 make -f blowfish.mk all
++ XEN_TARGET_ARCH=x86_64 $(MAKE) -f blowfish.mk all
+ (echo "static unsigned int blowfish64_code[] = {"; \
+ od -v -t x blowfish.bin | sed 's/^[0-9]* /0x/' | sed 's/ /, 0x/g' | sed 's/$$/,/';\
+ echo "};") >>$@
+
+diff -ur xen-4.2.0.orig/tools/firmware/vgabios/Makefile xen-4.2.0/tools/firmware/vgabios/Makefile
+--- tools/firmware/vgabios/Makefile 2013-02-04 13:56:50.973533544 +0800
++++ tools/firmware/vgabios/Makefile 2013-02-04 13:57:21.380535958 +0800
+@@ -27,7 +27,7 @@
+
+ .PHONY: release
+ release:
+- VGABIOS_VERS=\"-DVGABIOS_VERS=\\\"$(RELVERS)\\\"\" make bios cirrus-bios
++ VGABIOS_VERS=\"-DVGABIOS_VERS=\\\"$(RELVERS)\\\"\" $(MAKE) bios cirrus-bios
+ /bin/rm -f *.o *.s *.ld86 \
+ temp.awk.* vgabios.*.orig _vgabios_.*.c core *.bak .#*
+ cp VGABIOS-lgpl-latest.bin ../$(RELEASE).bin
diff --git a/app-emulation/xen-stubdom/files/xen-4.2.1-externals.patch b/app-emulation/xen-stubdom/files/xen-4.2.1-externals.patch
new file mode 100644
index 0000000..2c3b1b7
--- /dev/null
+++ b/app-emulation/xen-stubdom/files/xen-4.2.1-externals.patch
@@ -0,0 +1,74 @@
+# Patch Makefile to patch insource newlib,
+# Prevent internal downloading of external packages
+diff -ur xen-4.2.0.orig/stubdom/Makefile xen-4.2.0/stubdom/Makefile
+--- stubdom/Makefile 2012-09-17 18:21:17.000000000 +0800
++++ stubdom/Makefile 2012-12-05 14:01:10.694260256 +0800
+@@ -95,12 +95,13 @@
+ ##############
+
+ newlib-$(NEWLIB_VERSION).tar.gz:
+- $(WGET) $(NEWLIB_URL)/$@
++# $(WGET) $(NEWLIB_URL)/$@
+
+ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
+ tar xzf $<
+ patch -d $@ -p0 < newlib.patch
+ patch -d $@ -p0 < newlib-chk.patch
++ patch -d $@ -p0 < newlib-implicits.patch
+ patch -d $@ -p1 < newlib-stdint-size_max-fix-from-1.17.0.patch
+ find $@ -type f | xargs perl -i.bak \
+ -pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
+@@ -110,7 +110,7 @@
+ $(NEWLIB_STAMPFILE): mk-headers-$(XEN_TARGET_ARCH) newlib-$(NEWLIB_VERSION)
+ mkdir -p newlib-$(XEN_TARGET_ARCH)
+ ( cd newlib-$(XEN_TARGET_ARCH) && \
+- CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
++ CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) LDFLAGS= RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
+ $(MAKE) DESTDIR= && \
+ $(MAKE) DESTDIR= install )
+
+@@ -121,7 +122,7 @@
+ ############
+
+ zlib-$(ZLIB_VERSION).tar.gz:
+- $(WGET) $(ZLIB_URL)/$@
++# $(WGET) $(ZLIB_URL)/$@
+
+ zlib-$(XEN_TARGET_ARCH): zlib-$(ZLIB_VERSION).tar.gz
+ tar xzf $<
+@@ -141,7 +142,7 @@
+ ##############
+
+ pciutils-$(LIBPCI_VERSION).tar.bz2:
+- $(WGET) $(LIBPCI_URL)/$@
++# $(WGET) $(LIBPCI_URL)/$@
+
+ pciutils-$(XEN_TARGET_ARCH): pciutils-$(LIBPCI_VERSION).tar.bz2
+ tar xjf $<
+@@ -169,7 +170,7 @@
+ ######
+
+ lwip-$(LWIP_VERSION).tar.gz:
+- $(WGET) $(LWIP_URL)/$@
++# $(WGET) $(LWIP_URL)/$@
+
+ lwip-$(XEN_TARGET_ARCH): lwip-$(LWIP_VERSION).tar.gz
+ tar xzf $<
+@@ -325,7 +326,7 @@
+ ######
+
+ grub-$(GRUB_VERSION).tar.gz:
+- $(WGET) $(GRUB_URL)/$@
++#$(WGET) $(GRUB_URL)/$@
+
+ grub-upstream: grub-$(GRUB_VERSION).tar.gz
+ tar xzf $<
+@@ -392,7 +393,7 @@
+ $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
+ $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-ioemu/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/ioemu-stubdom.gz"
+
+-install-grub: pv-grub
++install-grub:
+ $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
+ $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz"
+
diff --git a/app-emulation/xen-stubdom/xen-stubdom-4.2.1.ebuild b/app-emulation/xen-stubdom/xen-stubdom-4.2.1.ebuild
new file mode 100644
index 0000000..4f05418
--- /dev/null
+++ b/app-emulation/xen-stubdom/xen-stubdom-4.2.1.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+PYTHON_DEPEND="2:2.6"
+
+inherit flag-o-matic eutils multilib python toolchain-funcs
+
+XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles"
+LIBPCI_URL=ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci
+GRUB_URL=mirror://gnu-alpha/grub
+SRC_URI="
+ http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz
+ $GRUB_URL/grub-0.97.tar.gz
+ $XEN_EXTFILES_URL/zlib-1.2.3.tar.gz
+ $LIBPCI_URL/pciutils-2.2.9.tar.bz2
+ $XEN_EXTFILES_URL/lwip-1.3.0.tar.gz
+ $XEN_EXTFILES_URL/newlib/newlib-1.16.0.tar.gz"
+
+S="${WORKDIR}/xen-${PV}"
+
+DESCRIPTION="allows XEN HVM guests to be run in a stubdom which improves isolation and performance."
+HOMEPAGE="http://xen.org/"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="custom-cflags"
+
+DEPEND="sys-devel/gettext"
+
+RDEPEND=">=app-emulation/xen-4.2.1"
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+}
+
+src_prepare() {
+
+ # if the user *really* wants to use their own custom-cflags, let them
+ if use custom-cflags; then
+ einfo "User wants their own CFLAGS - removing defaults"
+ # try and remove all the default custom-cflags
+ find "${S}" -name Makefile -o -name Rules.mk -o -name Config.mk -exec sed \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
+ -i {} \;
+ fi
+
+ #Substitute for internal downloading
+ cp $DISTDIR/zlib-1.2.3.tar.gz \
+ $DISTDIR/pciutils-2.2.9.tar.bz2 \
+ $DISTDIR/lwip-1.3.0.tar.gz \
+ $DISTDIR/newlib-1.16.0.tar.gz \
+ $DISTDIR/grub-0.97.tar.gz \
+ ./stubdom/ || die "files not coped to stubdom"
+ einfo "files copied to stubdom"
+
+ # Patch the unmergeable newlib, fix most of the leftover gcc QA issues
+ cp "${FILESDIR}"/newlib-implicits.patch stubdom || die
+
+ # Patch stubdom/Makefile to patch insource newlib & prevent internal downloading
+ epatch "${FILESDIR}"/${P/-stubdom/}-externals.patch
+
+ # Drop .config and Fix gcc-4.6
+ epatch "${FILESDIR}"/${PN/-stubdom/}-4-fix_dotconfig-gcc.patch
+
+ # fix jobserver in Makefile
+ epatch "${FILESDIR}"/${PN/-stubdom/}-4.2.0-jserver.patch
+
+ #Sec patch
+ epatch "${FILESDIR}"/${PN/-stubdom/}-4-CVE-2012-6075-XSA-41.patch
+}
+
+src_compile() {
+ use custom-cflags || unset CFLAGS
+ if test-flag-CC -fno-strict-overflow; then
+ append-flags -fno-strict-overflow
+ fi
+
+ emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" -C tools/include
+
+ if use x86; then
+ emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" \
+ XEN_TARGET_ARCH="x86_32" -C stubdom genpath ioemu-stubdom
+ elif use amd64; then
+ emake CC="$(tc-getCC)" LD="$(tc-getLD)" \
+ XEN_TARGET_ARCH="x86_64" -C stubdom genpath ioemu-stubdom
+ fi
+}
+
+src_install() {
+ if use x86; then
+ emake XEN_TARGET_ARCH="x86_32" DESTDIR="${D}" -C stubdom install-ioemu
+ fi
+ if use amd64; then
+ emake XEN_TARGET_ARCH="x86_64" DESTDIR="${D}" -C stubdom install-ioemu
+ fi
+}
+
+pkg_postinst() {
+ elog " Official Xen Guide and the unoffical wiki page:"
+ elog " http://www.gentoo.org/doc/en/xen-guide.xml"
+ elog " http://en.gentoo-wiki.com/wiki/Xen/"
+ elog " Xen stubdom information"
+ elog " http://wiki.xen.org/wiki/Device_Model_Stub_Domains"
+}
+