ia64/xen-unstable

view stubdom/Makefile @ 17916:10e79ad54c91

blktap: Extend userland busid to 32 bits

Signed-off-by: Chris Lalancette <clalance@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 27 16:08:56 2008 +0100 (2008-06-27)
parents c8d9ade45781
children b3d827e63a09
line source
1 XEN_ROOT = ..
2 MINI_OS = $(XEN_ROOT)/extras/mini-os
4 export XEN_OS=MiniOS
6 include $(XEN_ROOT)/Config.mk
7 export stubdom=y
8 export debug=y
10 IOEMU_OPTIONS=--disable-vnc-tls
11 BINUTILS_VERSION=2.18
12 GCC_VERSION=4.2.2
13 ZLIB_VERSION=1.2.3
14 LIBPCI_VERSION=2.2.9
15 NEWLIB_DATE=2008-01-01
16 LWIP_DATE=2008-06-01
17 GRUB_DATE=2008-06-01
19 WGET=wget -c
21 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
22 ifeq ($(XEN_TARGET_ARCH),x86_32)
23 GNU_TARGET_ARCH:=i686
24 endif
26 ifeq ($(GNU_TARGET_ARCH), i686)
27 TARGET_CFLAGS=
28 NEWLIB_CFLAGS+=-D_I386MACH_ALLOW_HW_INTERRUPTS
29 endif
30 ifeq ($(GNU_TARGET_ARCH), x86_64)
31 TARGET_CFLAGS=-mno-red-zone
32 NEWLIB_CFLAGS+=-D_I386MACH_ALLOW_HW_INTERRUPTS
33 endif
34 ifeq ($(GNU_TARGET_ARCH), ia64)
35 TARGET_CFLAGS=-mconstant-gp
36 endif
38 CROSS_ROOT=cross-root-$(GNU_TARGET_ARCH)
39 CROSS_PREFIX=$(CURDIR)/$(CROSS_ROOT)
40 export CROSS_COMPILE=$(GNU_TARGET_ARCH)-xen-elf-
41 export PATH:=$(CROSS_PREFIX)/bin:$(PATH)
43 TARGETS=ioemu c caml grub
45 .PHONY: all
46 all: ioemu-stubdom c-stubdom pv-grub
48 ################
49 # Cross-binutils
50 ################
52 binutils-$(BINUTILS_VERSION).tar.bz2:
53 $(WGET) http://ftp.gnu.org/gnu/binutils/$@
54 binutils-$(BINUTILS_VERSION): binutils-$(BINUTILS_VERSION).tar.bz2
55 tar xjf $<
56 patch -d $@ -p1 < binutils.patch
57 touch $@
59 BINUTILS_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-ar
60 .PHONY: cross-binutils
61 cross-binutils: $(BINUTILS_STAMPFILE)
62 $(BINUTILS_STAMPFILE): binutils-$(BINUTILS_VERSION)
63 mkdir -p binutils-build
64 ( cd binutils-build && \
65 ../binutils-$(BINUTILS_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf && \
66 $(MAKE) && \
67 $(MAKE) check && \
68 $(MAKE) install )
70 ###########
71 # Cross-gcc
72 ###########
74 gcc-$(GCC_VERSION).tar.bz2:
75 $(WGET) http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2
76 gcc-$(GCC_VERSION): gcc-$(GCC_VERSION).tar.bz2
77 tar xjf $<
78 patch -d $@ -p1 < gcc.patch
79 touch $@
81 GCC_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-gcc-$(GCC_VERSION)
82 .PHONY: cross-gcc
83 cross-gcc: $(GCC_STAMPFILE)
84 $(GCC_STAMPFILE): gcc-$(GCC_VERSION) $(BINUTILS_STAMPFILE)
85 mkdir -p gcc-build
86 ( cd gcc-build && \
87 ../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 && \
88 $(MAKE) GCC_FOR_TARGET='$$$$r/gcc/xgcc -B$$$$r/gcc/ '"$(TARGET_CFLAGS)"' $$(FLAGS_FOR_TARGET)' && \
89 $(MAKE) install )
91 ##############
92 # Cross-newlib
93 ##############
95 newlib-cvs:
96 cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -D $(NEWLIB_DATE) newlib
97 mv src newlib-cvs
98 patch -d $@ -p0 < newlib.patch
100 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
101 .PHONY: cross-newlib
102 cross-newlib: $(NEWLIB_STAMPFILE)
103 $(NEWLIB_STAMPFILE): newlib-cvs $(GCC_STAMPFILE)
104 mkdir -p newlib-build
105 ( cd newlib-build && \
106 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 && \
107 $(MAKE) && \
108 $(MAKE) install )
110 ############
111 # Cross-zlib
112 ############
114 zlib-$(ZLIB_VERSION).tar.gz:
115 $(WGET) http://www.zlib.net/zlib-$(ZLIB_VERSION).tar.gz
117 ZLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libz.a
118 .PHONY: cross-zlib
119 cross-zlib: $(ZLIB_STAMPFILE)
120 $(ZLIB_STAMPFILE): zlib-$(ZLIB_VERSION).tar.gz $(NEWLIB_STAMPFILE)
121 tar xzf $<
122 ( cd zlib-$(ZLIB_VERSION) && \
123 CFLAGS="$(TARGET_CFLAGS)" CC=$(GNU_TARGET_ARCH)-xen-elf-gcc ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
124 $(MAKE) libz.a && \
125 $(MAKE) install )
127 ##############
128 # Cross-libpci
129 ##############
131 pciutils-$(LIBPCI_VERSION).tar.bz2:
132 $(WGET) http://www.kernel.org/pub/software/utils/pciutils/pciutils-$(LIBPCI_VERSION).tar.bz2
134 LIBPCI_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libpci.a
135 .PHONY: cross-libpci
136 cross-libpci: $(LIBPCI_STAMPFILE)
137 $(LIBPCI_STAMPFILE): pciutils-$(LIBPCI_VERSION).tar.bz2 $(NEWLIB_STAMPFILE) $(ZLIB_STAMPFILE)
138 tar xjf $<
139 ( cd pciutils-$(LIBPCI_VERSION) && \
140 cp ../libpci.config.h lib/config.h && \
141 echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
142 cp ../libpci.config.mak lib/config.mk && \
143 $(MAKE) CC="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS)" lib/libpci.a && \
144 $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
145 $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
146 $(INSTALL_DATA) lib/{config,header,pci,types}.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
147 )
149 ######
150 # lwIP
151 ######
153 lwip-cvs:
154 cvs -z 9 -d :pserver:anonymous@cvs.savannah.nongnu.org:/sources/lwip co -D $(LWIP_DATE) -d $@ lwip
156 #######
157 # Links
158 #######
160 .PHONY: $(CROSS_ROOT)
161 $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
163 .PHONY: mk-symlinks
164 mk-symlinks:
165 [ -h include ] || ln -sf ../tools/include .
166 mkdir -p libxc
167 [ -h libxc/Makefile ] || ( cd libxc && \
168 ln -sf ../$(XEN_ROOT)/tools/libxc/*.h . && \
169 ln -sf ../$(XEN_ROOT)/tools/libxc/*.c . && \
170 ln -sf ../$(XEN_ROOT)/tools/libxc/Makefile . )
171 mkdir -p libxc/$(XEN_TARGET_ARCH)
172 [ -h libxc/$(XEN_TARGET_ARCH) ] || ( cd libxc/$(XEN_TARGET_ARCH) && \
173 ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
174 ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
175 ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
176 mkdir -p ioemu
177 [ -h ioemu/Makefile ] || ( cd ioemu && \
178 ln -sf ../$(XEN_ROOT)/tools/ioemu/* . && \
179 ([ ! -h config-host.h ] || rm -f config-host.h) && \
180 ([ ! -h config-host.mak ] || rm -f config-host.mak) )
181 $(MAKE) -C $(MINI_OS) links
183 TARGETS_MINIOS=$(addprefix mini-os-,$(TARGETS))
184 $(TARGETS_MINIOS): mini-os-%:
185 [ -d $@ ] || \
186 for i in $$(cd $(MINI_OS) ; find . -type d) ; do \
187 mkdir -p $@/$$i ; \
188 done
190 #######
191 # libxc
192 #######
194 .PHONY: libxc
195 libxc: libxc/libxenctrl.a libxc/libxenguest.a
196 libxc/libxenctrl.a libxc/libxenguest.a: cross-zlib mk-symlinks
197 $(MAKE) -C libxc
199 #######
200 # ioemu
201 #######
203 .PHONY: ioemu
204 ioemu: cross-zlib cross-libpci mk-symlinks libxc
205 [ -f ioemu/config-host.mak ] || \
206 ( cd ioemu ; XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) sh configure --prefix=/usr --enable-stubdom $(IOEMU_OPTIONS))
207 $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-cvs
209 ######
210 # caml
211 ######
213 .PHONY: caml
214 caml: cross-newlib mk-symlinks
215 $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs
217 ###
218 # C
219 ###
221 .PHONY: c
222 c: cross-newlib mk-symlinks
223 $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs
225 ######
226 # Grub
227 ######
229 grub-cvs:
230 cvs -z 9 -d :pserver:anonymous@cvs.sv.gnu.org:/sources/grub co -D $(GRUB_DATE) -d $@ grub
231 for i in grub.patches/* ; do \
232 patch -d $@ -p1 < $$i ; \
233 done
235 .PHONY: grub
236 grub: grub-cvs cross-newlib mk-symlinks
237 $(MAKE) -C $@
239 ########
240 # minios
241 ########
243 .PHONY: ioemu-stubdom
244 ioemu-stubdom: mini-os-ioemu lwip-cvs libxc ioemu
245 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"
247 CAMLLIB = $(shell ocamlc -where)
248 .PHONY: caml-stubdom
249 caml-stubdom: mini-os-caml lwip-cvs libxc caml
250 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"
252 .PHONY: c-stubdom
253 c-stubdom: mini-os-c lwip-cvs libxc c
254 DEF_CFLAGS=-DCONFIG_C $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS=$(CURDIR)/c/main.a
256 .PHONY: pv-grub
257 pv-grub: mini-os-grub libxc grub
258 DEF_CFLAGS=-DCONFIG_GRUB $(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub/main.a
260 #########
261 # install
262 #########
264 install: install-ioemu install-grub
266 install-ioemu: mini-os-ioemu/mini-os.gz
267 $(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin"
268 $(INSTALL_PROG) $< "$(DESTDIR)/usr/lib/xen/boot/ioemu-stubdom.gz"
270 install-grub: mini-os-grub/mini-os.gz
271 $(INSTALL_PROG) $< "$(DESTDIR)/usr/lib/xen/boot/pv-grub.gz"
273 #######
274 # clean
275 #######
277 # Only clean the libxc/ioemu/mini-os part
278 .PHONY: clean
279 clean:
280 rm -fr mini-os-ioemu
281 rm -fr mini-os-c
282 rm -fr mini-os-caml
283 rm -fr mini-os-grub
284 $(MAKE) -C caml clean
285 $(MAKE) -C c clean
286 $(MAKE) -C grub clean
287 rm -fr libxc ioemu mini-os include
289 # clean the cross-compilation result
290 .PHONY: crossclean
291 crossclean: clean
292 rm -fr $(CROSS_ROOT)
293 rm -fr binutils-build gcc-build newlib-build
294 rm -fr zlib-$(ZLIB_VERSION) pciutils-$(LIBPCI_VERSION)
296 # clean patched sources
297 .PHONY: patchclean
298 patchclean: crossclean
299 rm -fr binutils-$(BINUTILS_VERSION)
300 rm -fr gcc-$(GCC_VERSION)
301 rm -fr newlib-cvs
302 rm -fr lwip-cvs
303 rm -fr grub-cvs
305 # clean downloads
306 .PHONY: downloadclean
307 downloadclean: patchclean
308 rm -f binutils-$(BINUTILS_VERSION).tar.bz2
309 rm -f gcc-$(GCC_VERSION).tar.bz2
310 rm -f zlib-$(ZLIB_VERSION).tar.gz
311 rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
313 .PHONY: distclean
314 distclean: downloadclean