[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [PATCH v3 19/19] mini-os: repair build system



Juergen Gross, on Thu 11 Aug 2016 11:18:22 +0200, wrote:
> The build system of Mini-OS is using different settings for arch/*/*
> than for the rest of the tree. The main reasons are that Config.mk is
> included only conditionally in the top level Makefile, while minios.mk
> isn't included by the arch Makefiles.
> 
> Repairing this mess enables us to move the CONFIG_* handling to
> Config.mk enabling the arch sources to make use of those even if no
> MINIOS_CONFIG was specified by the caller.
> 
> Most of the files under config were not used. Integrate the used ones
> into Config.mk and delete the rest.
> 
> The CONFIG_* defines should be set for assembler sources, too.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  Config.mk         | 93 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  Makefile          | 44 --------------------------
>  arch/x86/Makefile |  3 --
>  config/MiniOS.mk  | 10 ------
>  config/StdGNU.mk  | 47 ----------------------------
>  config/arm32.mk   | 22 -------------
>  config/arm64.mk   | 19 ------------
>  config/x86_32.mk  | 20 ------------
>  config/x86_64.mk  | 33 --------------------
>  minios.mk         |  4 +--
>  10 files changed, 95 insertions(+), 200 deletions(-)
>  delete mode 100644 config/MiniOS.mk
>  delete mode 100644 config/StdGNU.mk
>  delete mode 100644 config/arm32.mk
>  delete mode 100644 config/arm64.mk
>  delete mode 100644 config/x86_32.mk
>  delete mode 100644 config/x86_64.mk
> 
> diff --git a/Config.mk b/Config.mk
> index 9d19cd7..8ab1a7e 100644
> --- a/Config.mk
> +++ b/Config.mk
> @@ -23,6 +23,11 @@ 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 ;)
>  
> +ifneq ($(MINIOS_CONFIG),)
> +EXTRA_DEPS += $(MINIOS_CONFIG)
> +include $(MINIOS_CONFIG)
> +endif
> +
>  # Compatibility with Xen's stubdom build environment.  If we are building
>  # stubdom, some XEN_ variables are set, set MINIOS_ variables accordingly.
>  #
> @@ -97,3 +102,91 @@ DEF_CPPFLAGS += -DHAVE_LWIP
>  DEF_CPPFLAGS += -isystem $(LWIPDIR)/src/include
>  DEF_CPPFLAGS += -isystem $(LWIPDIR)/src/include/ipv4
>  endif
> +
> +# Set tools
> +AS         = $(CROSS_COMPILE)as
> +LD         = $(CROSS_COMPILE)ld
> +ifeq ($(clang),y)
> +CC         = $(CROSS_COMPILE)clang
> +LD_LTO     = $(CROSS_COMPILE)llvm-ld
> +else
> +CC         = $(CROSS_COMPILE)gcc
> +LD_LTO     = $(CROSS_COMPILE)ld
> +endif
> +CPP        = $(CC) -E
> +AR         = $(CROSS_COMPILE)ar
> +RANLIB     = $(CROSS_COMPILE)ranlib
> +NM         = $(CROSS_COMPILE)nm
> +STRIP      = $(CROSS_COMPILE)strip
> +OBJCOPY    = $(CROSS_COMPILE)objcopy
> +OBJDUMP    = $(CROSS_COMPILE)objdump
> +SIZEUTIL   = $(CROSS_COMPILE)size
> +
> +# Allow git to be wrappered in the environment
> +GIT        ?= git
> +
> +INSTALL      = install
> +INSTALL_DIR  = $(INSTALL) -d -m0755 -p
> +INSTALL_DATA = $(INSTALL) -m0644 -p
> +INSTALL_PROG = $(INSTALL) -m0755 -p
> +
> +BOOT_DIR ?= /boot
> +
> +SOCKET_LIBS =
> +UTIL_LIBS = -lutil
> +DLOPEN_LIBS = -ldl
> +
> +SONAME_LDFLAG = -soname
> +SHLIB_LDFLAGS = -shared
> +
> +ifneq ($(debug),y)
> +CFLAGS += -O2 -fomit-frame-pointer
> +else
> +# Less than -O1 produces bad code and large stack frames
> +CFLAGS += -O1 -fno-omit-frame-pointer
> +CFLAGS-$(gcc) += -fno-optimize-sibling-calls
> +endif
> +
> +ifeq ($(lto),y)
> +CFLAGS += -flto
> +LDFLAGS-$(clang) += -plugin LLVMgold.so
> +endif
> +
> +# Configuration defaults
> +CONFIG_START_NETWORK ?= y
> +CONFIG_SPARSE_BSS ?= y
> +CONFIG_QEMU_XS_ARGS ?= n
> +CONFIG_TEST ?= n
> +CONFIG_PCIFRONT ?= n
> +CONFIG_BLKFRONT ?= y
> +CONFIG_TPMFRONT ?= n
> +CONFIG_TPM_TIS ?= n
> +CONFIG_TPMBACK ?= n
> +CONFIG_NETFRONT ?= y
> +CONFIG_FBFRONT ?= y
> +CONFIG_KBDFRONT ?= y
> +CONFIG_CONSFRONT ?= y
> +CONFIG_XENBUS ?= y
> +CONFIG_XC ?=y
> +CONFIG_LWIP ?= $(lwip)
> +CONFIG_BALLOON ?= n
> +
> +# Export config items as compiler directives
> +DEFINES-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
> +DEFINES-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
> +DEFINES-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
> +DEFINES-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
> +DEFINES-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
> +DEFINES-$(CONFIG_TPMFRONT) += -DCONFIG_TPMFRONT
> +DEFINES-$(CONFIG_TPM_TIS) += -DCONFIG_TPM_TIS
> +DEFINES-$(CONFIG_TPMBACK) += -DCONFIG_TPMBACK
> +DEFINES-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
> +DEFINES-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
> +DEFINES-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
> +DEFINES-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
> +DEFINES-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
> +DEFINES-$(CONFIG_BALLOON) += -DCONFIG_BALLOON
> +
> +# Override settings for this OS
> +PTHREAD_LIBS =
> +nosharedlibs=y
> diff --git a/Makefile b/Makefile
> index f5b7011..5464e89 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -7,51 +7,7 @@
>  OBJ_DIR=$(CURDIR)
>  TOPLEVEL_DIR=$(CURDIR)
>  
> -ifeq ($(MINIOS_CONFIG),)
>  include Config.mk
> -else
> -EXTRA_DEPS += $(MINIOS_CONFIG)
> -include $(MINIOS_CONFIG)
> -endif
> -
> -include $(MINIOS_ROOT)/config/MiniOS.mk
> -
> -# Configuration defaults
> -CONFIG_START_NETWORK ?= y
> -CONFIG_SPARSE_BSS ?= y
> -CONFIG_QEMU_XS_ARGS ?= n
> -CONFIG_TEST ?= n
> -CONFIG_PCIFRONT ?= n
> -CONFIG_BLKFRONT ?= y
> -CONFIG_TPMFRONT ?= n
> -CONFIG_TPM_TIS ?= n
> -CONFIG_TPMBACK ?= n
> -CONFIG_NETFRONT ?= y
> -CONFIG_FBFRONT ?= y
> -CONFIG_KBDFRONT ?= y
> -CONFIG_CONSFRONT ?= y
> -CONFIG_XENBUS ?= y
> -CONFIG_XC ?=y
> -CONFIG_LWIP ?= $(lwip)
> -CONFIG_BALLOON ?= n
> -
> -# Export config items as compiler directives
> -flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
> -flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
> -flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
> -flags-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
> -flags-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
> -flags-$(CONFIG_TPMFRONT) += -DCONFIG_TPMFRONT
> -flags-$(CONFIG_TPM_TIS) += -DCONFIG_TPM_TIS
> -flags-$(CONFIG_TPMBACK) += -DCONFIG_TPMBACK
> -flags-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
> -flags-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
> -flags-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
> -flags-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
> -flags-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
> -flags-$(CONFIG_BALLOON) += -DCONFIG_BALLOON
> -
> -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/$(TARGET_ARCH_FAM)/mini-os
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index a46766c..0052b4c 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -6,9 +6,6 @@
>  TOPLEVEL_DIR = $(CURDIR)/../..
>  include ../../Config.mk
>  
> -# include arch.mk has to be before mini-os.mk!
> -
> -include arch.mk
>  include ../../minios.mk
>  
>  # Sources here are all *.c *.S without $(MINIOS_TARGET_ARCH).S
> diff --git a/config/MiniOS.mk b/config/MiniOS.mk
> deleted file mode 100644
> index be542dc..0000000
> --- a/config/MiniOS.mk
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -include $(MINIOS_ROOT)/config/StdGNU.mk
> -include $(MINIOS_ROOT)/Config.mk
> -CFLAGS += $(DEF_CFLAGS) $(ARCH_CFLAGS)
> -CPPFLAGS += $(DEF_CPPFLAGS) $(ARCH_CPPFLAGS) $(extra_incl)
> -ASFLAGS += $(DEF_ASFLAGS) $(ARCH_ASFLAGS)
> -LDFLAGS += $(DEF_LDFLAGS) $(ARCH_LDFLAGS)
> -
> -# Override settings for this OS
> -PTHREAD_LIBS =
> -nosharedlibs=y
> diff --git a/config/StdGNU.mk b/config/StdGNU.mk
> deleted file mode 100644
> index 4efebe3..0000000
> --- a/config/StdGNU.mk
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -AS         = $(CROSS_COMPILE)as
> -LD         = $(CROSS_COMPILE)ld
> -ifeq ($(clang),y)
> -CC         = $(CROSS_COMPILE)clang
> -LD_LTO     = $(CROSS_COMPILE)llvm-ld
> -else
> -CC         = $(CROSS_COMPILE)gcc
> -LD_LTO     = $(CROSS_COMPILE)ld
> -endif
> -CPP        = $(CC) -E
> -AR         = $(CROSS_COMPILE)ar
> -RANLIB     = $(CROSS_COMPILE)ranlib
> -NM         = $(CROSS_COMPILE)nm
> -STRIP      = $(CROSS_COMPILE)strip
> -OBJCOPY    = $(CROSS_COMPILE)objcopy
> -OBJDUMP    = $(CROSS_COMPILE)objdump
> -SIZEUTIL   = $(CROSS_COMPILE)size
> -
> -# Allow git to be wrappered in the environment
> -GIT        ?= git
> -
> -INSTALL      = install
> -INSTALL_DIR  = $(INSTALL) -d -m0755 -p
> -INSTALL_DATA = $(INSTALL) -m0644 -p
> -INSTALL_PROG = $(INSTALL) -m0755 -p
> -
> -BOOT_DIR ?= /boot
> -
> -SOCKET_LIBS =
> -UTIL_LIBS = -lutil
> -DLOPEN_LIBS = -ldl
> -
> -SONAME_LDFLAG = -soname
> -SHLIB_LDFLAGS = -shared
> -
> -ifneq ($(debug),y)
> -CFLAGS += -O2 -fomit-frame-pointer
> -else
> -# Less than -O1 produces bad code and large stack frames
> -CFLAGS += -O1 -fno-omit-frame-pointer
> -CFLAGS-$(gcc) += -fno-optimize-sibling-calls
> -endif
> -
> -ifeq ($(lto),y)
> -CFLAGS += -flto
> -LDFLAGS-$(clang) += -plugin LLVMgold.so
> -endif
> diff --git a/config/arm32.mk b/config/arm32.mk
> deleted file mode 100644
> index 4f83a63..0000000
> --- a/config/arm32.mk
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -CONFIG_ARM := y
> -CONFIG_ARM_32 := y
> -CONFIG_ARM_$(XEN_OS) := y
> -
> -CONFIG_XEN_INSTALL_SUFFIX :=
> -
> -# -march= -mcpu=
> -
> -# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
> -CFLAGS += -marm
> -
> -HAS_PL011 := y
> -HAS_EXYNOS4210 := y
> -HAS_OMAP := y
> -HAS_NS16550 := y
> -
> -# Use only if calling $(LD) directly.
> -LDFLAGS_DIRECT += -EL
> -
> -CONFIG_LOAD_ADDRESS ?= 0x80000000
> -
> -IOEMU_CPU_ARCH ?= arm
> diff --git a/config/arm64.mk b/config/arm64.mk
> deleted file mode 100644
> index 6eafda2..0000000
> --- a/config/arm64.mk
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -CONFIG_ARM := y
> -CONFIG_ARM_64 := y
> -CONFIG_ARM_$(XEN_OS) := y
> -
> -CONFIG_XEN_INSTALL_SUFFIX :=
> -
> -CFLAGS += #-marm -march= -mcpu= etc
> -
> -HAS_PL011 := y
> -HAS_NS16550 := y
> -
> -# Use only if calling $(LD) directly.
> -LDFLAGS_DIRECT += -EL
> -
> -CONFIG_LOAD_ADDRESS ?= 0x80000000
> -
> -IOEMU_CPU_ARCH ?= aarch64
> -
> -EFI_DIR ?= /usr/lib64/efi
> diff --git a/config/x86_32.mk b/config/x86_32.mk
> deleted file mode 100644
> index c2d785e..0000000
> --- a/config/x86_32.mk
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -CONFIG_X86 := y
> -CONFIG_X86_32 := y
> -CONFIG_X86_$(XEN_OS) := y
> -
> -CONFIG_HVM := y
> -CONFIG_MIGRATE := y
> -CONFIG_XCUTILS := y
> -
> -HAS_MEM_ACCESS := y
> -HAS_MEM_PAGING := y
> -HAS_MEM_SHARING := y
> -
> -CFLAGS += -m32 -march=i686
> -
> -# Use only if calling $(LD) directly.
> -LDFLAGS_DIRECT_OpenBSD = _obsd
> -LDFLAGS_DIRECT_FreeBSD = _fbsd
> -LDFLAGS_DIRECT += -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))
> -
> -IOEMU_CPU_ARCH ?= i386
> diff --git a/config/x86_64.mk b/config/x86_64.mk
> deleted file mode 100644
> index bf104c2..0000000
> --- a/config/x86_64.mk
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -CONFIG_X86 := y
> -CONFIG_X86_64 := y
> -CONFIG_X86_$(XEN_OS) := y
> -
> -CONFIG_COMPAT := y
> -CONFIG_HVM := y
> -CONFIG_MIGRATE := y
> -CONFIG_XCUTILS := y
> -
> -HAS_MEM_ACCESS := y
> -HAS_MEM_PAGING := y
> -HAS_MEM_SHARING := y
> -
> -CONFIG_XEN_INSTALL_SUFFIX := .gz
> -
> -CFLAGS += -m64
> -
> -SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
> -
> -EFI_DIR ?= /usr/lib64/efi
> -
> -# Use only if calling $(LD) directly.
> -ifeq ($(XEN_OS),OpenBSD)
> -LDFLAGS_DIRECT += -melf_x86_64_obsd
> -else
> -ifeq ($(XEN_OS),FreeBSD)
> -LDFLAGS_DIRECT += -melf_x86_64_fbsd
> -else
> -LDFLAGS_DIRECT += -melf_x86_64
> -endif
> -endif
> -
> -IOEMU_CPU_ARCH ?= x86_64
> diff --git a/minios.mk b/minios.mk
> index 89534f7..1d1cc99 100644
> --- a/minios.mk
> +++ b/minios.mk
> @@ -32,9 +32,9 @@ DEF_CFLAGS += -D__INSIDE_MINIOS__
>  # Build the CFLAGS and ASFLAGS for compiling and assembling.
>  # DEF_... flags are the common mini-os flags,
>  # ARCH_... flags may be defined in arch/$(TARGET_ARCH_FAM/rules.mk
> -CFLAGS := $(DEF_CFLAGS) $(ARCH_CFLAGS)
> +CFLAGS := $(DEF_CFLAGS) $(ARCH_CFLAGS) $(DEFINES-y)
>  CPPFLAGS := $(DEF_CPPFLAGS) $(ARCH_CPPFLAGS)
> -ASFLAGS := $(DEF_ASFLAGS) $(ARCH_ASFLAGS)
> +ASFLAGS := $(DEF_ASFLAGS) $(ARCH_ASFLAGS) $(DEFINES-y)
>  LDFLAGS := $(DEF_LDFLAGS) $(ARCH_LDFLAGS)
>  
>  # Special build dependencies.
> -- 
> 2.6.6
> 

-- 
Samuel
<s> on se croirait en cool : Some browsers close comments on the first ">" 
character, so to hide script content from such browsers, you can transpose 
operands for relational and shift operators (e.g., use "y < x" rather than "x > 
y") or use scripting language-dependent escapes for ">".
 -+- #ens-mim -+-

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.