diff --git a/cmd b/cmd index 5ec126e..6cee265 100755 --- a/cmd +++ b/cmd @@ -54,6 +54,7 @@ configure() { # invoke native code and byte code compiler targets compile() { # build bytecode files and C bindings always + make -C runtime/kernel libminios.a ${OCAMLBUILD} ${OCAMLBUILD_FLAGS} ${NAME}.all } diff --git a/xen/Makefile b/xen/Makefile index b1cec4c..0ecc17c 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -2,7 +2,7 @@ OCAML_VERSION=$(shell readlink runtime/ocaml) -EXTRA=runtime/dietlibc/libdiet.a runtime/libm/libm.a runtime/kernel/libxen.a runtime/kernel/libxencaml.a runtime/$(OCAML_VERSION)/libocaml.a runtime/kernel/x86_64.o runtime/kernel/longjmp.o runtime/kernel/mirage-x86_64.lds +EXTRA=runtime/dietlibc/libdiet.a runtime/libm/libm.a runtime/kernel/libminios.a runtime/$(OCAML_VERSION)/libocaml.a runtime/kernel/arch/x86/minios-x86_64.lds OCAMLFIND ?= ocamlfind diff --git a/xen/runtime/kernel/Config.mk b/xen/runtime/kernel/Config.mk index 4ecde54..6a66304 100644 --- a/xen/runtime/kernel/Config.mk +++ b/xen/runtime/kernel/Config.mk @@ -1,6 +1,13 @@ # Set mini-os root path, used in mini-os.mk. -MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os -export MINI-OS_ROOT + +OBJCOPY = $(CROSS_COMPILE)objcopy + +XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \ + -e s/i86pc/x86_32/ -e s/amd64/x86_64/ \ + -e s/armv7.*/arm32/ -e s/armv8.*/arm64/ \ + -e s/aarch64/arm64/) + +XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH) libc = $(stubdom) diff --git a/xen/runtime/kernel/Makefile b/xen/runtime/kernel/Makefile index 0f745ee..5ef70a8 100644 --- a/xen/runtime/kernel/Makefile +++ b/xen/runtime/kernel/Makefile @@ -4,8 +4,9 @@ # Makefile and a arch.mk. # -export XEN_ROOT = $(CURDIR)/../.. -include $(XEN_ROOT)/Config.mk +MINI-OS_ROOT=$(CURDIR) +export MINI-OS_ROOT + OBJ_DIR ?= $(CURDIR) ifeq ($(MINIOS_CONFIG),) @@ -140,14 +141,6 @@ $(ARCH_LINKS): $(arch_links) endif -include/mini-os/list.h: $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue-h-seddery $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue.h - perl $^ --prefix=minios >$@.new - $(call move-if-changed,$@.new,$@) - -.PHONY: links -links: include/mini-os/list.h $(ARCH_LINKS) - [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen - .PHONY: arch_lib arch_lib: $(MAKE) --directory=$(TARGET_ARCH_DIR) OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) || exit 1; @@ -202,6 +195,9 @@ else gzip -f -9 -c $@ >$@.gz endif +libminios.a: $(HEAD_OBJ) $(APP_O) $(OBJS) arch_lib + ar rcs $@ $(HEAD_OBJ) $(APP_O) $(OBJS) $(wildcard $(OBJ_DIR)/$(TARGET_ARCH_DIR)/*.o) + .PHONY: clean arch_clean arch_clean: @@ -211,9 +207,7 @@ clean: arch_clean for dir in $(addprefix $(OBJ_DIR)/,$(SUBDIRS)); do \ rm -f $$dir/*.o; \ done - rm -f include/mini-os/list.h rm -f $(OBJ_DIR)/*.o *~ $(OBJ_DIR)/core $(OBJ_DIR)/$(TARGET).elf $(OBJ_DIR)/$(TARGET).raw $(OBJ_DIR)/$(TARGET) $(OBJ_DIR)/$(TARGET).gz - find . $(OBJ_DIR) -type l | xargs rm -f $(RM) $(OBJ_DIR)/lwip.a $(LWO) rm -f tags TAGS diff --git a/xen/runtime/kernel/_tags b/xen/runtime/kernel/_tags new file mode 100644 index 0000000..7d877ab --- /dev/null +++ b/xen/runtime/kernel/_tags @@ -0,0 +1 @@ +true: not_hygienic diff --git a/xen/runtime/kernel/arch/x86/Makefile b/xen/runtime/kernel/arch/x86/Makefile index 1073e36..4b4a2b9 100644 --- a/xen/runtime/kernel/arch/x86/Makefile +++ b/xen/runtime/kernel/arch/x86/Makefile @@ -3,8 +3,9 @@ # It's is used for x86_32, x86_32y and x86_64 # -XEN_ROOT = $(CURDIR)/../../../.. -include $(XEN_ROOT)/Config.mk +MINI-OS_ROOT=$(CURDIR)/../.. +export MINI-OS_ROOT + include ../../Config.mk # include arch.mk has to be before mini-os.mk! diff --git a/xen/runtime/kernel/include/xen b/xen/runtime/kernel/include/xen new file mode 120000 index 0000000..1b23499 --- /dev/null +++ b/xen/runtime/kernel/include/xen @@ -0,0 +1 @@ +../../include/xen \ No newline at end of file