diff --git a/Makefile b/Makefile index 5b6a28971..2fd013e8d 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,14 @@ TOOLS_OUT := $(ROOT_OUT)/misc/tools DOC_OUT := $(ROOT_OUT)/doc BUILD_VERSION ?= BUILD_TAG ?= +DEFAULT_MENU_CONFIG_FILE ?= $(T)/hypervisor/build/.config + +ifneq ($(BOARD_FILE),) + override BOARD_FILE := $(shell if [ -f $(BOARD_FILE) ]; then realpath $(BOARD_FILE); fi) +endif +ifneq ($(SCENARIO_FILE),) + override SCENARIO_FILE := $(shell if [ -f $(SCENARIO_FILE) ]; then realpath $(SCENARIO_FILE); fi) +endif export TOOLS_OUT BOARD SCENARIO FIRMWARE RELEASE @@ -29,13 +37,45 @@ export TOOLS_OUT BOARD SCENARIO FIRMWARE RELEASE all: hypervisor devicemodel tools ifeq ($(BOARD), apl-nuc) -override BOARD := nuc6cayh + override BOARD := nuc6cayh else ifeq ($(BOARD), kbl-nuc-i7) -override BOARD := nuc7i7dnb + override BOARD := nuc7i7dnb endif +#BOARD and SCENARIO definition priority: +# If we do menuconfig in advance, the menuconfig will define +# BOARD +# SCENARIO +# else if we have board/scenario file avaiable, BOARD and SCENARIO will be +# extracted from files. +# else if make comand has BORAD/SCENARIO parameters, BOARD and SCENARIO will +# be gotten from parameters +# else +# default value defined in this make file will be used +# + include $(T)/misc/acrn-config/library/cfg_update.mk +ifeq ($(DEFAULT_MENU_CONFIG_FILE), $(wildcard $(DEFAULT_MENU_CONFIG_FILE))) + BOARD_IN_MENUCONFIG := $(shell grep CONFIG_BOARD= $(DEFAULT_MENU_CONFIG_FILE) | awk -F '"' '{print $$2}') + SCENARIO_IN_MENUCONFIG := $(shell grep -E "SDC=y|SDC2=y|INDUSTRY=y|LOGICAL_PARTITION=y" \ + $(DEFAULT_MENU_CONFIG_FILE) | awk -F "_|=" '{print $$2}' | tr A-Z a-z) + + RELEASE := $(shell grep CONFIG_RELEASE=y $(DEFAULT_MENU_CONFIG_FILE)) + ifneq ($(RELEASE),) + override RELEASE := 1 + endif + + ifneq ($(BOARD_IN_MENUCONFIG),$(BOARD)) + override BOARD := $(BOARD_IN_MENUCONFIG) + endif + + ifneq ($(SCENARIO_IN_MENUCONFIG),$(SCENARIO)) + override SCENARIO := $(SCENARIO_IN_MENUCONFIG) + endif + +endif + #help functions to build acrn and install acrn/acrn symbols define build_acrn $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-$(1)/$(2) BOARD=$(2) FIRMWARE=$(1) SCENARIO=$(4) RELEASE=$(RELEASE) clean @@ -68,13 +108,19 @@ hypervisor: && [ "$(SCENARIO)" != "logical_partition" ] && [ "$(SCENARIO)" != "hybrid" ]; then \ echo "SCENARIO <$(SCENARIO)> is not supported. "; exit 1; \ fi - $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) clean - $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) defconfig - @if [ "$(CONFIG_XML_ENABLED)" = "true" ]; then \ - echo "CONFIG_$(shell echo $(SCENARIO_IN_XML) | tr a-z A-Z)=y" >> $(HV_OUT)/.config; \ - echo "CONFIG_ENFORCE_VALIDATED_ACPI_INFO=y" >> $(HV_OUT)/.config; \ - elif [ "$(SCENARIO)" ]; then \ - echo "CONFIG_$(shell echo $(SCENARIO) | tr a-z A-Z)=y" >> $(HV_OUT)/.config; \ + @if [ -f $(DEFAULT_MENU_CONFIG_FILE) ]; then \ + echo "Find existing menuconfig file: $(DEFAULT_MENU_CONFIG_FILE), import hypervisor configuration from it..."; \ + $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) clean; \ + mkdir -p $(HV_OUT) && cp $(DEFAULT_MENU_CONFIG_FILE) $(HV_OUT)/.config; \ + else \ + $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) clean; \ + $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) defconfig; \ + if [ "$(CONFIG_XML_ENABLED)" = "true" ]; then \ + echo "CONFIG_$(shell echo $(SCENARIO_IN_XML) | tr a-z A-Z)=y" >> $(HV_OUT)/.config; \ + echo "CONFIG_ENFORCE_VALIDATED_ACPI_INFO=y" >> $(HV_OUT)/.config; \ + elif [ "$(SCENARIO)" ]; then \ + echo "CONFIG_$(shell echo $(SCENARIO) | tr a-z A-Z)=y" >> $(HV_OUT)/.config; \ + fi \ fi $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) #ifeq ($(FIRMWARE),uefi) diff --git a/misc/acrn-config/kconfig/silentoldconfig.py b/misc/acrn-config/kconfig/silentoldconfig.py index 53541f2ed..eb7a7316b 100644 --- a/misc/acrn-config/kconfig/silentoldconfig.py +++ b/misc/acrn-config/kconfig/silentoldconfig.py @@ -97,7 +97,7 @@ def main(): need_update = True else: # report an error if no known defconfig exists - sys.stderr.write(".config does not exist and no defconfig available.\n") + sys.stderr.write(".config does not exist and no defconfig available for BOARD %s.\n" % os.environ['BOARD']) sys.exit(1) # Update the old .config with those specified on cmdline