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

[Xen-devel] [PATCH] stubdom: use host's gcc



stubdom: use host's gcc

This makes stubdom use the host's gcc instead of downloading/compiling
binutils+gcc.  That requires a bunch of changes and even uncovered a few
bugs, but saves a lot of time.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r ec1559924974 extras/mini-os/Config.mk
--- a/extras/mini-os/Config.mk  Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/Config.mk  Fri Jul 04 17:15:59 2008 +0100
@@ -38,15 +38,15 @@
 # This must be before include minios.mk!
 include $(MINI-OS_ROOT)/$(TARGET_ARCH_DIR)/arch.mk
 
-extra_incl := $(foreach dir,$(EXTRA_INC),-I$(MINI-OS_ROOT)/include/$(dir))
+extra_incl := $(foreach dir,$(EXTRA_INC),-I$(realpath 
$(MINI-OS_ROOT)/include/$(dir)))
 
-DEF_CPPFLAGS += -I$(MINI-OS_ROOT)/include
+DEF_CPPFLAGS += -I$(realpath $(MINI-OS_ROOT)/include)
 DEF_CPPFLAGS += -D__MINIOS__
 
 ifeq ($(libc),y)
 DEF_CPPFLAGS += -DHAVE_LIBC
-DEF_CPPFLAGS += -I$(MINI-OS_ROOT)/include/posix
-DEF_CPPFLAGS += -I$(XEN_ROOT)/tools/xenstore
+DEF_CPPFLAGS += -I$(realpath $(MINI-OS_ROOT)/include/posix)
+DEF_CPPFLAGS += -I$(realpath $(XEN_ROOT)/tools/xenstore)
 endif
 
 ifneq ($(LWIPDIR),)
diff -r ec1559924974 extras/mini-os/arch/x86/mm.c
--- a/extras/mini-os/arch/x86/mm.c      Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/arch/x86/mm.c      Fri Jul 04 17:15:59 2008 +0100
@@ -549,7 +549,7 @@
 #define L2_P2M_MASK     (L2_P2M_ENTRIES - 1)    
 #define L3_P2M_MASK     (L3_P2M_ENTRIES - 1)    
     
-    unsigned long *l1_list, *l2_list, *l3_list;
+    unsigned long *l1_list = NULL, *l2_list = NULL, *l3_list;
     unsigned long pfn;
     
     l3_list = (unsigned long *)alloc_page(); 
diff -r ec1559924974 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/blkfront.c Fri Jul 04 17:15:59 2008 +0100
@@ -84,7 +84,7 @@
     free(dev);
 }
 
-struct blkfront_dev *init_blkfront(char *nodename, struct blkfront_info *info)
+struct blkfront_dev *init_blkfront(char *_nodename, struct blkfront_info *info)
 {
     xenbus_transaction_t xbt;
     char* err;
@@ -93,11 +93,9 @@
     int retry=0;
     char* msg;
     char* c;
+    char* nodename = _nodename ? _nodename : "device/vbd/768";
 
     struct blkfront_dev *dev;
-
-    if (!nodename)
-        nodename = "device/vbd/768";
 
     char path[strlen(nodename) + 1 + 10 + 1];
 
@@ -342,13 +340,14 @@
 void blkfront_io(struct blkfront_aiocb *aiocbp, int write)
 {
     unsigned long flags;
+    DEFINE_WAIT(w);
+
     ASSERT(!aiocbp->aio_cb);
     aiocbp->aio_cb = blkfront_aio_cb;
     blkfront_aio(aiocbp, write);
     aiocbp->data = NULL;
 
     local_irq_save(flags);
-    DEFINE_WAIT(w);
     while (1) {
        blkfront_aio_poll(aiocbp->aio_dev);
        if (aiocbp->data)
@@ -393,6 +392,7 @@
 void blkfront_sync(struct blkfront_dev *dev)
 {
     unsigned long flags;
+    DEFINE_WAIT(w);
 
     if (dev->info.mode == O_RDWR) {
         if (dev->info.barrier == 1)
@@ -404,7 +404,6 @@
 
     /* Note: This won't finish if another thread enqueues requests.  */
     local_irq_save(flags);
-    DEFINE_WAIT(w);
     while (1) {
        blkfront_aio_poll(dev);
        if (RING_FREE_REQUESTS(&dev->ring) == RING_SIZE(&dev->ring))
@@ -424,6 +423,7 @@
     RING_IDX rp, cons;
     struct blkif_response *rsp;
     int more;
+    int nr_consumed;
 
 moretodo:
 #ifdef HAVE_LIBC
@@ -437,14 +437,17 @@
     rmb(); /* Ensure we see queued responses up to 'rp'. */
     cons = dev->ring.rsp_cons;
 
-    int nr_consumed = 0;
+    nr_consumed = 0;
     while ((cons != rp))
     {
+        struct blkfront_aiocb *aiocbp;
+        int status;
+
        rsp = RING_GET_RESPONSE(&dev->ring, cons);
        nr_consumed++;
 
-        struct blkfront_aiocb *aiocbp = (void*) (uintptr_t) rsp->id;
-        int status = rsp->status;
+        aiocbp = (void*) (uintptr_t) rsp->id;
+        status = rsp->status;
 
         if (status != BLKIF_RSP_OKAY)
             printk("block error %d for op %d\n", status, rsp->operation);
diff -r ec1559924974 extras/mini-os/events.c
--- a/extras/mini-os/events.c   Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/events.c   Fri Jul 04 17:15:59 2008 +0100
@@ -207,10 +207,11 @@
 int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
                                                 void *data, evtchn_port_t 
*port)
 {
+    int err;
     evtchn_alloc_unbound_t op;
     op.dom = DOMID_SELF;
     op.remote_dom = pal;
-    int err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &op);
+    err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &op);
     if (err)
                return err;
     *port = bind_evtchn(op.port, handler, data);
@@ -224,13 +225,15 @@
                            evtchn_handler_t handler, void *data,
                            evtchn_port_t *local_port)
 {
+    int err;
+    evtchn_port_t port;
     evtchn_bind_interdomain_t op;
     op.remote_dom = pal;
     op.remote_port = remote_port;
-    int err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &op);
+    err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &op);
     if (err)
                return err;
-    evtchn_port_t port = op.local_port;
+    port = op.local_port;
     *local_port = bind_evtchn(port, handler, data);
     return err;
 }
diff -r ec1559924974 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c  Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/fbfront.c  Fri Jul 04 17:15:59 2008 +0100
@@ -64,7 +64,7 @@
     free(dev);
 }
 
-struct kbdfront_dev *init_kbdfront(char *nodename, int abs_pointer)
+struct kbdfront_dev *init_kbdfront(char *_nodename, int abs_pointer)
 {
     xenbus_transaction_t xbt;
     char* err;
@@ -72,11 +72,8 @@
     struct xenkbd_page *s;
     int retry=0;
     char* msg;
-
+    char* nodename = _nodename ? _nodename : "device/vkbd/0";
     struct kbdfront_dev *dev;
-
-    if (!nodename)
-        nodename = "device/vkbd/0";
 
     char path[strlen(nodename) + 1 + 10 + 1];
 
@@ -351,7 +348,7 @@
     return i;
 }
 
-struct fbfront_dev *init_fbfront(char *nodename, unsigned long *mfns, int 
width, int height, int depth, int stride, int n)
+struct fbfront_dev *init_fbfront(char *_nodename, unsigned long *mfns, int 
width, int height, int depth, int stride, int n)
 {
     xenbus_transaction_t xbt;
     char* err;
@@ -361,9 +358,9 @@
     char* msg;
     int i, j;
     struct fbfront_dev *dev;
-
-    if (!nodename)
-        nodename = "device/vfb/0";
+    int max_pd;
+    unsigned long mapped;
+    char* nodename = _nodename ? _nodename : "device/vfb/0";
 
     char path[strlen(nodename) + 1 + 10 + 1];
 
@@ -392,8 +389,8 @@
     dev->offset = 0;
     dev->events = NULL;
 
-    const int max_pd = sizeof(s->pd) / sizeof(s->pd[0]);
-    unsigned long mapped = 0;
+    max_pd = sizeof(s->pd) / sizeof(s->pd[0]);
+    mapped = 0;
 
     for (i = 0; mapped < n && i < max_pd; i++) {
         unsigned long *pd = (unsigned long *) alloc_page();
diff -r ec1559924974 extras/mini-os/hypervisor.c
--- a/extras/mini-os/hypervisor.c       Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/hypervisor.c       Fri Jul 04 17:15:59 2008 +0100
@@ -72,9 +72,10 @@
 
 void force_evtchn_callback(void)
 {
+    int save;
     vcpu_info_t *vcpu;
     vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];
-    int save = vcpu->evtchn_upcall_mask;
+    save = vcpu->evtchn_upcall_mask;
 
     while (vcpu->evtchn_upcall_pending) {
         vcpu->evtchn_upcall_mask = 1;
diff -r ec1559924974 extras/mini-os/include/ctype.h
--- a/extras/mini-os/include/ctype.h    Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/include/ctype.h    Fri Jul 04 17:15:59 2008 +0100
@@ -1,6 +1,9 @@
 #ifndef _CTYPE_H
 #define _CTYPE_H
 
+#ifdef HAVE_LIBC
+#include_next <ctype.h>
+#else
 /*
  * NOTE! This ctype does not handle EOF like the standard C
  * library is required to.
@@ -53,3 +56,5 @@
 #define toupper(c) __toupper(c)
 
 #endif
+
+#endif
diff -r ec1559924974 extras/mini-os/include/errno.h
--- a/extras/mini-os/include/errno.h    Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/include/errno.h    Fri Jul 04 17:15:59 2008 +0100
@@ -2,6 +2,8 @@
 #define _ERRNO_H
 
 #include <errno-base.h>
+
+typedef int error_t;
 
 #define        EDEADLK         35      /* Resource deadlock would occur */
 #define        ENAMETOOLONG    36      /* File name too long */
@@ -107,6 +109,9 @@
 #define        EOWNERDEAD      130     /* Owner died */
 #define        ENOTRECOVERABLE 131     /* State not recoverable */
 
+
+#define EFTYPE          132     /* Inappropriate file type or format */
+
 #ifdef HAVE_LIBC
 #include <sched.h>
 extern int errno;
diff -r ec1559924974 extras/mini-os/include/ia64/arch_spinlock.h
--- a/extras/mini-os/include/ia64/arch_spinlock.h       Wed Jul 02 15:08:25 
2008 +0100
+++ b/extras/mini-os/include/ia64/arch_spinlock.h       Fri Jul 04 17:15:59 
2008 +0100
@@ -27,7 +27,7 @@
 
 #include "atomic.h"
 
-#define ARCH_SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
+#define ARCH_SPIN_LOCK_UNLOCKED { 0 }
 
 #define SPIN_LOCK_UNUSED       0
 #define SPIN_LOCK_USED         1
diff -r ec1559924974 extras/mini-os/include/sys/lock.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/sys/lock.h Fri Jul 04 17:15:59 2008 +0100
@@ -0,0 +1,52 @@
+#ifndef _MINIOS_SYS_LOCK_H_
+#define _MINIOS_SYS_LOCK_H_
+
+#ifdef HAVE_LIBC
+
+/* Due to inclusion loop, we can not include sched.h, so have to hide things */
+
+#include <waittypes.h>
+
+
+typedef struct {
+        int busy;
+        struct wait_queue_head wait;
+} _LOCK_T;
+
+#define __LOCK_INIT(class,lock) \
+    class _LOCK_T lock = { .wait = __WAIT_QUEUE_HEAD_INITIALIZER(lock.wait) }
+int ___lock_init(_LOCK_T *lock);
+int ___lock_acquire(_LOCK_T *lock);
+int ___lock_try_acquire(_LOCK_T *lock);
+int ___lock_release(_LOCK_T *lock);
+int ___lock_close(_LOCK_T *lock);
+#define __lock_init(__lock) ___lock_init(&__lock)
+#define __lock_acquire(__lock) ___lock_acquire(&__lock)
+#define __lock_release(__lock) ___lock_release(&__lock)
+#define __lock_try_acquire(__lock) ___lock_try_acquire(&__lock)
+#define __lock_close(__lock) 0
+
+
+typedef struct {
+    struct thread *owner;
+    int count;
+    struct wait_queue_head wait;
+} _LOCK_RECURSIVE_T;
+
+#define __LOCK_INIT_RECURSIVE(class, lock) \
+    class _LOCK_RECURSIVE_T lock = { .wait = 
__WAIT_QUEUE_HEAD_INITIALIZER((lock).wait) }
+
+int ___lock_init_recursive(_LOCK_RECURSIVE_T *lock);
+int ___lock_acquire_recursive(_LOCK_RECURSIVE_T *lock);
+int ___lock_try_acquire_recursive(_LOCK_RECURSIVE_T *lock);
+int ___lock_release_recursive(_LOCK_RECURSIVE_T *lock);
+int ___lock_close_recursive(_LOCK_RECURSIVE_T *lock);
+#define __lock_init_recursive(__lock) ___lock_init_recursive(&__lock)
+#define __lock_acquire_recursive(__lock) ___lock_acquire_recursive(&__lock)
+#define __lock_release_recursive(__lock) ___lock_release_recursive(&__lock)
+#define __lock_try_acquire_recursive(__lock) 
___lock_try_acquire_recursive(&__lock)
+#define __lock_close_recursive(__lock) 0
+
+#endif
+
+#endif /* _MINIOS_SYS_LOCK_H_ */
diff -r ec1559924974 extras/mini-os/include/types.h
--- a/extras/mini-os/include/types.h    Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/include/types.h    Fri Jul 04 17:15:59 2008 +0100
@@ -36,9 +36,11 @@
 #endif
 
 /* FreeBSD compat types */
+#ifndef HAVE_LIBC
 typedef unsigned char       u_char;
 typedef unsigned int        u_int;
 typedef unsigned long       u_long;
+#endif
 #ifdef __i386__
 typedef long long           quad_t;
 typedef unsigned long long  u_quad_t;
@@ -79,11 +81,14 @@
 typedef u64 uint64_t, uintmax_t;
 typedef s64 int64_t, intmax_t;
 typedef u64 off_t;
+#endif
 
+typedef intptr_t            ptrdiff_t;
 
-#define INT_MAX         ((int)(~0U>>1))
-#define UINT_MAX            (~0U)
 
+#ifndef HAVE_LIBC
 typedef long ssize_t;
 #endif
+typedef unsigned long size_t;
+
 #endif /* _TYPES_H_ */
diff -r ec1559924974 extras/mini-os/include/wait.h
--- a/extras/mini-os/include/wait.h     Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/include/wait.h     Fri Jul 04 17:15:59 2008 +0100
@@ -2,29 +2,8 @@
 #define __WAIT_H__
 
 #include <sched.h>
-#include <list.h>
-#include <lib.h>
 #include <os.h>
-
-struct wait_queue
-{
-    struct thread *thread;
-    struct list_head thread_list;
-};
-
-struct wait_queue_head
-{
-    /* TODO - lock required? */
-    struct list_head thread_list;
-};
-
-#define DECLARE_WAIT_QUEUE_HEAD(name) \
-   struct wait_queue_head name =     \
-        { .thread_list = { &(name).thread_list, &(name).thread_list} }
-
-#define __WAIT_QUEUE_HEAD_INITIALIZER(name) {                           \
-    .thread_list      = { &(name).thread_list, &(name).thread_list } }
-
+#include <waittypes.h>
 
 #define DEFINE_WAIT(name)                               \
 struct wait_queue name = {                              \
diff -r ec1559924974 extras/mini-os/include/waittypes.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/waittypes.h        Fri Jul 04 17:15:59 2008 +0100
@@ -0,0 +1,26 @@
+#ifndef __WAITTYPE_H__
+#define __WAITTYPE_H__
+
+#include <list.h>
+
+struct thread;
+struct wait_queue
+{
+    struct thread *thread;
+    struct list_head thread_list;
+};
+
+struct wait_queue_head
+{
+    /* TODO - lock required? */
+    struct list_head thread_list;
+};
+
+#define DECLARE_WAIT_QUEUE_HEAD(name) \
+   struct wait_queue_head name =     \
+        { .thread_list = { &(name).thread_list, &(name).thread_list} }
+
+#define __WAIT_QUEUE_HEAD_INITIALIZER(name) {                           \
+    .thread_list      = { &(name).thread_list, &(name).thread_list } }
+
+#endif
diff -r ec1559924974 extras/mini-os/include/x86/arch_spinlock.h
--- a/extras/mini-os/include/x86/arch_spinlock.h        Wed Jul 02 15:08:25 
2008 +0100
+++ b/extras/mini-os/include/x86/arch_spinlock.h        Fri Jul 04 17:15:59 
2008 +0100
@@ -7,7 +7,7 @@
 #include "os.h"
 
 
-#define ARCH_SPIN_LOCK_UNLOCKED (spinlock_t) { 1 }
+#define ARCH_SPIN_LOCK_UNLOCKED { 1 }
 
 /*
  * Simple spin lock operations.  There are two variants, one clears IRQ's
diff -r ec1559924974 extras/mini-os/include/xmalloc.h
--- a/extras/mini-os/include/xmalloc.h  Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/include/xmalloc.h  Fri Jul 04 17:15:59 2008 +0100
@@ -10,6 +10,8 @@
 #define xfree(ptr) free(ptr)
 
 #else
+
+#include <limits.h>
 
 #define DEFAULT_ALIGN (sizeof(unsigned long))
 #define malloc(size) _xmalloc(size, DEFAULT_ALIGN)
diff -r ec1559924974 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c   Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/kernel.c   Fri Jul 04 17:15:59 2008 +0100
@@ -449,6 +449,8 @@
     }
 
     pci_dev = init_pcifront(NULL);
+    if (!pci_dev)
+        return;
     printk("PCI devices:\n");
     pcifront_scan(pci_dev, print);
 }
diff -r ec1559924974 extras/mini-os/lib/ctype.c
--- a/extras/mini-os/lib/ctype.c        Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/lib/ctype.c        Fri Jul 04 17:15:59 2008 +0100
@@ -1,3 +1,4 @@
+#ifndef HAVE_LIBC
 #include <ctype.h>
 
 unsigned char _ctype[] = {
@@ -25,3 +26,4 @@
 _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
 _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
 _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
+#endif
diff -r ec1559924974 extras/mini-os/lib/printf.c
--- a/extras/mini-os/lib/printf.c       Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/lib/printf.c       Fri Jul 04 17:15:59 2008 +0100
@@ -62,6 +62,7 @@
 #include <lib.h>
 #include <mm.h>
 #include <ctype.h>
+#include <limits.h>
 
 /**
  * simple_strtoul - convert a string to an unsigned long
diff -r ec1559924974 extras/mini-os/lib/xmalloc.c
--- a/extras/mini-os/lib/xmalloc.c      Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/lib/xmalloc.c      Fri Jul 04 17:15:59 2008 +0100
@@ -139,7 +139,7 @@
 
 void *_xmalloc(size_t size, size_t align)
 {
-    struct xmalloc_hdr *i, *hdr = NULL;
+    struct xmalloc_hdr *i, *tmp, *hdr = NULL;
     uintptr_t data_begin;
     size_t hdr_size;
     /* unsigned long flags; */
@@ -155,7 +155,7 @@
 
     /* Search free list. */
     /* spin_lock_irqsave(&freelist_lock, flags); */
-    list_for_each_entry( i, &freelist, freelist )
+    list_for_each_entry_safe( i, tmp, &freelist, freelist )
     {
         data_begin = align_up((uintptr_t)i + hdr_size, align);
 
diff -r ec1559924974 extras/mini-os/lock.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/lock.c     Fri Jul 04 17:15:59 2008 +0100
@@ -0,0 +1,111 @@
+/*
+ * locks for newlib
+ *
+ * Samuel Thibault <Samuel.Thibault@xxxxxxxxxxxxx>, July 20008
+ */
+
+#ifdef HAVE_LIBC
+
+#include <sys/lock.h>
+#include <sched.h>
+#include <wait.h>
+
+int ___lock_init(_LOCK_T *lock)
+{
+    lock->busy = 0;
+    init_waitqueue_head(&lock->wait);
+    return 0;
+}
+
+int ___lock_acquire(_LOCK_T *lock)
+{
+    unsigned long flags;
+    while(1) {
+        wait_event(lock->wait, !lock->busy);
+        local_irq_save(flags);
+        if (!lock->busy)
+            break;
+        local_irq_restore(flags);
+    }
+    lock->busy = 1;
+    local_irq_restore(flags);
+    return 0;
+}
+
+int ___lock_try_acquire(_LOCK_T *lock)
+{
+    unsigned long flags;
+    int ret = -1;
+    local_irq_save(flags);
+    if (!lock->busy) {
+        lock->busy = 1;
+        ret = 0;
+    }
+    local_irq_restore(flags);
+    return ret;
+}
+
+int ___lock_release(_LOCK_T *lock)
+{
+    unsigned long flags;
+    local_irq_save(flags);
+    lock->busy = 0;
+    wake_up(&lock->wait);
+    local_irq_restore(flags);
+    return 0;
+}
+
+
+int ___lock_init_recursive(_LOCK_RECURSIVE_T *lock)
+{
+    lock->owner = NULL;
+    init_waitqueue_head(&lock->wait);
+    return 0;
+}
+
+int ___lock_acquire_recursive(_LOCK_RECURSIVE_T *lock)
+{
+    unsigned long flags;
+    if (lock->owner != get_current()) {
+        while (1) {
+            wait_event(lock->wait, lock->owner == NULL);
+            local_irq_save(flags);
+            if (lock->owner == NULL)
+                break;
+            local_irq_restore(flags);
+        }
+        lock->owner = get_current();
+        local_irq_restore(flags);
+    }
+    lock->count++;
+    return 0;
+}
+
+int ___lock_try_acquire_recursive(_LOCK_RECURSIVE_T *lock)
+{
+    unsigned long flags;
+    int ret = -1;
+    local_irq_save(flags);
+    if (!lock->owner) {
+        ret = 0;
+        lock->owner = get_current();
+        lock->count++;
+    }
+    local_irq_restore(flags);
+    return ret;
+}
+
+int ___lock_release_recursive(_LOCK_RECURSIVE_T *lock)
+{
+    unsigned long flags;
+    BUG_ON(lock->owner != get_current());
+    if (--lock->count)
+        return 0;
+    local_irq_save(flags);
+    lock->owner = NULL;
+    wake_up(&lock->wait);
+    local_irq_restore(flags);
+    return 0;
+}
+
+#endif
diff -r ec1559924974 extras/mini-os/lwip-net.c
--- a/extras/mini-os/lwip-net.c Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/lwip-net.c Fri Jul 04 17:15:59 2008 +0100
@@ -93,6 +93,9 @@
 static err_t
 low_level_output(struct netif *netif, struct pbuf *p)
 {
+  if (!dev)
+    return ERR_OK;
+
 #ifdef ETH_PAD_SIZE
   pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
 #endif
@@ -342,7 +345,7 @@
   struct ip_addr ipaddr = { htonl(IF_IPADDR) };
   struct ip_addr netmask = { htonl(IF_NETMASK) };
   struct ip_addr gw = { 0 };
-  char *ip;
+  char *ip = NULL;
 
   tprintk("Waiting for network.\n");
 
@@ -380,5 +383,6 @@
 /* Shut down the network */
 void stop_networking(void)
 {
-  shutdown_netfront(dev);
+  if (dev)
+    shutdown_netfront(dev);
 }
diff -r ec1559924974 extras/mini-os/main.c
--- a/extras/mini-os/main.c     Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/main.c     Fri Jul 04 17:15:59 2008 +0100
@@ -52,6 +52,7 @@
 #ifdef CONFIG_QEMU
     char *vm;
     char path[128];
+    int domid;
 #endif
     int i;
 
@@ -74,7 +75,6 @@
     }
 
     /* Fetch argc, argv from XenStore */
-    int domid;
     domid = xenbus_read_integer("target");
     if (domid == -1) {
         printk("Couldn't read target\n");
diff -r ec1559924974 extras/mini-os/minios.mk
--- a/extras/mini-os/minios.mk  Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/minios.mk  Fri Jul 04 17:15:59 2008 +0100
@@ -6,13 +6,14 @@
 
 # Define some default flags.
 # NB. '-Wcast-qual' is nasty, so I omitted it.
-DEF_CFLAGS += -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
+DEF_CFLAGS += -fno-builtin -Wall -Werror -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
 DEF_CPPFLAGS += -D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION)
 
-DEF_ASFLAGS = -D__ASSEMBLY__
-DEF_LDFLAGS =
+DEF_ASFLAGS += -D__ASSEMBLY__
+DEF_LDFLAGS +=
 
 ifeq ($(debug),y)
 DEF_CFLAGS += -g
diff -r ec1559924974 extras/mini-os/mm.c
--- a/extras/mini-os/mm.c       Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/mm.c       Fri Jul 04 17:15:59 2008 +0100
@@ -361,6 +361,7 @@
    
 }
 
+#ifndef __ia64__
 int free_physical_pages(xen_pfn_t *mfns, int n)
 {
     struct xen_memory_reservation reservation;
@@ -371,6 +372,7 @@
     reservation.domid = DOMID_SELF;
     return HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation);
 }
+#endif
 
 #ifdef HAVE_LIBC
 void *sbrk(ptrdiff_t increment)
diff -r ec1559924974 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/netfront.c Fri Jul 04 17:15:59 2008 +0100
@@ -95,8 +95,9 @@
 
 void network_rx(struct netfront_dev *dev)
 {
-    RING_IDX rp,cons;
+    RING_IDX rp,cons,req_prod;
     struct netif_rx_response *rx;
+    int nr_consumed, some, more, i, notify;
 
 
 moretodo:
@@ -104,12 +105,13 @@
     rmb(); /* Ensure we see queued responses up to 'rp'. */
     cons = dev->rx.rsp_cons;
 
-    int nr_consumed=0;
-    int some = 0;
+    nr_consumed = 0;
+    some = 0;
     while ((cons != rp) && !some)
     {
         struct net_buffer* buf;
         unsigned char* page;
+        int id;
 
         rx = RING_GET_RESPONSE(&dev->rx, cons);
 
@@ -122,7 +124,7 @@
 
         if (rx->status == NETIF_RSP_NULL) continue;
 
-        int id = rx->id;
+        id = rx->id;
         BUG_ON(id >= NET_TX_RING_SIZE);
 
         buf = &dev->rx_buffers[id];
@@ -151,19 +153,15 @@
     }
     dev->rx.rsp_cons=cons;
 
-    int more;
     RING_FINAL_CHECK_FOR_RESPONSES(&dev->rx,more);
     if(more && !some) goto moretodo;
 
-    RING_IDX req_prod = dev->rx.req_prod_pvt;
-
-    int i;
-    netif_rx_request_t *req;
+    req_prod = dev->rx.req_prod_pvt;
 
     for(i=0; i<nr_consumed; i++)
     {
         int id = xennet_rxidx(req_prod + i);
-        req = RING_GET_REQUEST(&dev->rx, req_prod + i);
+        netif_rx_request_t *req = RING_GET_REQUEST(&dev->rx, req_prod + i);
         struct net_buffer* buf = &dev->rx_buffers[id];
         void* page = buf->page;
 
@@ -178,7 +176,6 @@
 
     dev->rx.req_prod_pvt = req_prod + i;
     
-    int notify;
     RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&dev->rx, notify);
     if (notify)
         notify_remote_via_evtchn(dev->evtchn);
@@ -199,6 +196,7 @@
         for (cons = dev->tx.rsp_cons; cons != prod; cons++) 
         {
             struct netif_tx_response *txrsp;
+            struct net_buffer *buf;
 
             txrsp = RING_GET_RESPONSE(&dev->tx, cons);
             if (txrsp->status == NETIF_RSP_NULL)
@@ -209,7 +207,7 @@
 
             id  = txrsp->id;
             BUG_ON(id >= NET_TX_RING_SIZE);
-            struct net_buffer* buf = &dev->tx_buffers[id];
+            buf = &dev->tx_buffers[id];
             gnttab_end_access(buf->gref);
             buf->gref=GRANT_INVALID_REF;
 
@@ -298,7 +296,7 @@
     free(dev);
 }
 
-struct netfront_dev *init_netfront(char *nodename, void 
(*thenetif_rx)(unsigned char* data, int len), unsigned char rawmac[6], char 
**ip)
+struct netfront_dev *init_netfront(char *_nodename, void 
(*thenetif_rx)(unsigned char* data, int len), unsigned char rawmac[6], char 
**ip)
 {
     xenbus_transaction_t xbt;
     char* err;
@@ -308,11 +306,9 @@
     int retry=0;
     int i;
     char* msg;
+    char* nodename = _nodename ? _nodename : "device/vif/0";
 
     struct netfront_dev *dev;
-
-    if (!nodename)
-       nodename = "device/vif/0";
 
     char path[strlen(nodename) + 1 + 10 + 1];
 
diff -r ec1559924974 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/pcifront.c Fri Jul 04 17:15:59 2008 +0100
@@ -49,18 +49,16 @@
     free(dev);
 }
 
-struct pcifront_dev *init_pcifront(char *nodename)
+struct pcifront_dev *init_pcifront(char *_nodename)
 {
     xenbus_transaction_t xbt;
     char* err;
     char* message=NULL;
     int retry=0;
     char* msg;
+    char* nodename = _nodename ? _nodename : "device/pci/0";
 
     struct pcifront_dev *dev;
-
-    if (!nodename)
-        nodename = "device/pci/0";
 
     char path[strlen(nodename) + 1 + 10 + 1];
 
diff -r ec1559924974 extras/mini-os/sched.c
--- a/extras/mini-os/sched.c    Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/sched.c    Fri Jul 04 17:15:59 2008 +0100
@@ -75,7 +75,7 @@
 void schedule(void)
 {
     struct thread *prev, *next, *thread;
-    struct list_head *iterator;
+    struct list_head *iterator, *next_iterator;
     unsigned long flags;
 
     prev = current;
@@ -97,7 +97,7 @@
         s_time_t now = NOW();
         s_time_t min_wakeup_time = now + SECONDS(10);
         next = NULL;   
-        list_for_each(iterator, &idle_thread->thread_list)
+        list_for_each_safe(iterator, next_iterator, &idle_thread->thread_list)
         {
             thread = list_entry(iterator, struct thread, thread_list);
             if (!is_runnable(thread) && thread->wakeup_time != 0LL)
@@ -128,7 +128,7 @@
        inturrupted at the return instruction. And therefore at safe point. */
     if(prev != next) switch_threads(prev, next);
 
-    list_for_each(iterator, &exited_threads)
+    list_for_each_safe(iterator, next_iterator, &exited_threads)
     {
         thread = list_entry(iterator, struct thread, thread_list);
         if(thread != prev)
diff -r ec1559924974 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c    Wed Jul 02 15:08:25 2008 +0100
+++ b/extras/mini-os/xenbus/xenbus.c    Fri Jul 04 17:15:59 2008 +0100
@@ -78,9 +78,9 @@
 char **xenbus_wait_for_watch_return(xenbus_event_queue *queue)
 {
     struct xenbus_event *event;
+    DEFINE_WAIT(w);
     if (!queue)
         queue = &xenbus_events;
-    DEFINE_WAIT(w);
     while (!(event = *queue)) {
         add_waiter(w, xenbus_watch_queue);
         schedule();
@@ -382,6 +382,7 @@
 
 static char *errmsg(struct xsd_sockmsg *rep)
 {
+    char *res;
     if (!rep) {
        char msg[] = "No reply";
        size_t len = strlen(msg) + 1;
@@ -389,7 +390,7 @@
     }
     if (rep->type != XS_ERROR)
        return NULL;
-    char *res = malloc(rep->len + 1);
+    res = malloc(rep->len + 1);
     memcpy(res, rep + 1, rep->len);
     res[rep->len] = 0;
     free(rep);
@@ -419,10 +420,10 @@
     struct xsd_sockmsg *reply, *repmsg;
     struct write_req req[] = { { pre, strlen(pre)+1 } };
     int nr_elems, x, i;
-    char **res;
+    char **res, *msg;
 
     repmsg = xenbus_msg_reply(XS_DIRECTORY, xbt, req, ARRAY_SIZE(req));
-    char *msg = errmsg(repmsg);
+    msg = errmsg(repmsg);
     if (msg) {
        *contents = NULL;
        return msg;
@@ -447,9 +448,9 @@
 {
     struct write_req req[] = { {path, strlen(path) + 1} };
     struct xsd_sockmsg *rep;
-    char *res;
+    char *res, *msg;
     rep = xenbus_msg_reply(XS_READ, xbt, req, ARRAY_SIZE(req));
-    char *msg = errmsg(rep);
+    msg = errmsg(rep);
     if (msg) {
        *value = NULL;
        return msg;
@@ -469,8 +470,9 @@
        {value, strlen(value)},
     };
     struct xsd_sockmsg *rep;
+    char *msg;
     rep = xenbus_msg_reply(XS_WRITE, xbt, req, ARRAY_SIZE(req));
-    char *msg = errmsg(rep);
+    msg = errmsg(rep);
     if (msg) return msg;
     free(rep);
     return NULL;
@@ -487,6 +489,8 @@
 
     struct watch *watch = malloc(sizeof(*watch));
 
+    char *msg;
+
     if (!events)
         events = &xenbus_events;
 
@@ -497,7 +501,7 @@
 
     rep = xenbus_msg_reply(XS_WATCH, xbt, req, ARRAY_SIZE(req));
 
-    char *msg = errmsg(rep);
+    msg = errmsg(rep);
     if (msg) return msg;
     free(rep);
 
@@ -515,9 +519,11 @@
 
     struct watch *watch, **prev;
 
+    char *msg;
+
     rep = xenbus_msg_reply(XS_UNWATCH, xbt, req, ARRAY_SIZE(req));
 
-    char *msg = errmsg(rep);
+    msg = errmsg(rep);
     if (msg) return msg;
     free(rep);
 
@@ -536,8 +542,9 @@
 {
     struct write_req req[] = { {path, strlen(path) + 1} };
     struct xsd_sockmsg *rep;
+    char *msg;
     rep = xenbus_msg_reply(XS_RM, xbt, req, ARRAY_SIZE(req));
-    char *msg = errmsg(rep);
+    msg = errmsg(rep);
     if (msg)
        return msg;
     free(rep);
@@ -548,9 +555,9 @@
 {
     struct write_req req[] = { {path, strlen(path) + 1} };
     struct xsd_sockmsg *rep;
-    char *res;
+    char *res, *msg;
     rep = xenbus_msg_reply(XS_GET_PERMS, xbt, req, ARRAY_SIZE(req));
-    char *msg = errmsg(rep);
+    msg = errmsg(rep);
     if (msg) {
        *value = NULL;
        return msg;
@@ -567,14 +574,16 @@
 char *xenbus_set_perms(xenbus_transaction_t xbt, const char *path, domid_t 
dom, char perm)
 {
     char value[PERM_MAX_SIZE];
-    snprintf(value, PERM_MAX_SIZE, "%c%hu", perm, dom);
     struct write_req req[] = { 
        {path, strlen(path) + 1},
-       {value, strlen(value) + 1},
+       {value, 0},
     };
     struct xsd_sockmsg *rep;
+    char *msg;
+    snprintf(value, PERM_MAX_SIZE, "%c%hu", perm, dom);
+    req[1].len = strlen(value) + 1;
     rep = xenbus_msg_reply(XS_SET_PERMS, xbt, req, ARRAY_SIZE(req));
-    char *msg = errmsg(rep);
+    msg = errmsg(rep);
     if (msg)
        return msg;
     free(rep);
@@ -659,11 +668,11 @@
 
 static void do_ls_test(const char *pre)
 {
-    char **dirs;
+    char **dirs, *msg;
     int x;
 
     DEBUG("ls %s...\n", pre);
-    char *msg = xenbus_ls(XBT_NIL, pre, &dirs);
+    msg = xenbus_ls(XBT_NIL, pre, &dirs);
     if (msg) {
        DEBUG("Error in xenbus ls: %s\n", msg);
        free(msg);
@@ -679,9 +688,9 @@
 
 static void do_read_test(const char *path)
 {
-    char *res;
+    char *res, *msg;
     DEBUG("Read %s...\n", path);
-    char *msg = xenbus_read(XBT_NIL, path, &res);
+    msg = xenbus_read(XBT_NIL, path, &res);
     if (msg) {
        DEBUG("Error in xenbus read: %s\n", msg);
        free(msg);
@@ -693,8 +702,9 @@
 
 static void do_write_test(const char *path, const char *val)
 {
+    char *msg;
     DEBUG("Write %s to %s...\n", val, path);
-    char *msg = xenbus_write(XBT_NIL, path, val);
+    msg = xenbus_write(XBT_NIL, path, val);
     if (msg) {
        DEBUG("Result %s\n", msg);
        free(msg);
@@ -705,8 +715,9 @@
 
 static void do_rm_test(const char *path)
 {
+    char *msg;
     DEBUG("rm %s...\n", path);
-    char *msg = xenbus_rm(XBT_NIL, path);
+    msg = xenbus_rm(XBT_NIL, path);
     if (msg) {
        DEBUG("Result %s\n", msg);
        free(msg);
diff -r ec1559924974 stubdom/Makefile
--- a/stubdom/Makefile  Wed Jul 02 15:08:25 2008 +0100
+++ b/stubdom/Makefile  Fri Jul 04 17:15:59 2008 +0100
@@ -3,13 +3,11 @@
 
 export XEN_OS=MiniOS
 
-include $(XEN_ROOT)/Config.mk
 export stubdom=y
 export debug=y
+include $(XEN_ROOT)/Config.mk
 
 IOEMU_OPTIONS=--disable-vnc-tls 
-BINUTILS_VERSION=2.18
-GCC_VERSION=4.2.2
 ZLIB_VERSION=1.2.3
 LIBPCI_VERSION=2.2.9
 NEWLIB_DATE=2008-01-01
@@ -38,56 +35,28 @@
 
 CROSS_ROOT=cross-root-$(GNU_TARGET_ARCH)
 CROSS_PREFIX=$(CURDIR)/$(CROSS_ROOT)
-export CROSS_COMPILE=$(GNU_TARGET_ARCH)-xen-elf-
-export PATH:=$(CROSS_PREFIX)/bin:$(PATH)
+
+# Disable PIE/SSP if GCC supports them. They can break us.
+TARGET_CFLAGS += $(CFLAGS)
+TARGET_CPPFLAGS += $(CPPFLAGS)
+TARGET_CFLAGS += $(call cc-option,$(CC),-nopie,)
+TARGET_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
+TARGET_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
+
+# Do not use host headers and libs
+GCC_INSTALL = $(shell gcc -print-search-dirs | sed -n -e 's/install: 
\(.*\)/\1/p')
+TARGET_CPPFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__
+TARGET_CFLAGS += -nostdinc
+TARGET_CPPFLAGS += -isystem $(realpath $(MINI_OS)/include/posix)
+TARGET_CPPFLAGS += -isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include
+TARGET_CPPFLAGS += -isystem $(GCC_INSTALL)include
+
+TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
 
 TARGETS=ioemu c caml grub
 
 .PHONY: all
 all: ioemu-stubdom c-stubdom pv-grub
-
-################
-# Cross-binutils
-################
-
-binutils-$(BINUTILS_VERSION).tar.bz2:
-       $(WGET) http://ftp.gnu.org/gnu/binutils/$@
-binutils-$(BINUTILS_VERSION): binutils-$(BINUTILS_VERSION).tar.bz2
-       tar xjf $<
-       patch -d $@ -p1 < binutils.patch
-       touch $@
-
-BINUTILS_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-ar
-.PHONY: cross-binutils
-cross-binutils: $(BINUTILS_STAMPFILE)
-$(BINUTILS_STAMPFILE): binutils-$(BINUTILS_VERSION)
-       mkdir -p binutils-build
-       ( cd binutils-build && \
-         ../binutils-$(BINUTILS_VERSION)/configure --prefix=$(CROSS_PREFIX) 
--verbose --target=$(GNU_TARGET_ARCH)-xen-elf && \
-         $(MAKE) && \
-         $(MAKE) check && \
-         $(MAKE) install )
-
-###########
-# Cross-gcc
-###########
-
-gcc-$(GCC_VERSION).tar.bz2:
-       $(WGET) 
http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2
-gcc-$(GCC_VERSION): gcc-$(GCC_VERSION).tar.bz2
-       tar xjf $<
-       patch -d $@ -p1 < gcc.patch
-       touch $@
-
-GCC_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-gcc-$(GCC_VERSION)
-.PHONY: cross-gcc
-cross-gcc: $(GCC_STAMPFILE)
-$(GCC_STAMPFILE): gcc-$(GCC_VERSION) $(BINUTILS_STAMPFILE)
-       mkdir -p gcc-build
-       ( cd gcc-build && \
-         ../gcc-$(GCC_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose 
--target=$(GNU_TARGET_ARCH)-xen-elf --enable-languages=c --disable-libssp 
--with-gnu-as --with-gnu-ld && \
-         $(MAKE) GCC_FOR_TARGET='$$$$r/gcc/xgcc -B$$$$r/gcc/ 
'"$(TARGET_CFLAGS)"' $$(FLAGS_FOR_TARGET)' && \
-         $(MAKE) install )
 
 ##############
 # Cross-newlib
@@ -101,10 +70,10 @@
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
 .PHONY: cross-newlib
 cross-newlib: $(NEWLIB_STAMPFILE)
-$(NEWLIB_STAMPFILE): newlib-cvs $(GCC_STAMPFILE)
+$(NEWLIB_STAMPFILE): newlib-cvs
        mkdir -p newlib-build
        ( cd newlib-build && \
-         CC_FOR_TARGET="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS) 
$(NEWLIB_CFLAGS)" ../newlib-cvs/configure --prefix=$(CROSS_PREFIX) --verbose 
--target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long && \
+         CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) 
$(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) 
RANLIB_FOR_TARGET=$(RANLIB) ../newlib-cvs/configure --prefix=$(CROSS_PREFIX) 
--verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long 
--disable-multilib && \
          $(MAKE) && \
          $(MAKE) install )
 
@@ -121,7 +90,7 @@
 $(ZLIB_STAMPFILE): zlib-$(ZLIB_VERSION).tar.gz $(NEWLIB_STAMPFILE)
        tar xzf $<
        ( cd zlib-$(ZLIB_VERSION) && \
-         CFLAGS="$(TARGET_CFLAGS)" CC=$(GNU_TARGET_ARCH)-xen-elf-gcc 
./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
+         CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure 
--prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
          $(MAKE) libz.a && \
          $(MAKE) install )
 
@@ -145,7 +114,7 @@
          cp ../libpci.config.h lib/config.h && \
          echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
          cp ../libpci.config.mak lib/config.mk && \
-         $(MAKE) CC="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS) 
-I$(realpath $(MINI_OS)/include)" lib/libpci.a && \
+         $(MAKE) CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(realpath 
$(MINI_OS)/include)" lib/libpci.a && \
          $(INSTALL_DATA) lib/libpci.a 
$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
          $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci 
&& \
          $(INSTALL_DATA) lib/{config,header,pci,types}.h 
$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
@@ -199,7 +168,7 @@
 .PHONY: libxc
 libxc: libxc/libxenctrl.a libxc/libxenguest.a
 libxc/libxenctrl.a libxc/libxenguest.a: cross-zlib mk-symlinks
-       $(MAKE) -C libxc
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C libxc
 
 #######
 # ioemu
@@ -208,8 +177,9 @@
 .PHONY: ioemu
 ioemu: cross-zlib cross-libpci mk-symlinks libxc
        [ -f ioemu/config-host.mak ] || \
-         ( cd ioemu ; XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) sh configure 
--prefix=/usr --enable-stubdom $(IOEMU_OPTIONS))
-       $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-cvs
+         ( cd ioemu ; \
+          XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) CFLAGS="$(TARGET_CFLAGS)" sh 
configure --prefix=/usr --enable-stubdom $(IOEMU_OPTIONS))
+       CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu 
LWIPDIR=$(CURDIR)/lwip-cvs
 
 ######
 # caml
@@ -217,7 +187,7 @@
 
 .PHONY: caml
 caml: cross-newlib mk-symlinks
-       $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs 
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-cvs 
 
 ###
 # C
@@ -225,7 +195,7 @@
 
 .PHONY: c
 c: cross-newlib mk-symlinks
-       $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs 
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-cvs 
 
 ######
 # Grub
@@ -239,7 +209,7 @@
 
 .PHONY: grub
 grub: grub-cvs cross-newlib mk-symlinks
-       $(MAKE) -C $@
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@
 
 ########
 # minios
@@ -247,20 +217,20 @@
 
 .PHONY: ioemu-stubdom
 ioemu-stubdom: mini-os-ioemu lwip-cvs libxc ioemu
-       DEF_CFLAGS=-DCONFIG_QEMU $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< 
LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS="$(CURDIR)/ioemu/i386-dm-stubdom/qemu.a 
$(CURDIR)/ioemu/i386-dm-stubdom/libqemu.a"
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-cvs 
APP_OBJS="$(CURDIR)/ioemu/i386-dm-stubdom/qemu.a 
$(CURDIR)/ioemu/i386-dm-stubdom/libqemu.a"
 
 CAMLLIB = $(shell ocamlc -where)
 .PHONY: caml-stubdom
 caml-stubdom: mini-os-caml lwip-cvs libxc caml
-       DEF_CFLAGS=-DCONFIG_CAML $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< 
LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS="$(CURDIR)/caml/main-caml.o 
$(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-cvs 
APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o 
$(CAMLLIB)/libasmrun.a"
 
 .PHONY: c-stubdom
 c-stubdom: mini-os-c lwip-cvs libxc c
-       DEF_CFLAGS=-DCONFIG_C $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< 
LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS=$(CURDIR)/c/main.a
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS=$(CURDIR)/c/main.a
 
 .PHONY: pv-grub
 pv-grub: mini-os-grub libxc grub
-       DEF_CFLAGS=-DCONFIG_GRUB $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< 
APP_OBJS=$(CURDIR)/grub/main.a
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_GRUB 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub/main.a
 
 #########
 # install
@@ -295,14 +265,12 @@
 .PHONY: crossclean
 crossclean: clean
        rm -fr $(CROSS_ROOT)
-       rm -fr binutils-build gcc-build newlib-build
+       rm -fr newlib-build
        rm -fr zlib-$(ZLIB_VERSION) pciutils-$(LIBPCI_VERSION)
 
 # clean patched sources
 .PHONY: patchclean
 patchclean: crossclean
-       rm -fr binutils-$(BINUTILS_VERSION)
-       rm -fr gcc-$(GCC_VERSION)
        rm -fr newlib-cvs
        rm -fr lwip-cvs
        rm -fr grub-cvs
@@ -310,8 +278,6 @@
 # clean downloads
 .PHONY: downloadclean
 downloadclean: patchclean
-       rm -f binutils-$(BINUTILS_VERSION).tar.bz2
-       rm -f gcc-$(GCC_VERSION).tar.bz2
        rm -f zlib-$(ZLIB_VERSION).tar.gz
        rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
 
diff -r ec1559924974 stubdom/binutils.patch
--- a/stubdom/binutils.patch    Wed Jul 02 15:08:25 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-It looks like binutils has troubles with makeinfo and the doc generation.
-We don't need it anyway
-
---- binutils-2.18/bfd/Makefile.inorig  2008-01-16 16:17:43.004484000 +0000
-+++ binutils-2.18/bfd/Makefile.in      2008-01-16 16:17:50.505526000 +0000
-@@ -271,7 +271,7 @@
- INCDIR = $(srcdir)/../include
- CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
- MKDEP = gcc -MM
--SUBDIRS = doc po
-+SUBDIRS = po
- bfddocdir = doc
- bfdlib_LTLIBRARIES = libbfd.la
- AM_CFLAGS = $(WARN_CFLAGS)
diff -r ec1559924974 stubdom/gcc.patch
--- a/stubdom/gcc.patch Wed Jul 02 15:08:25 2008 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-Backported from later versions
-
---- gcc-4.2.2/gcc/config.gcc       2007-11-22 16:27:45.000000000 +0000
-+++ gcc-4.2.2/gcc/config.gcc       2007-11-22 16:23:00.000000000 +0000
-@@ -1033,6 +1033,11 @@
-       tmake_file="i386/t-i386elf t-svr4"
-       use_fixproto=yes
-       ;;
-+x86_64-*-elf*)
-+      tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h 
i386/i386elf.h i386/x86-64.h"
-+      tmake_file="i386/t-i386elf t-svr4"
-+      use_fixproto=yes
-+      ;;
- i[34567]86-sequent-ptx4* | i[34567]86-sequent-sysv4*)
-       if test x$gas = xyes
-       then
-
-We don't have a libc yet at this stage. Unused anyway
-
---- gcc-4.2.2/gcc/unwind-generic.h.orig 2008-01-11 18:54:40.000000000 +0100
-+++ gcc-4.2.2/gcc/unwind-generic.h      2008-01-11 18:54:31.000000000 +0100
-@@ -203,7 +203,6 @@
-    compatible with the standard ABI for IA-64, we inline these.  */
- 
- #ifdef __ia64__
--#include <stdlib.h>
- 
- static inline _Unwind_Ptr
- _Unwind_GetDataRelBase (struct _Unwind_Context *_C)
-Backported from later versions
-

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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