[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/7] Mini-OS: standalone build
In order to keep the tree bisectable all the changes are done in one single commit. Things done in this commit: 1. Import necessary .mk files from Xen. 2. Move all XEN_ related variables to MINIOS_ namespace. 3. Import Xen public header files. 4. Import BSD's list.h and helper script. Mini-OS's vanilla Config.mk is modified to contain some macros copied from Xen's Config.mk. It also contains compatibility handling logic for Xen's stubdom build environment. Files modified: Config.mk Makefile arch/x86/Makefile arch/x86/arch.mk minios.mk All other files are just imported from Xen. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- .gitignore | 1 - extras/mini-os/Config.mk | 50 +- extras/mini-os/Makefile | 16 +- extras/mini-os/arch/x86/Makefile | 5 +- extras/mini-os/arch/x86/arch.mk | 8 +- extras/mini-os/config/MiniOS.mk | 10 + extras/mini-os/config/StdGNU.mk | 47 + extras/mini-os/config/arm32.mk | 22 + extras/mini-os/config/arm64.mk | 19 + extras/mini-os/config/x86_32.mk | 20 + extras/mini-os/config/x86_64.mk | 33 + [ import output trimmed ] extras/mini-os/minios.mk | 4 +- 76 files changed, 16511 insertions(+), 23 deletions(-) [ import output trimmed ] diff --git a/.gitignore b/.gitignore index 13ee05b..cdbdca7 100644 --- a/.gitignore +++ b/.gitignore @@ -48,7 +48,6 @@ docs/pdf/ docs/txt/ extras/mini-os/include/mini-os extras/mini-os/include/x86/mini-os -extras/mini-os/include/xen extras/mini-os/include/list.h extras/mini-os/mini-os* install/* diff --git a/extras/mini-os/Config.mk b/extras/mini-os/Config.mk index 4852443..e5d8ade 100644 --- a/extras/mini-os/Config.mk +++ b/extras/mini-os/Config.mk @@ -1,7 +1,49 @@ -# Set mini-os root path, used in mini-os.mk. +# +# Compare $(1) and $(2) and replace $(2) with $(1) if they differ +# +# Typically $(1) is a newly generated file and $(2) is the target file +# being regenerated. This prevents changing the timestamp of $(2) only +# due to being auto regenereated with the same contents. +define move-if-changed + if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi +endef + +# cc-option: Check if compiler supports first option, else fall back to second. +# +# This is complicated by the fact that unrecognised -Wno-* options: +# (a) are ignored unless the compilation emits a warning; and +# (b) even then produce a warning rather than an error +# To handle this we do a test compile, passing the option-under-test, on a code +# fragment that will always produce a warning (integer assigned to pointer). +# We then grep for the option-under-test in the compiler's output, the presence +# of which would indicate an "unrecognized command-line option" warning/error. +# +# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586) +cc-option = $(shell if test -z "`echo 'void*p=1;' | \ + $(1) $(2) -S -o /dev/null -x c - 2>&1 | grep -- $(2) -`"; \ + then echo "$(2)"; else echo "$(3)"; fi ;) + +# Compatibility with Xen's stubdom build environment. If we are building +# stubdom, some XEN_ variables are set, set MINIOS_ variables accordingly. +# +ifneq ($(XEN_ROOT),) MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os +else +MINI-OS_ROOT=$(TOPLEVEL_DIR) +endif export MINI-OS_ROOT +ifneq ($(XEN_TARGET_ARCH),) +MINIOS_TARGET_ARCH = $(XEN_TARGET_ARCH) +else +MINIOS_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/) + +MINIOS_TARGET_ARCH ?= $(MINIOS_COMPILE_ARCH) +endif + libc = $(stubdom) XEN_INTERFACE_VERSION := 0x00030205 @@ -9,11 +51,11 @@ export XEN_INTERFACE_VERSION # 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 $(XEN_TARGET_ARCH) -ifeq ($(findstring x86_,$(XEN_TARGET_ARCH)),x86_) +# If not x86 then use $(MINIOS_TARGET_ARCH) +ifeq ($(findstring x86_,$(MINIOS_TARGET_ARCH)),x86_) TARGET_ARCH_FAM = x86 else -TARGET_ARCH_FAM = $(XEN_TARGET_ARCH) +TARGET_ARCH_FAM = $(MINIOS_TARGET_ARCH) endif # The architecture family directory below mini-os. diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile index 6d6537e..f16520e 100644 --- a/extras/mini-os/Makefile +++ b/extras/mini-os/Makefile @@ -4,9 +4,8 @@ # Makefile and a arch.mk. # -export XEN_ROOT = $(CURDIR)/../.. -include $(XEN_ROOT)/Config.mk -OBJ_DIR ?= $(CURDIR) +OBJ_DIR=$(CURDIR) +TOPLEVEL_DIR=$(CURDIR) ifeq ($(MINIOS_CONFIG),) include Config.mk @@ -15,6 +14,8 @@ EXTRA_DEPS += $(MINIOS_CONFIG) include $(MINIOS_CONFIG) endif +include $(MINI-OS_ROOT)/config/MiniOS.mk + # Configuration defaults CONFIG_START_NETWORK ?= y CONFIG_SPARSE_BSS ?= y @@ -51,7 +52,7 @@ flags-$(CONFIG_XENBUS) += -DCONFIG_XENBUS DEF_CFLAGS += $(flags-y) # Symlinks and headers that must be created before building the C files -GENERATED_HEADERS := include/list.h $(ARCH_LINKS) include/mini-os include/xen include/$(TARGET_ARCH_FAM)/mini-os +GENERATED_HEADERS := include/list.h $(ARCH_LINKS) include/mini-os include/$(TARGET_ARCH_FAM)/mini-os EXTRA_DEPS += $(GENERATED_HEADERS) @@ -65,7 +66,7 @@ include minios.mk LDLIBS := APP_LDLIBS := LDARCHLIB := -L$(OBJ_DIR)/$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME) -LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(XEN_TARGET_ARCH).lds +LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(MINIOS_TARGET_ARCH).lds # Prefix for global API names. All other symbols are localised before # linking with EXTRA_OBJS. @@ -125,7 +126,7 @@ $(ARCH_LINKS): $(arch_links) endif -include/list.h: $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue-h-seddery $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue.h +include/list.h: include/minios-external/bsd-sys-queue-h-seddery include/minios-external/bsd-sys-queue.h perl $^ --prefix=minios >$@.new $(call move-if-changed,$@.new,$@) @@ -133,9 +134,6 @@ include/list.h: $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue-h-seddery $ .PHONY: links links: $(GENERATED_HEADERS) -include/xen: - ln -sf ../../../xen/include/public $@ - include/mini-os: ln -sf . $@ diff --git a/extras/mini-os/arch/x86/Makefile b/extras/mini-os/arch/x86/Makefile index 1073e36..9f04a93 100644 --- a/extras/mini-os/arch/x86/Makefile +++ b/extras/mini-os/arch/x86/Makefile @@ -3,8 +3,7 @@ # It's is used for x86_32, x86_32y and x86_64 # -XEN_ROOT = $(CURDIR)/../../../.. -include $(XEN_ROOT)/Config.mk +TOPLEVEL_DIR = $(CURDIR)/../.. include ../../Config.mk # include arch.mk has to be before mini-os.mk! @@ -12,7 +11,7 @@ include ../../Config.mk include arch.mk include ../../minios.mk -# Sources here are all *.c *.S without $(XEN_TARGET_ARCH).S +# Sources here are all *.c *.S without $(MINIOS_TARGET_ARCH).S # This is handled in $(HEAD_ARCH_OBJ) ARCH_SRCS := $(wildcard *.c) diff --git a/extras/mini-os/arch/x86/arch.mk b/extras/mini-os/arch/x86/arch.mk index b27f322..81e8118 100644 --- a/extras/mini-os/arch/x86/arch.mk +++ b/extras/mini-os/arch/x86/arch.mk @@ -3,20 +3,20 @@ # (including x86_32, x86_32y and x86_64). # -ifeq ($(XEN_TARGET_ARCH),x86_32) +ifeq ($(MINIOS_TARGET_ARCH),x86_32) ARCH_CFLAGS := -m32 -march=i686 ARCH_LDFLAGS := -m elf_i386 ARCH_ASFLAGS := -m32 -EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH) +EXTRA_INC += $(TARGET_ARCH_FAM)/$(MINIOS_TARGET_ARCH) EXTRA_SRC += arch/$(EXTRA_INC) endif -ifeq ($(XEN_TARGET_ARCH),x86_64) +ifeq ($(MINIOS_TARGET_ARCH),x86_64) ARCH_CFLAGS := -m64 -mno-red-zone -fno-reorder-blocks ARCH_CFLAGS += -fno-asynchronous-unwind-tables ARCH_ASFLAGS := -m64 ARCH_LDFLAGS := -m elf_x86_64 -EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH) +EXTRA_INC += $(TARGET_ARCH_FAM)/$(MINIOS_TARGET_ARCH) EXTRA_SRC += arch/$(EXTRA_INC) endif [ import output trimmed ] diff --git a/extras/mini-os/minios.mk b/extras/mini-os/minios.mk index f42f48b..b0d9f71 100644 --- a/extras/mini-os/minios.mk +++ b/extras/mini-os/minios.mk @@ -56,12 +56,12 @@ override CPPFLAGS := $(CPPFLAGS) $(extra_incl) # The name of the architecture specific library. # This is on x86_32: libx86_32.a # $(ARCH_LIB) has to built in the architecture specific directory. -ARCH_LIB_NAME = $(XEN_TARGET_ARCH) +ARCH_LIB_NAME = $(MINIOS_TARGET_ARCH) ARCH_LIB := lib$(ARCH_LIB_NAME).a # This object contains the entrypoint for startup from Xen. # $(HEAD_ARCH_OBJ) has to be built in the architecture specific directory. -HEAD_ARCH_OBJ := $(XEN_TARGET_ARCH).o +HEAD_ARCH_OBJ := $(MINIOS_TARGET_ARCH).o HEAD_OBJ := $(OBJ_DIR)/$(TARGET_ARCH_DIR)/$(HEAD_ARCH_OBJ) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |