From 0243b256d6187ea610174531607366945e489605 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 12 Feb 2008 14:35:39 +0000 Subject: 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 --- extras/mini-os/Makefile | 81 +++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 50 deletions(-) (limited to 'extras/mini-os/Makefile') diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile index a008143cf0..4811f0dbfd 100644 --- a/extras/mini-os/Makefile +++ b/extras/mini-os/Makefile @@ -4,54 +4,11 @@ # Makefile and a arch.mk. # -XEN_ROOT = ../.. +export XEN_ROOT = ../.. include $(XEN_ROOT)/Config.mk -XEN_INTERFACE_VERSION := 0x00030205 -export XEN_INTERFACE_VERSION - -# Set TARGET_ARCH -override TARGET_ARCH := $(XEN_TARGET_ARCH) - -# Set mini-os root path, used in mini-os.mk. -MINI-OS_ROOT=$(PWD) -export MINI-OS_ROOT - -# Try to find out the architecture family TARGET_ARCH_FAM. -# First check whether x86_... is contained (for x86_32, x86_32y, x86_64). -# If not x86 then use $(TARGET_ARCH) -> for ia64, ... -ifeq ($(findstring x86_,$(TARGET_ARCH)),x86_) -TARGET_ARCH_FAM = x86 -else -TARGET_ARCH_FAM = $(TARGET_ARCH) -endif - -# The architecture family directory below mini-os. -TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FAM) - -# Export these variables for possible use in architecture dependent makefiles. -export TARGET_ARCH -export TARGET_ARCH_DIR -export TARGET_ARCH_FAM -export XEN_TARGET_X86_PAE - -# This is used for architecture specific links. -# This can be overwritten from arch specific rules. -ARCH_LINKS = - -# For possible special header directories. -# This can be overwritten from arch specific rules. -EXTRA_INC = - -# Include the architecture family's special makerules. -# This must be before include minios.mk! -include $(TARGET_ARCH_DIR)/arch.mk - -ifneq ($(LWIPDIR),) -lwip=y -DEF_CFLAGS += -DHAVE_LWIP -DEF_CFLAGS += -I$(LWIPDIR)/src/include -DEF_CFLAGS += -I$(LWIPDIR)/src/include/ipv4 +ifneq ($(stubdom),y) +include Config.mk endif # Include common mini-os makerules. @@ -63,7 +20,7 @@ include minios.mk # Define some default flags for linking. LDLIBS := LDARCHLIB := -L$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME) -LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(TARGET_ARCH).lds +LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(XEN_TARGET_ARCH).lds # Prefix for global API names. All other symbols are localised before # linking with EXTRA_OBJS. @@ -112,14 +69,38 @@ lwip.a: $(LWO) $(AR) cqs $@ $^ OBJS += lwip.a +endif + +OBJS := $(filter-out lwip%.o $(LWO), $(OBJS)) -OBJS := $(filter-out $(LWO), $(OBJS)) +ifeq ($(caml),y) +CAMLLIB = $(shell ocamlc -where) +OBJS += $(CAMLDIR)/caml.o +OBJS += $(CAMLLIB)/libasmrun.a +CFLAGS += -I$(CAMLLIB) +LDLIBS += -lm else -OBJS := $(filter-out daytime.o lwip%.o, $(OBJS)) +OBJS := $(filter-out main-caml.o, $(OBJS)) +endif + +ifeq ($(qemu),y) +OBJS += $(QEMUDIR)/i386-dm-stubdom/qemu.a $(QEMUDIR)/i386-dm-stubdom/libqemu.a +CFLAGS += -DCONFIG_QEMU +endif + +ifeq ($(libc),y) +LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -lxenctrl -lxenguest +LDLIBS += -lpci +LDLIBS += -lz +LDLIBS += -lc +endif + +ifneq ($(caml)-$(qemu)-$(lwip),--y) +OBJS := $(filter-out daytime.o, $(OBJS)) endif $(TARGET): links $(OBJS) arch_lib - $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) -o $@.o + $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@ gzip -f -9 -c $@ >$@.gz -- cgit v1.2.3