ia64/xen-unstable

view tools/libxc/Makefile @ 17042:a905c582a406

Add stubdomain support. See stubdom/README for usage details.

- Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in
arch_limits.h so as to permit getting them from there without
pulling all the internal Mini-OS defines.
- Setup a xen-elf cross-compilation environment in stubdom/cross-root
- Add a POSIX layer on top of Mini-OS by linking against the newlib C
library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c
- Cross-compile zlib and libpci too.
- Add an xs.h-compatible layer on top of Mini-OS' xenbus.
- Cross-compile libxc with an additional xc_minios.c and a few things
disabled.
- Cross-compile ioemu with an additional block-vbd, but without sound,
tpm and other details. A few hacks are needed:
- Align ide and scsi buffers at least on sector size to permit
direct transmission to the block backend. While we are at it, just
page-align it to possibly save a segment. Also, limit the scsi
buffer size because of limitations of the block paravirtualization
protocol.
- Allocate big tables dynamically rather that letting them go to
bss: when Mini-OS gets installed in memory, bss is not lazily
allocated, and doing so during Mini-OS is unnecessarily trick while
we can simply use malloc.
- Had to change the Mini-OS compilation somehow, so as to export
Mini-OS compilation flags to the Makefiles of libxc and ioemu.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 12 14:35:39 2008 +0000 (2008-02-12)
parents d5dd9a457337
children 7e91007fa727
line source
1 XEN_ROOT = ../..
2 include $(XEN_ROOT)/tools/Rules.mk
4 MAJOR = 3.2
5 MINOR = 0
7 CTRL_SRCS-y :=
8 ifneq ($(stubdom),y)
9 CTRL_SRCS-y += xc_core.c
10 CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c
11 CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c
12 CTRL_SRCS-$(CONFIG_POWERPC) += xc_core_powerpc.c
13 endif
14 CTRL_SRCS-y += xc_domain.c
15 CTRL_SRCS-y += xc_evtchn.c
16 CTRL_SRCS-y += xc_misc.c
17 CTRL_SRCS-y += xc_acm.c
18 CTRL_SRCS-y += xc_flask.c
19 CTRL_SRCS-y += xc_physdev.c
20 CTRL_SRCS-y += xc_private.c
21 CTRL_SRCS-y += xc_sedf.c
22 CTRL_SRCS-y += xc_csched.c
23 CTRL_SRCS-y += xc_tbuf.c
24 ifneq ($(stubdom),y)
25 CTRL_SRCS-y += xc_resume.c
26 endif
27 CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
28 ifneq ($(stubdom),y)
29 CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
30 CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
31 CTRL_SRCS-$(CONFIG_X86_Linux) += xc_ptrace.c xc_ptrace_core.c
32 CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
33 endif
34 CTRL_SRCS-$(stubdom) += xc_minios.c
36 GUEST_SRCS-y :=
37 GUEST_SRCS-y += xg_private.c
38 ifneq ($(stubdom),y)
39 GUEST_SRCS-$(CONFIG_MIGRATE) += xc_domain_restore.c xc_domain_save.c
40 GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c
41 endif
43 VPATH = ../../xen/common/libelf
44 CFLAGS += -I../../xen/common/libelf
46 ifneq ($(stubdom),y)
47 GUEST_SRCS-y += libelf-tools.c libelf-loader.c
48 GUEST_SRCS-y += libelf-dominfo.c libelf-relocate.c
50 # new domain builder
51 GUEST_SRCS-y += xc_dom_core.c xc_dom_boot.c
52 GUEST_SRCS-y += xc_dom_elfloader.c
53 GUEST_SRCS-y += xc_dom_binloader.c
54 GUEST_SRCS-y += xc_dom_compat_linux.c
56 GUEST_SRCS-$(CONFIG_X86) += xc_dom_x86.c
57 GUEST_SRCS-$(CONFIG_IA64) += xc_dom_ia64.c
58 GUEST_SRCS-$(CONFIG_POWERPC) += xc_dom_powerpc.c
59 endif
61 -include $(XEN_TARGET_ARCH)/Makefile
63 CFLAGS += -Werror -Wmissing-prototypes
64 CFLAGS += $(INCLUDES) -I. -I../xenstore -I../include
66 # Needed for posix_fadvise64() in xc_linux.c
67 CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
69 # Define this to make it possible to run valgrind on code linked with these
70 # libraries.
71 #CFLAGS += -DVALGRIND -O0 -ggdb3
73 # Get gcc to generate the dependencies for us.
74 CFLAGS += -Wp,-MD,.$(@F).d
75 LDFLAGS += -L.
76 DEPS = .*.d
78 ifneq ($(stubdom),y)
79 LDLIBS = -lpthread
80 endif
82 CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y))
83 CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y))
85 GUEST_LIB_OBJS := $(patsubst %.c,%.o,$(GUEST_SRCS-y))
86 GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y))
88 LIB := libxenctrl.a
89 ifneq ($(stubdom),y)
90 LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
91 endif
93 LIB += libxenguest.a
94 ifneq ($(stubdom),y)
95 LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
96 endif
98 .PHONY: all
99 all: build
101 .PHONY: build
102 build:
103 $(MAKE) libs
105 .PHONY: libs
106 libs: $(LIB)
108 .PHONY: install
109 install: build
110 $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
111 $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
112 $(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
113 $(INSTALL_DATA) libxenctrl.a $(DESTDIR)$(LIBDIR)
114 ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so.$(MAJOR)
115 ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so
116 $(INSTALL_DATA) xenctrl.h $(DESTDIR)$(INCLUDEDIR)
118 $(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
119 $(INSTALL_DATA) libxenguest.a $(DESTDIR)$(LIBDIR)
120 ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenguest.so.$(MAJOR)
121 ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenguest.so
122 $(INSTALL_DATA) xenguest.h $(DESTDIR)$(INCLUDEDIR)
124 .PHONY: TAGS
125 TAGS:
126 etags -t *.c *.h
128 .PHONY: clean
129 clean:
130 rm -rf *.rpm $(LIB) *~ $(DEPS) \
131 $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \
132 $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS)
134 .PHONY: rpm
135 rpm: build
136 rm -rf staging
137 mkdir staging
138 mkdir staging/i386
139 rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
140 --define "_rpmdir$$PWD/staging" -bb rpm.spec
141 mv staging/i386/*.rpm .
142 rm -rf staging
144 # libxenctrl
146 libxenctrl.a: $(CTRL_LIB_OBJS)
147 $(AR) rc $@ $^
149 libxenctrl.so: libxenctrl.so.$(MAJOR)
150 ln -sf $< $@
151 libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
152 ln -sf $< $@
154 libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
155 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ $(LDLIBS)
157 # libxenguest
159 libxenguest.a: $(GUEST_LIB_OBJS)
160 $(AR) rc $@ $^
162 libxenguest.so: libxenguest.so.$(MAJOR)
163 ln -sf $< $@
164 libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
165 ln -sf $< $@
167 libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
168 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(LDLIBS)
170 -include $(DEPS)