debuggers.hg

annotate stubdom/Makefile @ 17830:4ecc3ac69819

stubdom: prevent newlib from emiting cli/sti in longjmp
Also fix build dependencies and cleanup.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 09 09:42:14 2008 +0100 (2008-06-09)
parents 9593ceb1470d
children 7e00ebe2b7fd
rev   line source
keir@17066 1 XEN_ROOT = ..
keir@17066 2
keir@17070 3 export XEN_OS=MiniOS
keir@17070 4
keir@17066 5 include $(XEN_ROOT)/Config.mk
keir@17066 6 export stubdom=y
keir@17066 7 export debug=y
keir@17066 8
keir@17066 9 IOEMU_OPTIONS=--disable-vnc-tls
keir@17066 10 BINUTILS_VERSION=2.18
keir@17066 11 GCC_VERSION=4.2.2
keir@17066 12 ZLIB_VERSION=1.2.3
keir@17066 13 LIBPCI_VERSION=2.2.9
keir@17066 14 NEWLIB_DATE=2008-01-01
keir@17823 15 LWIP_DATE=2008-06-01
keir@17066 16
keir@17066 17 WGET=wget -c
keir@17066 18
keir@17066 19 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
keir@17066 20 ifeq ($(XEN_TARGET_ARCH),x86_32)
keir@17066 21 GNU_TARGET_ARCH:=i686
keir@17066 22 endif
keir@17066 23
keir@17066 24 ifeq ($(GNU_TARGET_ARCH), i686)
keir@17066 25 TARGET_CFLAGS=
keir@17830 26 NEWLIB_CFLAGS+=-D_I386MACH_ALLOW_HW_INTERRUPTS
keir@17066 27 endif
keir@17066 28 ifeq ($(GNU_TARGET_ARCH), x86_64)
keir@17066 29 TARGET_CFLAGS=-mno-red-zone
keir@17830 30 NEWLIB_CFLAGS+=-D_I386MACH_ALLOW_HW_INTERRUPTS
keir@17066 31 endif
keir@17066 32 ifeq ($(GNU_TARGET_ARCH), ia64)
keir@17066 33 TARGET_CFLAGS=-mconstant-gp
keir@17066 34 endif
keir@17066 35
keir@17066 36 CROSS_ROOT=cross-root-$(GNU_TARGET_ARCH)
keir@17066 37 CROSS_PREFIX=$(CURDIR)/$(CROSS_ROOT)
keir@17066 38 export CROSS_COMPILE=$(GNU_TARGET_ARCH)-xen-elf-
keir@17066 39 export PATH:=$(CROSS_PREFIX)/bin:$(PATH)
keir@17066 40
keir@17066 41 .PHONY: all
keir@17778 42 all: ioemu-stubdom c-stubdom
keir@17066 43
keir@17066 44 ################
keir@17066 45 # Cross-binutils
keir@17066 46 ################
keir@17066 47
keir@17066 48 binutils-$(BINUTILS_VERSION).tar.bz2:
keir@17066 49 $(WGET) http://ftp.gnu.org/gnu/binutils/$@
keir@17066 50 binutils-$(BINUTILS_VERSION): binutils-$(BINUTILS_VERSION).tar.bz2
keir@17066 51 tar xjf $@.tar.bz2
keir@17066 52 ( cd binutils-$(BINUTILS_VERSION) && patch -p1 < ../binutils.patch )
keir@17066 53 touch $@
keir@17066 54
keir@17066 55 BINUTILS_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-ar
keir@17066 56 .PHONY: cross-binutils
keir@17066 57 cross-binutils: $(BINUTILS_STAMPFILE)
keir@17066 58 $(BINUTILS_STAMPFILE): binutils-$(BINUTILS_VERSION)
keir@17071 59 mkdir -p binutils-build
keir@17071 60 ( cd binutils-build && \
keir@17066 61 ../binutils-$(BINUTILS_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf && \
keir@17066 62 $(MAKE) && \
keir@17066 63 $(MAKE) check && \
keir@17066 64 $(MAKE) install )
keir@17066 65
keir@17066 66 ###########
keir@17066 67 # Cross-gcc
keir@17066 68 ###########
keir@17066 69
keir@17066 70 gcc-$(GCC_VERSION).tar.bz2:
keir@17066 71 $(WGET) http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2
keir@17066 72 gcc-$(GCC_VERSION): gcc-$(GCC_VERSION).tar.bz2
keir@17066 73 tar xjf gcc-$(GCC_VERSION).tar.bz2
keir@17066 74 ( cd gcc-$(GCC_VERSION) && patch -p1 < ../gcc.patch )
keir@17066 75 touch $@
keir@17830 76
keir@17066 77 GCC_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-gcc-$(GCC_VERSION)
keir@17066 78 .PHONY: cross-gcc
keir@17066 79 cross-gcc: $(GCC_STAMPFILE)
keir@17066 80 $(GCC_STAMPFILE): gcc-$(GCC_VERSION) $(BINUTILS_STAMPFILE)
keir@17071 81 mkdir -p gcc-build
keir@17071 82 ( cd gcc-build && \
keir@17066 83 ../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 && \
keir@17066 84 $(MAKE) GCC_FOR_TARGET='$$$$r/gcc/xgcc -B$$$$r/gcc/ '"$(TARGET_CFLAGS)"' $$(FLAGS_FOR_TARGET)' && \
keir@17066 85 $(MAKE) install )
keir@17066 86
keir@17066 87 ##############
keir@17066 88 # Cross-newlib
keir@17066 89 ##############
keir@17066 90
keir@17072 91 newlib-cvs:
keir@17066 92 cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -D $(NEWLIB_DATE) newlib
keir@17071 93 mv src newlib-cvs
keir@17071 94 ( cd newlib-cvs && patch -p0 < ../newlib.patch)
keir@17066 95
keir@17066 96 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
keir@17066 97 .PHONY: cross-newlib
keir@17066 98 cross-newlib: $(NEWLIB_STAMPFILE)
keir@17072 99 $(NEWLIB_STAMPFILE): newlib-cvs $(GCC_STAMPFILE)
keir@17071 100 mkdir -p newlib-build
keir@17071 101 ( cd newlib-build && \
keir@17830 102 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 && \
keir@17066 103 $(MAKE) && \
keir@17066 104 $(MAKE) install )
keir@17066 105
keir@17066 106 ############
keir@17066 107 # Cross-zlib
keir@17066 108 ############
keir@17066 109
keir@17066 110 zlib-$(ZLIB_VERSION).tar.gz:
keir@17066 111 $(WGET) http://www.zlib.net/zlib-$(ZLIB_VERSION).tar.gz
keir@17066 112
keir@17066 113 ZLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libz.a
keir@17066 114 .PHONY: cross-zlib
keir@17066 115 cross-zlib: $(ZLIB_STAMPFILE)
keir@17066 116 $(ZLIB_STAMPFILE): zlib-$(ZLIB_VERSION).tar.gz $(NEWLIB_STAMPFILE)
keir@17066 117 tar xzf $<
keir@17066 118 ( cd zlib-$(ZLIB_VERSION) && \
keir@17066 119 CFLAGS="$(TARGET_CFLAGS)" CC=$(GNU_TARGET_ARCH)-xen-elf-gcc ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
keir@17066 120 $(MAKE) libz.a && \
keir@17066 121 $(MAKE) install )
keir@17066 122
keir@17066 123 ##############
keir@17066 124 # Cross-libpci
keir@17066 125 ##############
keir@17066 126
keir@17066 127 pciutils-$(LIBPCI_VERSION).tar.bz2:
keir@17066 128 $(WGET) http://www.kernel.org/pub/software/utils/pciutils/pciutils-$(LIBPCI_VERSION).tar.bz2
keir@17066 129
keir@17066 130 LIBPCI_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libpci.a
keir@17066 131 .PHONY: cross-libpci
keir@17066 132 cross-libpci: $(LIBPCI_STAMPFILE)
keir@17066 133 $(LIBPCI_STAMPFILE): pciutils-$(LIBPCI_VERSION).tar.bz2 $(NEWLIB_STAMPFILE) $(ZLIB_STAMPFILE)
keir@17066 134 tar xjf $<
keir@17066 135 ( cd pciutils-$(LIBPCI_VERSION) && \
keir@17066 136 cp ../libpci.config.h lib/config.h && \
keir@17066 137 echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
keir@17066 138 cp ../libpci.config.mak lib/config.mk && \
keir@17066 139 $(MAKE) CC="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS)" lib/libpci.a && \
keir@17066 140 $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
keir@17066 141 $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
keir@17066 142 $(INSTALL_DATA) lib/{config,header,pci,types}.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
keir@17066 143 )
keir@17066 144
keir@17066 145 ######
keir@17066 146 # lwIP
keir@17066 147 ######
keir@17066 148
keir@17071 149 lwip-cvs:
keir@17066 150 cvs -z 9 -d :pserver:anonymous@cvs.savannah.nongnu.org:/sources/lwip co -D $(LWIP_DATE) lwip
keir@17071 151 mv lwip lwip-cvs
keir@17066 152
keir@17066 153 #######
keir@17066 154 # Links
keir@17066 155 #######
keir@17066 156
keir@17066 157 .PHONY: $(CROSS_ROOT)
keir@17066 158 $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
keir@17066 159
keir@17066 160 .PHONY: mk-symlinks
keir@17066 161 mk-symlinks:
keir@17066 162 [ -h include ] || ln -sf ../tools/include .
keir@17066 163 mkdir -p libxc
keir@17066 164 [ -h libxc/Makefile ] || ( cd libxc && \
keir@17066 165 ln -sf ../../tools/libxc/*.h . && \
keir@17066 166 ln -sf ../../tools/libxc/*.c . && \
keir@17066 167 ln -sf ../../tools/libxc/Makefile . )
keir@17066 168 mkdir -p libxc/$(XEN_TARGET_ARCH)
keir@17066 169 [ -h libxc/$(XEN_TARGET_ARCH) ] || ( cd libxc/$(XEN_TARGET_ARCH) && \
keir@17066 170 ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
keir@17066 171 ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
keir@17066 172 ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
keir@17066 173 mkdir -p ioemu
keir@17066 174 [ -h ioemu/Makefile ] || ( cd ioemu && \
keir@17066 175 ln -sf ../../tools/ioemu/* . && \
keir@17066 176 ([ ! -h config-host.h ] || rm -f config-host.h) && \
keir@17066 177 ([ ! -h config-host.mak ] || rm -f config-host.mak) )
keir@17066 178 [ -h mini-os ] || ln -sf ../extras/mini-os .
keir@17778 179 [ -h mini-os/include/xen ] || ln -sf ../../../xen/include/public mini-os/include/xen
keir@17066 180
keir@17066 181 #######
keir@17066 182 # libxc
keir@17066 183 #######
keir@17066 184
keir@17066 185 .PHONY: libxc
keir@17066 186 libxc: cross-zlib mk-symlinks
keir@17066 187 $(MAKE) -C $@
keir@17066 188
keir@17066 189 #######
keir@17066 190 # ioemu
keir@17066 191 #######
keir@17066 192
keir@17066 193 .PHONY: ioemu
keir@17066 194 ioemu: cross-zlib cross-libpci mk-symlinks libxc
keir@17066 195 [ -f ioemu/config-host.mak ] || \
keir@17066 196 ( cd ioemu ; XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) sh configure --prefix=/usr --enable-stubdom $(IOEMU_OPTIONS))
keir@17071 197 $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-cvs
keir@17066 198
keir@17066 199 ######
keir@17066 200 # caml
keir@17066 201 ######
keir@17066 202
keir@17066 203 .PHONY: caml
keir@17830 204 caml: cross-newlib mk-symlinks
keir@17778 205 $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs
keir@17066 206
keir@17299 207 ###
keir@17299 208 # C
keir@17299 209 ###
keir@17299 210
keir@17299 211 .PHONY: c
keir@17830 212 c: cross-newlib mk-symlinks
keir@17778 213 $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs
keir@17299 214
keir@17066 215 ########
keir@17066 216 # minios
keir@17066 217 ########
keir@17066 218
keir@17778 219 .PHONY: ioemu-stubdom
keir@17778 220 ioemu-stubdom: lwip-cvs libxc ioemu
keir@17778 221 $(MAKE) -C mini-os TARGET=$@ LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS="$(CURDIR)/ioemu/i386-dm-stubdom/qemu.a $(CURDIR)/ioemu/i386-dm-stubdom/libqemu.a"
keir@17066 222
keir@17778 223 CAMLLIB = $(shell ocamlc -where)
keir@17066 224 .PHONY: caml-stubdom
keir@17778 225 caml-stubdom: lwip-cvs libxc caml
keir@17778 226 $(MAKE) -C mini-os TARGET=$@ LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS="$(CURDIR)/caml/main-c.o $(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
keir@17299 227
keir@17299 228 .PHONY: c-stubdom
keir@17778 229 c-stubdom: lwip-cvs libxc c
keir@17778 230 $(MAKE) -C mini-os TARGET=$@ LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS=$(CURDIR)/c/main.a
keir@17066 231
keir@17066 232 #########
keir@17066 233 # install
keir@17066 234 #########
keir@17066 235
keir@17778 236 install: mini-os/ioemu-stubdom.gz
keir@17066 237 $(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin"
keir@17778 238 $(INSTALL_PROG) $< "$(DESTDIR)/usr/lib/xen/boot/stubdom.gz"
keir@17066 239
keir@17066 240 #######
keir@17066 241 # clean
keir@17066 242 #######
keir@17066 243
keir@17066 244 # Only clean the libxc/ioemu/mini-os part
keir@17066 245 .PHONY: clean
keir@17066 246 clean:
keir@17071 247 -$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs clean
keir@17830 248 -$(MAKE) -C mini-os TARGET=ioemu-stubdom LWIPDIR=$(CURDIR)/lwip-cvs clean
keir@17830 249 -$(MAKE) -C mini-os TARGET=c-stubdom LWIPDIR=$(CURDIR)/lwip-cvs clean
keir@17830 250 -$(MAKE) -C mini-os TARGET=caml-stubdom LWIPDIR=$(CURDIR)/lwip-cvs clean
keir@17066 251 $(MAKE) -C caml clean
keir@17778 252 $(MAKE) -C c clean
keir@17066 253 rm -fr libxc ioemu mini-os include
keir@17066 254
keir@17066 255 # clean the cross-compilation result
keir@17066 256 .PHONY: crossclean
keir@17066 257 crossclean: clean
keir@17066 258 rm -fr $(CROSS_ROOT)
keir@17071 259 rm -fr binutils-build gcc-build newlib-build
keir@17066 260 rm -fr zlib-$(ZLIB_VERSION) pciutils-$(LIBPCI_VERSION)
keir@17066 261
keir@17066 262 # clean patched sources
keir@17066 263 .PHONY: patchclean
keir@17066 264 patchclean: crossclean
keir@17066 265 rm -fr binutils-$(BINUTILS_VERSION)
keir@17066 266 rm -fr gcc-$(GCC_VERSION)
keir@17071 267 rm -fr newlib-cvs
keir@17071 268 rm -fr lwip-cvs
keir@17066 269
keir@17066 270 # clean downloads
keir@17066 271 .PHONY: downloadclean
keir@17066 272 downloadclean: patchclean
keir@17066 273 rm -f binutils-$(BINUTILS_VERSION).tar.bz2
keir@17066 274 rm -f gcc-$(GCC_VERSION).tar.bz2
keir@17066 275 rm -f zlib-$(ZLIB_VERSION).tar.gz
keir@17066 276 rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
keir@17066 277
keir@17066 278 .PHONY: distclean
keir@17066 279 distclean: downloadclean