HV: make: manage debug/release build in kconfig

This patch introduces a configuration symbol RELEASE for managing debug/release
build in a similar way to how we manage PLATFORM.

Note:

1. 'make defconfig RELEASE=1' will still use the CONFIG_RELEASE defined in the
   default configuration. The 'RELEASE=1' option has no effect in this case.

2. 'make RELEASE=1' is backward-compatible and enforces a release version to be
   built.

v1 -> v2:

    * Pass RELEASE instead of CONFIG_RELEASE to silentoldconfig.py to avoid
      unintended overriding of the value.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Geoffroy VanCutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
Junjie Mao 2018-06-10 14:50:58 +08:00 committed by Jack Ren
parent c4493cc1f8
commit 8009cccb52
4 changed files with 20 additions and 8 deletions

View File

@ -9,8 +9,6 @@ RC_VERSION=5
API_MAJOR_VERSION=1
API_MINOR_VERSION=0
RELEASE ?= 0
GCC_MAJOR=$(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1)
GCC_MINOR=$(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
@ -172,7 +170,7 @@ endif
endif
C_OBJS := $(patsubst %.c,$(HV_OBJDIR)/%.o,$(C_SRCS))
ifeq ($(RELEASE),0)
ifeq ($(CONFIG_RELEASE),n)
C_OBJS += $(patsubst %.c,$(HV_OBJDIR)/%.o,$(D_SRCS))
CFLAGS += -DHV_DEBUG
endif
@ -190,10 +188,10 @@ all: efi
.PHONY: efi
efi: $(HV_OBJDIR)/$(HV_FILE).bin
echo "building hypervisor as EFI executable..."
make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR) RELEASE=$(RELEASE)
make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR)
install: efi
make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR) RELEASE=$(RELEASE) install
make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR) install
endif
ifeq ($(CONFIG_PLATFORM), sbl)
@ -234,7 +232,7 @@ $(VERSION):
DIRTY=`git diff-index --name-only HEAD`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
TIME=`date "+%F %T"`;\
if [ $(RELEASE) = 0 ];then BUILD_TYPE="DBG";else BUILD_TYPE="REL";fi;\
if [ $(CONFIG_RELEASE) = "n" ];then BUILD_TYPE="DBG";else BUILD_TYPE="REL";fi;\
echo "/*" > $(VERSION); \
sed 's/^/ * /' ../LICENSE >> $(VERSION); \
echo " */" >> $(VERSION); \

View File

@ -16,6 +16,10 @@ config PLATFORM
default "uefi" if PLATFORM_UEFI
default "sbl" if PLATFORM_SBL
config RELEASE
bool "Release build"
default n
config NR_IOAPICS
int "Maximum number of IOAPICs supported"
default 1

View File

@ -30,7 +30,6 @@
# POSSIBILITY OF SUCH DAMAGE.
#
RELEASE:=0
HV_OBJDIR:=build
HV_FILE:=acrn
EFI_OBJDIR:=$(HV_OBJDIR)/bsp/uefi/efi

View File

@ -20,8 +20,18 @@ HV_CONFIG_MK := include/config.mk
KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig
# Backward-compatibility for RELEASE=(0|1)
ifdef RELEASE
ifeq ($(RELEASE),1)
override RELEASE := y
else
override RELEASE := n
endif
endif
-include $(HV_OBJDIR)/$(HV_CONFIG_MK)
$(eval $(call override_config,PLATFORM,sbl))
$(eval $(call override_config,RELEASE,n))
$(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
$(eval $(call check_dep_exec,pip3,KCONFIG_DEPS))
@ -62,7 +72,8 @@ oldconfig: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR)
@python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig \
$(HV_OBJDIR)/$(HV_CONFIG) \
PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y
PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y \
RELEASE=$(RELEASE)
# Minimize the current .config. This target can be used to generate a defconfig
# for future use.