ia64/xen-unstable

view extras/mini-os/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 80e177b12fd2
children edfd0c343b13
line source
1 # Common Makefile for mini-os.
2 #
3 # Every architecture directory below mini-os/arch has to have a
4 # Makefile and a arch.mk.
5 #
7 export XEN_ROOT = ../..
8 include $(XEN_ROOT)/Config.mk
10 ifneq ($(stubdom),y)
11 include Config.mk
12 endif
14 # Include common mini-os makerules.
15 include minios.mk
17 # Set tester flags
18 # CFLAGS += -DBLKTEST_WRITE
20 # Define some default flags for linking.
21 LDLIBS :=
22 LDARCHLIB := -L$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME)
23 LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(XEN_TARGET_ARCH).lds
25 # Prefix for global API names. All other symbols are localised before
26 # linking with EXTRA_OBJS.
27 GLOBAL_PREFIX := xenos_
28 EXTRA_OBJS =
30 TARGET := mini-os
32 # Subdirectories common to mini-os
33 SUBDIRS := lib xenbus console
35 # The common mini-os objects to build.
36 OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
37 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
38 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
39 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
42 .PHONY: default
43 default: $(TARGET)
45 # Create special architecture specific links. The function arch_links
46 # has to be defined in arch.mk (see include above).
47 ifneq ($(ARCH_LINKS),)
48 $(ARCH_LINKS):
49 $(arch_links)
50 endif
52 .PHONY: links
53 links: $(ARCH_LINKS)
54 [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
56 .PHONY: arch_lib
57 arch_lib:
58 $(MAKE) --directory=$(TARGET_ARCH_DIR) || exit 1;
60 ifeq ($(lwip),y)
61 # lwIP library
62 LWC := $(shell find $(LWIPDIR)/ -type f -name '*.c')
63 LWC := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
64 LWC += lwip-arch.c lwip-net.c
65 LWO := $(patsubst %.c,%.o,$(LWC))
67 lwip.a: $(LWO)
68 $(RM) $@
69 $(AR) cqs $@ $^
71 OBJS += lwip.a
72 endif
74 OBJS := $(filter-out lwip%.o $(LWO), $(OBJS))
76 ifeq ($(caml),y)
77 CAMLLIB = $(shell ocamlc -where)
78 OBJS += $(CAMLDIR)/caml.o
79 OBJS += $(CAMLLIB)/libasmrun.a
80 CFLAGS += -I$(CAMLLIB)
81 LDLIBS += -lm
82 else
83 OBJS := $(filter-out main-caml.o, $(OBJS))
84 endif
86 ifeq ($(qemu),y)
87 OBJS += $(QEMUDIR)/i386-dm-stubdom/qemu.a $(QEMUDIR)/i386-dm-stubdom/libqemu.a
88 CFLAGS += -DCONFIG_QEMU
89 endif
91 ifeq ($(libc),y)
92 LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -lxenctrl -lxenguest
93 LDLIBS += -lpci
94 LDLIBS += -lz
95 LDLIBS += -lc
96 endif
98 ifneq ($(caml)-$(qemu)-$(lwip),--y)
99 OBJS := $(filter-out daytime.o, $(OBJS))
100 endif
102 $(TARGET): links $(OBJS) arch_lib
103 $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
104 $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
105 $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
106 gzip -f -9 -c $@ >$@.gz
108 .PHONY: clean arch_clean
110 arch_clean:
111 $(MAKE) --directory=$(TARGET_ARCH_DIR) clean || exit 1;
113 clean: arch_clean
114 for dir in $(SUBDIRS); do \
115 rm -f $$dir/*.o; \
116 done
117 rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
118 find . -type l | xargs rm -f
119 $(RM) lwip.a $(LWO)
120 rm -f tags TAGS
123 define all_sources
124 ( find . -follow -name SCCS -prune -o -name '*.[chS]' -print )
125 endef
127 .PHONY: cscope
128 cscope:
129 $(all_sources) > cscope.files
130 cscope -k -b -q
132 .PHONY: tags
133 tags:
134 $(all_sources) | xargs ctags
136 .PHONY: TAGS
137 TAGS:
138 $(all_sources) | xargs etags