All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: talex5@gmail.com, stefano.stabellini@eu.citrix.com,
	anil@recoil.org, ian.jackson@eu.citrix.com,
	xen-devel@lists.xen.org, pooka@iki.fi,
	samuel.thibault@ens-lyon.org, dgdegra@tycho.nsa.gov
Subject: Re: [PATCH 5/7] Mini-OS: standalone build
Date: Mon, 2 Feb 2015 14:59:13 +0000	[thread overview]
Message-ID: <1422889153.4801.6.camel@citrix.com> (raw)
In-Reply-To: <1422881943-7687-6-git-send-email-wei.liu2@citrix.com>

On Mon, 2015-02-02 at 12:59 +0000, Wei Liu wrote:
> 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@citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>

I've not reviewed in depth, but:
Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
>  .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)
>  
> 

  reply	other threads:[~2015-02-02 14:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 12:58 [PATCH 0/7] Split off mini-os to a separate tree Wei Liu
2015-02-02 12:58 ` [PATCH 1/7] stubdom: fix "make build" Wei Liu
2015-02-02 14:53   ` Ian Campbell
2015-02-02 22:11   ` Samuel Thibault
2015-02-02 12:58 ` [PATCH 2/7] Makefile: refactor build/clean/distclean targets Wei Liu
2015-02-02 14:54   ` Ian Campbell
2015-02-02 12:58 ` [PATCH 3/7] stubdom: don't look for mini-os source file during configure Wei Liu
2015-02-02 15:09   ` Ian Jackson
2015-02-02 15:27     ` Wei Liu
2015-02-02 12:59 ` [PATCH 4/7] git-checkout.sh: use "mkdir -p" Wei Liu
2015-02-02 14:58   ` Ian Campbell
2015-02-02 15:02     ` Ian Jackson
2015-02-02 15:05       ` Andrew Cooper
2015-02-02 15:02     ` Wei Liu
2015-02-02 12:59 ` [PATCH 5/7] Mini-OS: standalone build Wei Liu
2015-02-02 14:59   ` Ian Campbell [this message]
2015-02-02 12:59 ` [PATCH 6/7] build system: stubdom targets now depends on mini-os target Wei Liu
2015-02-02 15:01   ` Ian Campbell
2015-02-02 15:03     ` Ian Campbell
2015-02-02 17:18       ` Wei Liu
2015-02-03 11:31         ` Ian Campbell
2015-02-02 15:12     ` Wei Liu
2015-02-02 15:15       ` Ian Jackson
2015-02-02 15:25         ` Wei Liu
2015-02-02 12:59 ` [PATCH 7/7] Remove in-tree mini-os directory Wei Liu
2015-02-02 15:02   ` Ian Campbell
2015-02-02 14:50 ` [PATCH 0/7] Split off mini-os to a separate tree Ian Campbell
2015-02-02 14:59   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422889153.4801.6.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=anil@recoil.org \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.jackson@eu.citrix.com \
    --cc=pooka@iki.fi \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=talex5@gmail.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.