ia64/xen-unstable

changeset 18330:d3947223dfae

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@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Aug 14 13:46:48 2008 +0100 (2008-08-14)
parents ca7dd77d5365
children d09404ad5730
files .hgignore Makefile extras/mini-os/Makefile stubdom/Makefile stubdom/grub/Makefile
line diff
     1.1 --- a/.hgignore	Thu Aug 14 10:18:08 2008 +0100
     1.2 +++ b/.hgignore	Thu Aug 14 13:46:48 2008 +0100
     1.3 @@ -90,20 +90,16 @@
     1.4  ^stubdom/gcc-.*$
     1.5  ^stubdom/include$
     1.6  ^stubdom/ioemu$
     1.7 -^stubdom/libxc$
     1.8 +^stubdom/libxc-.*$
     1.9  ^stubdom/lwip-.*$
    1.10  ^stubdom/mini-os-.*$
    1.11 -^stubdom/mk-headers$
    1.12 +^stubdom/mk-headers-.*$
    1.13  ^stubdom/newlib-.*$
    1.14  ^stubdom/pciutils-.*$
    1.15  ^stubdom/zlib-.*$
    1.16 -^stubdom/grub-cvs$
    1.17 -^stubdom/grub/stage2$
    1.18 -^stubdom/grub/netboot$
    1.19 -^stubdom/grub/dirs$
    1.20 +^stubdom/grub-.*$
    1.21  ^stubdom/lwip/
    1.22  ^stubdom/ioemu/
    1.23 -^stubdom/grub-upstream/
    1.24  ^tools/.*/build/lib.*/.*\.py$
    1.25  ^tools/blktap/Makefile\.smh$
    1.26  ^tools/blktap/drivers/blktapctrl$
     2.1 --- a/Makefile	Thu Aug 14 10:18:08 2008 +0100
     2.2 +++ b/Makefile	Thu Aug 14 13:46:48 2008 +0100
     2.3 @@ -22,6 +22,9 @@ build: kernels
     2.4  	$(MAKE) -C xen build
     2.5  	$(MAKE) -C tools build
     2.6  	$(MAKE) -C stubdom build
     2.7 +ifeq (x86_64,$(XEN_TARGET_ARCH))
     2.8 +	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
     2.9 +endif
    2.10  	$(MAKE) -C docs build
    2.11  
    2.12  # The test target is for unit tests that can run without an installation.  Of
    2.13 @@ -71,6 +74,9 @@ install-kernels:
    2.14  .PHONY: install-stubdom
    2.15  install-stubdom:
    2.16  	$(MAKE) -C stubdom install
    2.17 +ifeq (x86_64,$(XEN_TARGET_ARCH))
    2.18 +	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
    2.19 +endif
    2.20  
    2.21  .PHONY: install-docs
    2.22  install-docs:
    2.23 @@ -109,6 +115,9 @@ clean::
    2.24  	$(MAKE) -C xen clean
    2.25  	$(MAKE) -C tools clean
    2.26  	$(MAKE) -C stubdom crossclean
    2.27 +ifeq (x86_64,$(XEN_TARGET_ARCH))
    2.28 +	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom crossclean
    2.29 +endif
    2.30  	$(MAKE) -C docs clean
    2.31  
    2.32  # clean, but blow away kernel build tree plus tarballs
    2.33 @@ -117,6 +126,9 @@ distclean:
    2.34  	$(MAKE) -C xen distclean
    2.35  	$(MAKE) -C tools distclean
    2.36  	$(MAKE) -C stubdom distclean
    2.37 +ifeq (x86_64,$(XEN_TARGET_ARCH))
    2.38 +	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom distclean
    2.39 +endif
    2.40  	$(MAKE) -C docs distclean
    2.41  	rm -rf dist patches/tmp
    2.42  	for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done
     3.1 --- a/extras/mini-os/Makefile	Thu Aug 14 10:18:08 2008 +0100
     3.2 +++ b/extras/mini-os/Makefile	Thu Aug 14 13:46:48 2008 +0100
     3.3 @@ -66,8 +66,8 @@ ifeq ($(lwip),y)
     3.4  # lwIP library
     3.5  LWC	:= $(shell find $(LWIPDIR)/ -type f -name '*.c')
     3.6  LWC	:= $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
     3.7 -LWC	+= lwip-arch.c lwip-net.c
     3.8  LWO	:= $(patsubst %.c,%.o,$(LWC))
     3.9 +LWO	+= $(addprefix $(OBJ_DIR)/,lwip-arch.o lwip-net.o)
    3.10  
    3.11  $(OBJ_DIR)/lwip.a: $(LWO)
    3.12  	$(RM) $@
    3.13 @@ -79,7 +79,7 @@ endif
    3.14  OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
    3.15  
    3.16  ifeq ($(libc),y)
    3.17 -APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -whole-archive -lxenguest -lxenctrl -no-whole-archive
    3.18 +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(XEN_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive
    3.19  APP_LDLIBS += -lpci
    3.20  APP_LDLIBS += -lz
    3.21  APP_LDLIBS += -lm
     4.1 --- a/stubdom/Makefile	Thu Aug 14 10:18:08 2008 +0100
     4.2 +++ b/stubdom/Makefile	Thu Aug 14 13:46:48 2008 +0100
     4.3 @@ -90,9 +90,9 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLI
     4.4  NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
     4.5  .PHONY: cross-newlib
     4.6  cross-newlib: $(NEWLIB_STAMPFILE)
     4.7 -$(NEWLIB_STAMPFILE): mk-headers newlib-$(NEWLIB_VERSION)
     4.8 -	mkdir -p newlib-build
     4.9 -	( cd newlib-build && \
    4.10 +$(NEWLIB_STAMPFILE): mk-headers-$(XEN_TARGET_ARCH) newlib-$(NEWLIB_VERSION)
    4.11 +	mkdir -p newlib-$(XEN_TARGET_ARCH)
    4.12 +	( cd newlib-$(XEN_TARGET_ARCH) && \
    4.13  	  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 && \
    4.14  	  $(MAKE) && \
    4.15  	  DESTDIR= $(MAKE) install )
    4.16 @@ -104,12 +104,15 @@ cross-newlib: $(NEWLIB_STAMPFILE)
    4.17  zlib-$(ZLIB_VERSION).tar.gz:
    4.18  	$(WGET) $(ZLIB_URL)/$@
    4.19  
    4.20 +zlib-$(XEN_TARGET_ARCH): zlib-$(ZLIB_VERSION).tar.gz 
    4.21 +	tar xzf $<
    4.22 +	mv zlib-$(ZLIB_VERSION) $@
    4.23 +
    4.24  ZLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libz.a
    4.25  .PHONY: cross-zlib
    4.26  cross-zlib: $(ZLIB_STAMPFILE)
    4.27 -$(ZLIB_STAMPFILE): zlib-$(ZLIB_VERSION).tar.gz $(NEWLIB_STAMPFILE)
    4.28 -	tar xzf $<
    4.29 -	( cd zlib-$(ZLIB_VERSION) && \
    4.30 +$(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
    4.31 +	( cd $< && \
    4.32  	  CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
    4.33  	  $(MAKE) libz.a && \
    4.34  	  $(MAKE) install )
    4.35 @@ -121,16 +124,17 @@ cross-zlib: $(ZLIB_STAMPFILE)
    4.36  pciutils-$(LIBPCI_VERSION).tar.bz2:
    4.37  	$(WGET) $(LIBPCI_URL)/$@
    4.38  
    4.39 -pciutils-$(LIBPCI_VERSION): pciutils-$(LIBPCI_VERSION).tar.bz2
    4.40 +pciutils-$(XEN_TARGET_ARCH): pciutils-$(LIBPCI_VERSION).tar.bz2
    4.41  	tar xjf $<
    4.42 +	mv pciutils-$(LIBPCI_VERSION) $@
    4.43  	patch -d $@ -p1 < pciutils.patch
    4.44  	touch $@
    4.45  
    4.46  LIBPCI_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libpci.a
    4.47  .PHONY: cross-libpci
    4.48  cross-libpci: $(LIBPCI_STAMPFILE)
    4.49 -$(LIBPCI_STAMPFILE): pciutils-$(LIBPCI_VERSION) $(NEWLIB_STAMPFILE) $(ZLIB_STAMPFILE)
    4.50 -	( cd pciutils-$(LIBPCI_VERSION) && \
    4.51 +$(LIBPCI_STAMPFILE): pciutils-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE) $(ZLIB_STAMPFILE)
    4.52 +	( cd $< && \
    4.53  	  cp ../libpci.config.h lib/config.h && \
    4.54  	  echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
    4.55  	  cp ../libpci.config.mak lib/config.mk && \
    4.56 @@ -147,8 +151,9 @@ cross-libpci: $(LIBPCI_STAMPFILE)
    4.57  lwip-$(LWIP_VERSION).tar.gz:
    4.58  	$(WGET) $(LWIP_URL)/$@
    4.59  
    4.60 -lwip: lwip-$(LWIP_VERSION).tar.gz
    4.61 +lwip-$(XEN_TARGET_ARCH): lwip-$(LWIP_VERSION).tar.gz
    4.62  	tar xzf $<
    4.63 +	mv lwip $@
    4.64  	patch -d $@ -p0 < lwip.patch-cvs
    4.65  	touch $@
    4.66  
    4.67 @@ -159,7 +164,7 @@ lwip: lwip-$(LWIP_VERSION).tar.gz
    4.68  .PHONY: $(CROSS_ROOT)
    4.69  $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
    4.70  
    4.71 -mk-headers:
    4.72 +mk-headers-$(XEN_TARGET_ARCH):
    4.73  	mkdir -p include/xen && \
    4.74            ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/xen/include/public/*.h)) include/xen && \
    4.75            ln -sf $(addprefix ../../$(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) include/xen && \
    4.76 @@ -168,13 +173,13 @@ mk-headers:
    4.77  	  ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*)) include/xen-foreign/ && \
    4.78  	  $(MAKE) -C include/xen-foreign/ && \
    4.79  	  ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign include/xen/foreign )
    4.80 -	mkdir -p libxc
    4.81 -	[ -h libxc/Makefile ] || ( cd libxc && \
    4.82 +	mkdir -p libxc-$(XEN_TARGET_ARCH)
    4.83 +	[ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd libxc-$(XEN_TARGET_ARCH) && \
    4.84  	  ln -sf ../$(XEN_ROOT)/tools/libxc/*.h . && \
    4.85  	  ln -sf ../$(XEN_ROOT)/tools/libxc/*.c . && \
    4.86  	  ln -sf ../$(XEN_ROOT)/tools/libxc/Makefile . )
    4.87 -	mkdir -p libxc/$(XEN_TARGET_ARCH)
    4.88 -	[ -h libxc/$(XEN_TARGET_ARCH) ] || ( cd libxc/$(XEN_TARGET_ARCH) && \
    4.89 +	mkdir -p libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH)
    4.90 +	[ -h libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) ] || ( cd libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) && \
    4.91  	  ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
    4.92  	  ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
    4.93  	  ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
    4.94 @@ -195,9 +200,9 @@ endif
    4.95  	[ ! -h ioemu/config-host.h ] || rm -f ioemu/config-host.h
    4.96  	[ ! -h ioemu/config-host.mak ] || rm -f ioemu/config-host.mak
    4.97  	$(MAKE) -C $(MINI_OS) links
    4.98 -	touch mk-headers
    4.99 +	touch mk-headers-$(XEN_TARGET_ARCH)
   4.100  
   4.101 -TARGETS_MINIOS=$(addprefix mini-os-,$(TARGETS))
   4.102 +TARGETS_MINIOS=$(addprefix mini-os-$(XEN_TARGET_ARCH)-,$(TARGETS))
   4.103  $(TARGETS_MINIOS): mini-os-%:
   4.104  	[ -d $@ ] || \
   4.105  	for i in $$(cd $(MINI_OS) ; find . -type d) ; do \
   4.106 @@ -209,9 +214,9 @@ TARGETS_MINIOS=$(addprefix mini-os-,$(TA
   4.107  #######
   4.108  
   4.109  .PHONY: libxc
   4.110 -libxc: libxc/libxenctrl.a libxc/libxenguest.a
   4.111 -libxc/libxenctrl.a libxc/libxenguest.a:: cross-zlib
   4.112 -	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C libxc
   4.113 +libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
   4.114 +libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a:: cross-zlib
   4.115 +	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C libxc-$(XEN_TARGET_ARCH)
   4.116  
   4.117  #######
   4.118  # ioemu
   4.119 @@ -223,12 +228,12 @@ ifeq ($(CONFIG_QEMU),ioemu)
   4.120  	[ -f ioemu/config-host.mak ] || \
   4.121  	  ( cd ioemu ; \
   4.122            XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) CFLAGS="$(TARGET_CFLAGS)" sh configure --prefix=/usr --enable-stubdom $(IOEMU_OPTIONS))
   4.123 -	CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip TOOLS=
   4.124 +	CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) TOOLS=
   4.125  else
   4.126  	[ -f ioemu/config-host.mak ] || \
   4.127  	  ( cd ioemu ; \
   4.128            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))
   4.129 -	CPPFLAGS= TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip TOOLS= CONFIG_STUBDOM=yes
   4.130 +	CPPFLAGS= TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) TOOLS= CONFIG_STUBDOM=yes
   4.131  endif
   4.132  
   4.133  ######
   4.134 @@ -237,7 +242,7 @@ endif
   4.135  
   4.136  .PHONY: caml
   4.137  caml: $(CROSS_ROOT)
   4.138 -	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip 
   4.139 +	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
   4.140  
   4.141  ###
   4.142  # C
   4.143 @@ -245,7 +250,7 @@ caml: $(CROSS_ROOT)
   4.144  
   4.145  .PHONY: c
   4.146  c: $(CROSS_ROOT)
   4.147 -	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip 
   4.148 +	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
   4.149  
   4.150  ######
   4.151  # Grub
   4.152 @@ -263,7 +268,8 @@ grub-upstream: grub-$(GRUB_VERSION).tar.
   4.153  
   4.154  .PHONY: grub
   4.155  grub: grub-upstream $(CROSS_ROOT)
   4.156 -	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@
   4.157 +	mkdir -p grub-$(XEN_TARGET_ARCH)
   4.158 +	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
   4.159  
   4.160  ########
   4.161  # minios
   4.162 @@ -275,21 +281,21 @@ ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/
   4.163  else
   4.164  ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
   4.165  endif
   4.166 -ioemu-stubdom: mini-os-ioemu lwip libxc ioemu
   4.167 -	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)"
   4.168 +ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc ioemu
   4.169 +	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)"
   4.170  
   4.171  CAMLLIB = $(shell ocamlc -where)
   4.172  .PHONY: caml-stubdom
   4.173 -caml-stubdom: mini-os-caml lwip libxc caml
   4.174 -	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"
   4.175 +caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc caml
   4.176 +	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"
   4.177  
   4.178  .PHONY: c-stubdom
   4.179 -c-stubdom: mini-os-c lwip libxc c
   4.180 -	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
   4.181 +c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
   4.182 +	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
   4.183  
   4.184  .PHONY: pv-grub
   4.185 -pv-grub: mini-os-grub libxc grub
   4.186 -	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
   4.187 +pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
   4.188 +	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
   4.189  
   4.190  #########
   4.191  # install
   4.192 @@ -309,11 +315,11 @@ install-ioemu: ioemu-stubdom
   4.193  	$(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/bin"
   4.194  	$(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin"
   4.195  	$(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/boot"
   4.196 -	$(INSTALL_DATA) mini-os-ioemu/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/ioemu-stubdom.gz"
   4.197 +	$(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-ioemu/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/ioemu-stubdom.gz"
   4.198  
   4.199  install-grub: pv-grub
   4.200  	$(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/boot"
   4.201 -	$(INSTALL_DATA) mini-os-grub/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/pv-grub.gz"
   4.202 +	$(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/pv-grub-$(XEN_TARGET_ARCH).gz"
   4.203  
   4.204  #######
   4.205  # clean
   4.206 @@ -322,30 +328,30 @@ install-grub: pv-grub
   4.207  # Only clean the libxc/ioemu/mini-os part
   4.208  .PHONY: clean
   4.209  clean:
   4.210 -	rm -fr mini-os-ioemu
   4.211 -	rm -fr mini-os-c
   4.212 -	rm -fr mini-os-caml
   4.213 -	rm -fr mini-os-grub
   4.214 +	rm -fr mini-os-$(XEN_TARGET_ARCH)-ioemu
   4.215 +	rm -fr mini-os-$(XEN_TARGET_ARCH)-c
   4.216 +	rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
   4.217 +	rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
   4.218  	$(MAKE) -C caml clean
   4.219  	$(MAKE) -C c clean
   4.220 -	$(MAKE) -C grub clean
   4.221 -	[ ! -d libxc ] || $(MAKE) -C libxc clean
   4.222 +	rm -fr grub-$(XEN_TARGET_ARCH)
   4.223 +	[ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) -C libxc-$(XEN_TARGET_ARCH) clean
   4.224  	[ ! -d ioemu ] || $(MAKE) -C ioemu clean
   4.225  
   4.226  # clean the cross-compilation result
   4.227  .PHONY: crossclean
   4.228  crossclean: clean
   4.229  	rm -fr $(CROSS_ROOT)
   4.230 -	rm -fr newlib-build
   4.231 -	rm -fr zlib-$(ZLIB_VERSION) pciutils-$(LIBPCI_VERSION)
   4.232 -	rm -fr libxc ioemu
   4.233 -	rm -f mk-headers
   4.234 +	rm -fr newlib-$(XEN_TARGET_ARCH)
   4.235 +	rm -fr zlib-$(XEN_TARGET_ARCH) pciutils-$(XEN_TARGET_ARCH)
   4.236 +	rm -fr libxc-$(XEN_TARGET_ARCH) ioemu
   4.237 +	rm -f mk-headers-$(XEN_TARGET_ARCH)
   4.238  
   4.239  # clean patched sources
   4.240  .PHONY: patchclean
   4.241  patchclean: crossclean
   4.242  	rm -fr newlib-$(NEWLIB_VERSION)
   4.243 -	rm -fr lwip
   4.244 +	rm -fr lwip-$(XEN_TARGET_ARCH)
   4.245  	rm -fr grub-upstream
   4.246  
   4.247  # clean downloads
     5.1 --- a/stubdom/grub/Makefile	Thu Aug 14 10:18:08 2008 +0100
     5.2 +++ b/stubdom/grub/Makefile	Thu Aug 14 13:46:48 2008 +0100
     5.3 @@ -3,7 +3,7 @@ XEN_ROOT = ../..
     5.4  include $(XEN_ROOT)/Config.mk
     5.5  vpath %.c ../grub-upstream
     5.6  
     5.7 -BOOT=boot-$(XEN_TARGET_ARCH).o
     5.8 +BOOT=$(OBJ_DIR)/boot-$(XEN_TARGET_ARCH).o
     5.9  
    5.10  DEF_CPPFLAGS += -I$(XEN_ROOT)/tools/libxc -I$(XEN_ROOT)/tools/include -I.
    5.11  DEF_CPPFLAGS += -I../grub-upstream/stage1
    5.12 @@ -17,7 +17,7 @@ DEF_CPPFLAGS += -DSUPPORT_SERIAL
    5.13  DEF_CPPFLAGS += -DPRESET_MENU_STRING='""'
    5.14  DEF_CPPFLAGS += -DPACKAGE='"grubdom"' -DVERSION='"0.97"'
    5.15  
    5.16 -all: main.a
    5.17 +all: $(OBJ_DIR)/main.a
    5.18  
    5.19  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
    5.20  
    5.21 @@ -59,16 +59,26 @@ NETBOOT_SOURCES:=$(addprefix netboot/,$(
    5.22  
    5.23  $(BOOT): DEF_CPPFLAGS+=-D__ASSEMBLY__
    5.24  
    5.25 -OBJS = $(NETBOOT_SOURCES:.c=.o) $(STAGE2_SOURCES:.c=.o) kexec.o mini-os.o
    5.26 +PV_GRUB_SOURCES = kexec.c mini-os.c
    5.27  
    5.28 -dirs:
    5.29 -	mkdir -p netboot stage2
    5.30 +SOURCES = $(NETBOOT_SOURCES) $(STAGE2_SOURCES) $(PV_GRUB_SOURCES)
    5.31 +
    5.32 +OBJS = $(addprefix $(OBJ_DIR)/,$(SOURCES:.c=.o))
    5.33 +
    5.34 +$(OBJ_DIR)/dirs:
    5.35 +	mkdir -p $(OBJ_DIR)/netboot $(OBJ_DIR)/stage2
    5.36  	touch $@
    5.37  
    5.38 -$(OBJS): dirs
    5.39 +$(OBJS): $(OBJ_DIR)/dirs
    5.40  
    5.41 -main.a: $(BOOT) $(OBJS)
    5.42 +$(OBJ_DIR)/main.a: $(BOOT) $(OBJS)
    5.43  	$(AR) cr $@ $^
    5.44  
    5.45 +$(OBJ_DIR)/%.o: %.c
    5.46 +	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
    5.47 +
    5.48 +$(OBJ_DIR)/%.o: %.S
    5.49 +	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
    5.50 +
    5.51  clean:
    5.52  	rm -fr dirs *.a *.o stage2 netboot