aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-05-28 09:30:48 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-05-28 09:30:48 +0100
commitf9b4231a673d75dd6404ac5df8a47adc04437e6b (patch)
tree67d37f19b98706274ec6af9245082f25622341a8
parent4151cc56f19b3fe8aabde12ddf532cd9502c637d (diff)
downloadxen-f9b4231a673d75dd6404ac5df8a47adc04437e6b.tar.gz
xen-f9b4231a673d75dd6404ac5df8a47adc04437e6b.tar.bz2
xen-f9b4231a673d75dd6404ac5df8a47adc04437e6b.zip
stubdom: make the build more generic by moving as many stubdom parts
into stubdom/ as possible. That also permits to build all of ioemu, c and caml stubdoms at the same time. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
-rw-r--r--extras/mini-os/Config.mk8
-rw-r--r--extras/mini-os/Makefile33
-rw-r--r--extras/mini-os/main.c2
-rw-r--r--stubdom/Makefile31
-rw-r--r--stubdom/c/Makefile7
-rw-r--r--stubdom/c/main.c2
-rw-r--r--stubdom/caml/Makefile10
-rw-r--r--stubdom/caml/main-caml.c (renamed from extras/mini-os/main-caml.c)0
-rw-r--r--tools/ioemu/Makefile.target7
9 files changed, 48 insertions, 52 deletions
diff --git a/extras/mini-os/Config.mk b/extras/mini-os/Config.mk
index 15f7ed832c..96dd739ce7 100644
--- a/extras/mini-os/Config.mk
+++ b/extras/mini-os/Config.mk
@@ -55,11 +55,3 @@ DEF_CPPFLAGS += -DHAVE_LWIP
DEF_CPPFLAGS += -I$(LWIPDIR)/src/include
DEF_CPPFLAGS += -I$(LWIPDIR)/src/include/ipv4
endif
-
-ifneq ($(QEMUDIR),)
-qemu=y
-endif
-
-ifneq ($(CAMLDIR),)
-caml=y
-endif
diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile
index 8cec019e42..18497e1843 100644
--- a/extras/mini-os/Makefile
+++ b/extras/mini-os/Makefile
@@ -73,44 +73,25 @@ lwip.a: $(LWO)
OBJS += lwip.a
endif
-OBJS := $(filter-out lwip%.o $(LWO), $(OBJS))
-
-ifeq ($(caml),y)
-CAMLLIB = $(shell ocamlc -where)
-APP_OBJS += main-caml.o
-APP_OBJS += $(CAMLDIR)/caml.o
-APP_OBJS += $(CAMLLIB)/libasmrun.a
-CFLAGS += -I$(CAMLLIB)
-APP_LDLIBS += -lm
-endif
-OBJS := $(filter-out main-caml.o, $(OBJS))
-
-ifeq ($(qemu),y)
-APP_OBJS += $(QEMUDIR)/i386-dm-stubdom/qemu.a $(QEMUDIR)/i386-dm-stubdom/libqemu.a
-CFLAGS += -DCONFIG_QEMU
-endif
-
-ifneq ($(CDIR),)
-APP_OBJS += $(CDIR)/main.a
-APP_LDLIBS +=
-endif
+OBJS := $(filter-out main.o lwip%.o $(LWO), $(OBJS))
ifeq ($(libc),y)
APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -whole-archive -lxenguest -lxenctrl -no-whole-archive
APP_LDLIBS += -lpci
APP_LDLIBS += -lz
+APP_LDLIBS += -lm
LDLIBS += -lc
endif
-ifneq ($(caml)-$(qemu)-$(CDIR)-$(lwip),---y)
+ifneq ($(APP_OBJS)-$(lwip),-y)
OBJS := $(filter-out daytime.o, $(OBJS))
endif
-app.o: $(APP_OBJS) app.lds
- $(LD) -r -d $(LDFLAGS) $^ $(APP_LDLIBS) --undefined main -o $@
+$(TARGET)_app.o: $(APP_OBJS) app.lds
+ $(LD) -r -d $(LDFLAGS) $^ $(APP_LDLIBS) --undefined app_main -o $@
-$(TARGET): links $(OBJS) app.o arch_lib
- $(LD) -r $(LDFLAGS) $(HEAD_OBJ) app.o $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
+$(TARGET): links $(OBJS) $(TARGET)_app.o arch_lib
+ $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(TARGET)_app.o $(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
diff --git a/extras/mini-os/main.c b/extras/mini-os/main.c
index 1851469c3e..74904bbf1e 100644
--- a/extras/mini-os/main.c
+++ b/extras/mini-os/main.c
@@ -4,7 +4,6 @@
* Samuel Thibault <Samuel.Thibault@eu.citrix.net>, October 2007
*/
-#ifdef HAVE_LIBC
#include <os.h>
#include <sched.h>
#include <console.h>
@@ -180,4 +179,3 @@ int app_main(start_info_t *si)
main_thread = create_thread("main", call_main, si);
return 0;
}
-#endif
diff --git a/stubdom/Makefile b/stubdom/Makefile
index 67a76aedff..b907f1c54d 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -37,7 +37,7 @@ export CROSS_COMPILE=$(GNU_TARGET_ARCH)-xen-elf-
export PATH:=$(CROSS_PREFIX)/bin:$(PATH)
.PHONY: all
-all: qemu-stubdom
+all: ioemu-stubdom c-stubdom
################
# Cross-binutils
@@ -174,6 +174,7 @@ mk-symlinks:
([ ! -h config-host.h ] || rm -f config-host.h) && \
([ ! -h config-host.mak ] || rm -f config-host.mak) )
[ -h mini-os ] || ln -sf ../extras/mini-os .
+ [ -h mini-os/include/xen ] || ln -sf ../../../xen/include/public mini-os/include/xen
#######
# libxc
@@ -198,40 +199,41 @@ ioemu: cross-zlib cross-libpci mk-symlinks libxc
######
.PHONY: caml
-caml:
- $(MAKE) -C $@
+caml: mk-symlinks
+ $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs
###
# C
###
.PHONY: c
-c:
- $(MAKE) -C $@
+c: mk-symlinks
+ $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs
########
# minios
########
-.PHONY: qemu-stubdom
-qemu-stubdom: mk-symlinks lwip-cvs libxc ioemu
- $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs QEMUDIR=$(CURDIR)/ioemu
+.PHONY: ioemu-stubdom
+ioemu-stubdom: lwip-cvs libxc ioemu
+ $(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"
+CAMLLIB = $(shell ocamlc -where)
.PHONY: caml-stubdom
-caml-stubdom: mk-symlinks lwip-cvs libxc cross-libpci caml
- $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CAMLDIR=$(CURDIR)/caml
+caml-stubdom: lwip-cvs libxc caml
+ $(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"
.PHONY: c-stubdom
-c-stubdom: mk-symlinks lwip-cvs libxc cross-libpci c
- $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CDIR=$(CURDIR)/c
+c-stubdom: lwip-cvs libxc c
+ $(MAKE) -C mini-os TARGET=$@ LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS=$(CURDIR)/c/main.a
#########
# install
#########
-install: mini-os/mini-os.gz
+install: mini-os/ioemu-stubdom.gz
$(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin"
- $(INSTALL_PROG) mini-os/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/stubdom.gz"
+ $(INSTALL_PROG) $< "$(DESTDIR)/usr/lib/xen/boot/stubdom.gz"
#######
# clean
@@ -242,6 +244,7 @@ install: mini-os/mini-os.gz
clean:
-$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs clean
$(MAKE) -C caml clean
+ $(MAKE) -C c clean
rm -fr libxc ioemu mini-os include
# clean the cross-compilation result
diff --git a/stubdom/c/Makefile b/stubdom/c/Makefile
index 6262095b66..cd74490aef 100644
--- a/stubdom/c/Makefile
+++ b/stubdom/c/Makefile
@@ -2,7 +2,12 @@ XEN_ROOT = ../..
include $(XEN_ROOT)/Config.mk
-main.a: main.o
+all: main.a
+
+main-c.c:
+ ln -sf $(XEN_ROOT)/extras/mini-os/main.c $@
+
+main.a: main-c.o main.o
$(AR) cr $@ $^
clean:
diff --git a/stubdom/c/main.c b/stubdom/c/main.c
index 12288a6292..f97a0f72d4 100644
--- a/stubdom/c/main.c
+++ b/stubdom/c/main.c
@@ -1,4 +1,6 @@
#include <stdio.h>
+#include <unistd.h>
+
int main(void) {
sleep(2);
printf("Hello, world!\n");
diff --git a/stubdom/caml/Makefile b/stubdom/caml/Makefile
index 69595a8f99..8642240cef 100644
--- a/stubdom/caml/Makefile
+++ b/stubdom/caml/Makefile
@@ -2,12 +2,20 @@ XEN_ROOT = ../..
include $(XEN_ROOT)/Config.mk
+CAMLLIB = $(shell ocamlc -where)
+DEF_CPPFLAGS += -I$(CAMLLIB)
+
OCAMLFIND=ocamlfind
OCAMLOPT=ocamlopt
OBJS := hello.cmx
LIBS :=
+all: main-c.o main-caml.o caml.o
+
+main-c.c:
+ ln -sf $(XEN_ROOT)/extras/mini-os/main.c $@
+
%.cmx: %.ml
$(OCAMLFIND) $(OCAMLOPT) -c $< -o $@
@@ -15,4 +23,4 @@ caml.o: $(OBJS)
$(OCAMLFIND) $(OCAMLOPT) $(LIBS) $^ -output-obj -o $@
clean:
- rm -f *.o *.cmx *.cmi
+ rm -f *.a *.o *.cmx *.cmi
diff --git a/extras/mini-os/main-caml.c b/stubdom/caml/main-caml.c
index dd55aca38f..dd55aca38f 100644
--- a/extras/mini-os/main-caml.c
+++ b/stubdom/caml/main-caml.c
diff --git a/tools/ioemu/Makefile.target b/tools/ioemu/Makefile.target
index 8febcc44f5..85dcfe07d3 100644
--- a/tools/ioemu/Makefile.target
+++ b/tools/ioemu/Makefile.target
@@ -358,6 +358,13 @@ VL_OBJS+=tap-win32.o
endif
ifdef CONFIG_STUBDOM
+VL_OBJS+=main-qemu.o
+CFLAGS += -DCONFIG_QEMU
+main-qemu.c:
+ ln -s $(XEN_ROOT)/extras/mini-os/main.c $@
+endif
+
+ifdef CONFIG_STUBDOM
#CONFIG_PASSTHROUGH=1
else
ifeq (,$(wildcard /usr/include/pci))