WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] compiled a 32bit pv-grub on x86_64 xen target [Was:

To: Gerd Hoffmann <kraxel@xxxxxxxxxx>, Xen Development Mailing List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] compiled a 32bit pv-grub on x86_64 xen target [Was: pv-grub doesn't run on rhel5]
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Thu, 14 Aug 2008 13:33:50 +0100
Cc:
Delivery-date: Thu, 14 Aug 2008 05:34:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20080814111520.GH4590@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Xen Development Mailing List <xen-devel@xxxxxxxxxxxxxxxxxxx>
References: <48A40B17.2090701@xxxxxxxxxx> <20080814111520.GH4590@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Samuel Thibault, le Thu 14 Aug 2008 12:15:20 +0100, a écrit :
> Gerd Hoffmann, le Thu 14 Aug 2008 12:38:15 +0200, a écrit :
> > Another issue:  As 64bit pv-grub can't boot 32bit kernels, the 64bit xen
> > build should create both 32bit and 64bit builds of pv-grub, so you can
> > boot 32-on-64 guests with it?
> 
> I'm afraid Keir will consider it is too late in the 3.3 release to make
> such a change in the build process.

Here is a patch anyway, it doesn't touch any code so at least shouldn't
break anything.



pv-grub: On x86_64, also build an x86_32 pv-grub

This requires suffixing obj directories and having grub compiled outside
sources.

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

diff -r 37f3bdce0394 .hgignore
--- a/.hgignore Mon Aug 11 12:36:26 2008 +0100
+++ b/.hgignore Thu Aug 14 13:30:23 2008 +0100
@@ -90,20 +90,16 @@
 ^stubdom/gcc-.*$
 ^stubdom/include$
 ^stubdom/ioemu$
-^stubdom/libxc$
+^stubdom/libxc-.*$
 ^stubdom/lwip-.*$
 ^stubdom/mini-os-.*$
-^stubdom/mk-headers$
+^stubdom/mk-headers-.*$
 ^stubdom/newlib-.*$
 ^stubdom/pciutils-.*$
 ^stubdom/zlib-.*$
-^stubdom/grub-cvs$
-^stubdom/grub/stage2$
-^stubdom/grub/netboot$
-^stubdom/grub/dirs$
+^stubdom/grub-.*$
 ^stubdom/lwip/
 ^stubdom/ioemu/
-^stubdom/grub-upstream/
 ^tools/.*/build/lib.*/.*\.py$
 ^tools/blktap/Makefile\.smh$
 ^tools/blktap/drivers/blktapctrl$
diff -r 37f3bdce0394 Makefile
--- a/Makefile  Mon Aug 11 12:36:26 2008 +0100
+++ b/Makefile  Thu Aug 14 13:30:23 2008 +0100
@@ -22,6 +22,9 @@ build: kernels
        $(MAKE) -C xen build
        $(MAKE) -C tools build
        $(MAKE) -C stubdom build
+ifeq (x86_64,$(XEN_TARGET_ARCH))
+       XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
+endif
        $(MAKE) -C docs build
 
 # The test target is for unit tests that can run without an installation.  Of
@@ -71,6 +74,9 @@ install-kernels:
 .PHONY: install-stubdom
 install-stubdom:
        $(MAKE) -C stubdom install
+ifeq (x86_64,$(XEN_TARGET_ARCH))
+       XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
+endif
 
 .PHONY: install-docs
 install-docs:
@@ -109,6 +115,9 @@ clean::
        $(MAKE) -C xen clean
        $(MAKE) -C tools clean
        $(MAKE) -C stubdom crossclean
+ifeq (x86_64,$(XEN_TARGET_ARCH))
+       XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom crossclean
+endif
        $(MAKE) -C docs clean
 
 # clean, but blow away kernel build tree plus tarballs
@@ -117,6 +126,9 @@ distclean:
        $(MAKE) -C xen distclean
        $(MAKE) -C tools distclean
        $(MAKE) -C stubdom distclean
+ifeq (x86_64,$(XEN_TARGET_ARCH))
+       XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom distclean
+endif
        $(MAKE) -C docs distclean
        rm -rf dist patches/tmp
        for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done
diff -r 37f3bdce0394 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile   Mon Aug 11 12:36:26 2008 +0100
+++ b/extras/mini-os/Makefile   Thu Aug 14 13:30:23 2008 +0100
@@ -66,8 +66,8 @@ ifeq ($(lwip),y)
 # lwIP library
 LWC    := $(shell find $(LWIPDIR)/ -type f -name '*.c')
 LWC    := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
-LWC    += lwip-arch.c lwip-net.c
 LWO    := $(patsubst %.c,%.o,$(LWC))
+LWO    += $(addprefix $(OBJ_DIR)/,lwip-arch.o lwip-net.o)
 
 $(OBJ_DIR)/lwip.a: $(LWO)
        $(RM) $@
@@ -79,7 +79,7 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o 
 OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 
 ifeq ($(libc),y)
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -whole-archive -lxenguest -lxenctrl 
-no-whole-archive
+APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(XEN_TARGET_ARCH) -whole-archive 
-lxenguest -lxenctrl -no-whole-archive
 APP_LDLIBS += -lpci
 APP_LDLIBS += -lz
 APP_LDLIBS += -lm
diff -r 37f3bdce0394 stubdom/Makefile
--- a/stubdom/Makefile  Mon Aug 11 12:36:26 2008 +0100
+++ b/stubdom/Makefile  Thu Aug 14 13:30:23 2008 +0100
@@ -91,9 +91,9 @@ NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TAR
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
 .PHONY: cross-newlib
 cross-newlib: $(NEWLIB_STAMPFILE)
-$(NEWLIB_STAMPFILE): mk-headers newlib-$(NEWLIB_VERSION)
-       mkdir -p newlib-build
-       ( cd newlib-build && \
+$(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 && \
          $(MAKE) && \
          DESTDIR= $(MAKE) install )
@@ -105,12 +105,15 @@ zlib-$(ZLIB_VERSION).tar.gz:
 zlib-$(ZLIB_VERSION).tar.gz:
        $(WGET) $(ZLIB_URL)/$@
 
+zlib-$(XEN_TARGET_ARCH): zlib-$(ZLIB_VERSION).tar.gz 
+       tar xzf $<
+       mv zlib-$(ZLIB_VERSION) $@
+
 ZLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libz.a
 .PHONY: cross-zlib
 cross-zlib: $(ZLIB_STAMPFILE)
-$(ZLIB_STAMPFILE): zlib-$(ZLIB_VERSION).tar.gz $(NEWLIB_STAMPFILE)
-       tar xzf $<
-       ( cd zlib-$(ZLIB_VERSION) && \
+$(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
+       ( cd $< && \
          CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure 
--prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
          $(MAKE) libz.a && \
          $(MAKE) install )
@@ -122,16 +125,17 @@ pciutils-$(LIBPCI_VERSION).tar.bz2:
 pciutils-$(LIBPCI_VERSION).tar.bz2:
        $(WGET) $(LIBPCI_URL)/$@
 
-pciutils-$(LIBPCI_VERSION): pciutils-$(LIBPCI_VERSION).tar.bz2
+pciutils-$(XEN_TARGET_ARCH): pciutils-$(LIBPCI_VERSION).tar.bz2
        tar xjf $<
+       mv pciutils-$(LIBPCI_VERSION) $@
        patch -d $@ -p1 < pciutils.patch
        touch $@
 
 LIBPCI_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libpci.a
 .PHONY: cross-libpci
 cross-libpci: $(LIBPCI_STAMPFILE)
-$(LIBPCI_STAMPFILE): pciutils-$(LIBPCI_VERSION) $(NEWLIB_STAMPFILE) 
$(ZLIB_STAMPFILE)
-       ( cd pciutils-$(LIBPCI_VERSION) && \
+$(LIBPCI_STAMPFILE): pciutils-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE) 
$(ZLIB_STAMPFILE)
+       ( cd $< && \
          cp ../libpci.config.h lib/config.h && \
          echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
          cp ../libpci.config.mak lib/config.mk && \
@@ -148,8 +152,9 @@ lwip-$(LWIP_VERSION).tar.gz:
 lwip-$(LWIP_VERSION).tar.gz:
        $(WGET) $(LWIP_URL)/$@
 
-lwip: lwip-$(LWIP_VERSION).tar.gz
+lwip-$(XEN_TARGET_ARCH): lwip-$(LWIP_VERSION).tar.gz
        tar xzf $<
+       mv lwip $@
        patch -d $@ -p0 < lwip.patch-cvs
        touch $@
 
@@ -160,7 +165,7 @@ lwip: lwip-$(LWIP_VERSION).tar.gz
 .PHONY: $(CROSS_ROOT)
 $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
 
-mk-headers:
+mk-headers-$(XEN_TARGET_ARCH):
        mkdir -p include/xen && \
           ln -sf $(addprefix ../../,$(wildcard 
$(XEN_ROOT)/xen/include/public/*.h)) include/xen && \
           ln -sf $(addprefix ../../$(XEN_ROOT)/xen/include/public/,arch-ia64 
arch-x86 hvm io xsm) include/xen && \
@@ -169,13 +174,13 @@ mk-headers:
          ln -sf $(addprefix ../../,$(wildcard 
$(XEN_ROOT)/tools/include/xen-foreign/*)) include/xen-foreign/ && \
          $(MAKE) -C include/xen-foreign/ && \
          ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign 
include/xen/foreign )
-       mkdir -p libxc
-       [ -h libxc/Makefile ] || ( cd libxc && \
+       mkdir -p libxc-$(XEN_TARGET_ARCH)
+       [ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd 
libxc-$(XEN_TARGET_ARCH) && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/*.h . && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/*.c . && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/Makefile . )
-       mkdir -p libxc/$(XEN_TARGET_ARCH)
-       [ -h libxc/$(XEN_TARGET_ARCH) ] || ( cd libxc/$(XEN_TARGET_ARCH) && \
+       mkdir -p libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH)
+       [ -h libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) ] || ( cd 
libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
          ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
@@ -196,9 +201,9 @@ endif
        [ ! -h ioemu/config-host.h ] || rm -f ioemu/config-host.h
        [ ! -h ioemu/config-host.mak ] || rm -f ioemu/config-host.mak
        $(MAKE) -C $(MINI_OS) links
-       touch mk-headers
+       touch mk-headers-$(XEN_TARGET_ARCH)
 
-TARGETS_MINIOS=$(addprefix mini-os-,$(TARGETS))
+TARGETS_MINIOS=$(addprefix mini-os-$(XEN_TARGET_ARCH)-,$(TARGETS))
 $(TARGETS_MINIOS): mini-os-%:
        [ -d $@ ] || \
        for i in $$(cd $(MINI_OS) ; find . -type d) ; do \
@@ -210,9 +215,9 @@ TARGETS_MINIOS=$(addprefix mini-os-,$(TA
 #######
 
 .PHONY: libxc
-libxc: libxc/libxenctrl.a libxc/libxenguest.a
-libxc/libxenctrl.a libxc/libxenguest.a:: cross-zlib
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C libxc
+libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a 
libxc-$(XEN_TARGET_ARCH)/libxenguest.a
+libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a:: 
cross-zlib
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C 
libxc-$(XEN_TARGET_ARCH)
 
 #######
 # ioemu
@@ -224,12 +229,12 @@ ifeq ($(CONFIG_QEMU),ioemu)
        [ -f ioemu/config-host.mak ] || \
          ( 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 
TOOLS=
+       CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) TOOLS=
 else
        [ -f ioemu/config-host.mak ] || \
          ( cd ioemu ; \
           CONFIG_STUBDOM=yes XEN_ROOT=$(abspath $(XEN_ROOT)) 
XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) CFLAGS="$(TARGET_CFLAGS)" sh ./xen-setup 
--cc=$(CC) --disable-gcc-check $(IOEMU_OPTIONS))
-       CPPFLAGS= TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu 
LWIPDIR=$(CURDIR)/lwip TOOLS= CONFIG_STUBDOM=yes
+       CPPFLAGS= TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) TOOLS= CONFIG_STUBDOM=yes
 endif
 
 ######
@@ -238,7 +243,7 @@ endif
 
 .PHONY: caml
 caml: $(CROSS_ROOT)
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip 
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
 
 ###
 # C
@@ -246,7 +251,7 @@ caml: $(CROSS_ROOT)
 
 .PHONY: c
 c: $(CROSS_ROOT)
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip 
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
 
 ######
 # Grub
@@ -264,7 +269,8 @@ grub-upstream: grub-$(GRUB_VERSION).tar.
 
 .PHONY: grub
 grub: grub-upstream $(CROSS_ROOT)
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@
+       mkdir -p grub-$(XEN_TARGET_ARCH)
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
 
 ########
 # minios
@@ -276,21 +282,21 @@ else
 else
 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a 
$(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
 endif
-ioemu-stubdom: mini-os-ioemu lwip libxc ioemu
-       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip APP_OBJS="$(APP_OBJS)"
+ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc 
ioemu
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(APP_OBJS)"
 
 CAMLLIB = $(shell ocamlc -where)
 .PHONY: caml-stubdom
-caml-stubdom: mini-os-caml lwip libxc caml
-       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip 
APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o 
$(CAMLLIB)/libasmrun.a"
+caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc 
caml
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o 
$(CAMLLIB)/libasmrun.a"
 
 .PHONY: c-stubdom
-c-stubdom: mini-os-c lwip libxc c
-       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip APP_OBJS=$(CURDIR)/c/main.a
+c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
+       DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS=$(CURDIR)/c/main.a
 
 .PHONY: pv-grub
-pv-grub: mini-os-grub libxc grub
-       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
+pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
+       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-$(XEN_TARGET_ARCH)/main.a
 
 #########
 # install
@@ -310,11 +316,11 @@ install-ioemu: ioemu-stubdom
        $(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/bin"
        $(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin"
        $(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/boot"
-       $(INSTALL_DATA) mini-os-ioemu/mini-os.gz 
"$(DESTDIR)/usr/lib/xen/boot/ioemu-stubdom.gz"
+       $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-ioemu/mini-os.gz 
"$(DESTDIR)/usr/lib/xen/boot/ioemu-stubdom.gz"
 
 install-grub: pv-grub
        $(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/boot"
-       $(INSTALL_DATA) mini-os-grub/mini-os.gz 
"$(DESTDIR)/usr/lib/xen/boot/pv-grub.gz"
+       $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz 
"$(DESTDIR)/usr/lib/xen/boot/pv-grub-$(XEN_TARGET_ARCH).gz"
 
 #######
 # clean
@@ -323,30 +329,30 @@ install-grub: pv-grub
 # Only clean the libxc/ioemu/mini-os part
 .PHONY: clean
 clean:
-       rm -fr mini-os-ioemu
-       rm -fr mini-os-c
-       rm -fr mini-os-caml
-       rm -fr mini-os-grub
+       rm -fr mini-os-$(XEN_TARGET_ARCH)-ioemu
+       rm -fr mini-os-$(XEN_TARGET_ARCH)-c
+       rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
+       rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
        $(MAKE) -C caml clean
        $(MAKE) -C c clean
-       $(MAKE) -C grub clean
-       [ ! -d libxc ] || $(MAKE) -C libxc clean
+       rm -fr grub-$(XEN_TARGET_ARCH)
+       [ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) -C 
libxc-$(XEN_TARGET_ARCH) clean
        [ ! -d ioemu ] || $(MAKE) -C ioemu clean
 
 # clean the cross-compilation result
 .PHONY: crossclean
 crossclean: clean
        rm -fr $(CROSS_ROOT)
-       rm -fr newlib-build
-       rm -fr zlib-$(ZLIB_VERSION) pciutils-$(LIBPCI_VERSION)
-       rm -fr libxc ioemu
-       rm -f mk-headers
+       rm -fr newlib-$(XEN_TARGET_ARCH)
+       rm -fr zlib-$(XEN_TARGET_ARCH) pciutils-$(XEN_TARGET_ARCH)
+       rm -fr libxc-$(XEN_TARGET_ARCH) ioemu
+       rm -f mk-headers-$(XEN_TARGET_ARCH)
 
 # clean patched sources
 .PHONY: patchclean
 patchclean: crossclean
        rm -fr newlib-$(NEWLIB_VERSION)
-       rm -fr lwip
+       rm -fr lwip-$(XEN_TARGET_ARCH)
        rm -fr grub-upstream
 
 # clean downloads
diff -r 37f3bdce0394 stubdom/grub/Makefile
--- a/stubdom/grub/Makefile     Mon Aug 11 12:36:26 2008 +0100
+++ b/stubdom/grub/Makefile     Thu Aug 14 13:30:23 2008 +0100
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/Config.mk
 include $(XEN_ROOT)/Config.mk
 vpath %.c ../grub-upstream
 
-BOOT=boot-$(XEN_TARGET_ARCH).o
+BOOT=$(OBJ_DIR)/boot-$(XEN_TARGET_ARCH).o
 
 DEF_CPPFLAGS += -I$(XEN_ROOT)/tools/libxc -I$(XEN_ROOT)/tools/include -I.
 DEF_CPPFLAGS += -I../grub-upstream/stage1
@@ -17,7 +17,7 @@ DEF_CPPFLAGS += -DPRESET_MENU_STRING='""
 DEF_CPPFLAGS += -DPRESET_MENU_STRING='""'
 DEF_CPPFLAGS += -DPACKAGE='"grubdom"' -DVERSION='"0.97"'
 
-all: main.a
+all: $(OBJ_DIR)/main.a
 
 STAGE2_SOURCES=builtins.c char_io.c cmdline.c common.c console.c disk_io.c 
graphics.c gunzip.c md5.c serial.c stage2.c terminfo.c tparm.c
 
@@ -59,16 +59,26 @@ NETBOOT_SOURCES:=$(addprefix netboot/,$(
 
 $(BOOT): DEF_CPPFLAGS+=-D__ASSEMBLY__
 
-OBJS = $(NETBOOT_SOURCES:.c=.o) $(STAGE2_SOURCES:.c=.o) kexec.o mini-os.o
+PV_GRUB_SOURCES = kexec.c mini-os.c
 
-dirs:
-       mkdir -p netboot stage2
+SOURCES = $(NETBOOT_SOURCES) $(STAGE2_SOURCES) $(PV_GRUB_SOURCES)
+
+OBJS = $(addprefix $(OBJ_DIR)/,$(SOURCES:.c=.o))
+
+$(OBJ_DIR)/dirs:
+       mkdir -p $(OBJ_DIR)/netboot $(OBJ_DIR)/stage2
        touch $@
 
-$(OBJS): dirs
+$(OBJS): $(OBJ_DIR)/dirs
 
-main.a: $(BOOT) $(OBJS)
+$(OBJ_DIR)/main.a: $(BOOT) $(OBJS)
        $(AR) cr $@ $^
+
+$(OBJ_DIR)/%.o: %.c
+       $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
+
+$(OBJ_DIR)/%.o: %.S
+       $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
 clean:
        rm -fr dirs *.a *.o stage2 netboot

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

<Prev in Thread] Current Thread [Next in Thread>