mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 22:18:17 +00:00
Makefile: remove rules related to Kconfig and TARGET_DIR
With Kconfig being removed from the configuration process and configuration files generated in build directories, we no longer need KCONFIG_FILE or TARGET_DIR in the top-level Makefile. This patch removes rules that infer BOARD/SCENARIO from Kconfig files or specify where generated configuration files are saved. A warning is generated if a user defines TARGET_DIR while the build can proceed normally. An error is raised if a user defines KCONFIG_FILE. v2: * BOARD/SCENARIO now accept paths relative to where Makefile resides in Tracked-On: #5644 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
775214b710
commit
329296f095
125
Makefile
125
Makefile
@ -6,39 +6,26 @@ SHELL := /bin/bash
|
|||||||
# global helper variables
|
# global helper variables
|
||||||
T := $(CURDIR)
|
T := $(CURDIR)
|
||||||
|
|
||||||
TARGET_DIR ?=
|
ifdef TARGET_DIR
|
||||||
|
$(warning TARGET_DIR is obsoleted because generated configuration files are now stored in the build directory)
|
||||||
|
endif
|
||||||
|
|
||||||
# BOARD/SCENARIO/BOARD_FILE/SCENARIO_FILE/KCONFIG_FILE parameters sanity check:
|
ifdef KCONFIG_FILE
|
||||||
|
$(warning KCONFIG_FILE is no longer supported)
|
||||||
|
$(error To specify the target board and scenario, define BOARD/SCENARIO variables on the command line)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# BOARD/SCENARIO/BOARD_FILE/SCENARIO_FILE parameters sanity check:
|
||||||
#
|
#
|
||||||
# Only below usages are VALID: (target = all | hypervisor)
|
# Only below usages are VALID: (target = all | hypervisor)
|
||||||
# 1. make <target>
|
# 1. make <target>
|
||||||
# 2. make <target> KCONFIG_FILE=xxx [TARGET_DIR=xxx]
|
# 2. make <target> BOARD=xxx SCENARIO=xxx
|
||||||
# 3. make <target> BOARD=xxx SCENARIO=xxx [TARGET_DIR=xxx]
|
# 3. make <target> BOARD_FILE=xxx SCENARIO_FILE=xxx
|
||||||
# 4. make <target> BOARD_FILE=xxx SCENARIO_FILE=xxx [TARGET_DIR=xxx]
|
|
||||||
#
|
#
|
||||||
# Especially for case 1 that no any parameters are specified:
|
# For case 1 that no any parameters are specified, the default BOARD/SCENARIO will be loaded:
|
||||||
# a. If hypervisor/build/.config file which generated by "make menuconfig" exist,
|
# i.e. equal: make <target> BOARD=kbl-nuc-i7 SCENARIO=industry
|
||||||
# the .config file will be loaded as KCONFIG_FILE:
|
|
||||||
# i.e. equal: make <target> KCONFIG_FILE=hypervisor/build/.config
|
|
||||||
#
|
#
|
||||||
# b. If hypervisor/build/.config file does not exist,
|
# For case 2/3, configurations are from XML files and saved to HV_OUT
|
||||||
# the default BOARD/SCENARIO will be loaded:
|
|
||||||
# i.e. equal: make <target> BOARD=$(BOARD) SCENARIO=$(SCENARIO)
|
|
||||||
#
|
|
||||||
# For case 2/3, configurations are imported from TARGET_DIR when TARGET_DIR is specified;
|
|
||||||
# For case 4, configurations are from XML files and saved to TARGET_DIR if it is specified;
|
|
||||||
#
|
|
||||||
# The grep process did not handle corner case when '#' is manually put right after config value as comments,
|
|
||||||
# i.e. it will be failed in the case of "CONFIG_XXX=y # some comments here "
|
|
||||||
|
|
||||||
ifneq ($(KCONFIG_FILE),)
|
|
||||||
ifneq ($(KCONFIG_FILE), $(wildcard $(KCONFIG_FILE)))
|
|
||||||
$(error KCONFIG_FILE: $(KCONFIG_FILE) does not exist)
|
|
||||||
endif
|
|
||||||
override KCONFIG_FILE := $(realpath $(KCONFIG_FILE))
|
|
||||||
else
|
|
||||||
override KCONFIG_FILE := $(T)/hypervisor/build/.config
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(BOARD)$(SCENARIO),)
|
ifneq ($(BOARD)$(SCENARIO),)
|
||||||
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
||||||
@ -46,17 +33,6 @@ ifneq ($(BOARD)$(SCENARIO),)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(TARGET_DIR),)
|
|
||||||
CFG_DIR := $(realpath $(TARGET_DIR))
|
|
||||||
ifeq ($(CFG_DIR),)
|
|
||||||
ifeq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
|
||||||
$(error TARGET_DIR $(TARGET_DIR) does not exist)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
override TARGET_DIR := $(abspath $(TARGET_DIR))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
||||||
ifneq ($(BOARD_FILE), $(wildcard $(BOARD_FILE)))
|
ifneq ($(BOARD_FILE), $(wildcard $(BOARD_FILE)))
|
||||||
$(error BOARD_FILE: $(BOARD_FILE) does not exist)
|
$(error BOARD_FILE: $(BOARD_FILE) does not exist)
|
||||||
@ -65,37 +41,17 @@ ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
|||||||
$(error SCENARIO_FILE: $(SCENARIO_FILE) does not exist)
|
$(error SCENARIO_FILE: $(SCENARIO_FILE) does not exist)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
override BOARD_FILE := $(realpath $(BOARD_FILE))
|
override BOARD := $(realpath $(BOARD_FILE))
|
||||||
override SCENARIO_FILE := $(realpath $(SCENARIO_FILE))
|
override SCENARIO := $(realpath $(SCENARIO_FILE))
|
||||||
endif
|
else
|
||||||
|
# BOARD/SCENARIO pointing to XML files must be converted to absolute paths before being passed to hypervisor/Makefile
|
||||||
ifeq ($(KCONFIG_FILE), $(wildcard $(KCONFIG_FILE)))
|
# because paths relative to acrn-hypervisor/ are typically invalid when relative to acrn-hypervisor/Makefile
|
||||||
ifneq ($(BOARD)$(SCENARIO),)
|
ifneq ($(realpath $(BOARD)),)
|
||||||
$(error BOARD/SCENARIO parameter could not coexist with Kconfig file: $(KCONFIG_FILE))
|
override BOARD := $(realpath $(BOARD))
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(realpath $(SCENARIO)),)
|
||||||
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
override SCENARIO := $(realpath $(SCENARIO))
|
||||||
$(error BOARD_FILE/SCENARIO_FILE parameter could not coexist with Kconfig file: $(KCONFIG_FILE))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BOARD_IN_KCONFIG := $(shell grep CONFIG_BOARD= $(KCONFIG_FILE) | grep -v '\#' | awk -F '"' '{print $$2}')
|
|
||||||
ifeq ($(BOARD_IN_KCONFIG),)
|
|
||||||
$(error no BOARD info in KCONFIG_FILE: $(KCONFIG_FILE))
|
|
||||||
endif
|
|
||||||
|
|
||||||
SCENARIO_IN_KCONFIG := $(shell grep CONFIG_SCENARIO= $(KCONFIG_FILE) | grep -v '\#' | awk -F '"' '{print $$2}')
|
|
||||||
ifeq ($(SCENARIO_IN_KCONFIG),)
|
|
||||||
$(error no SCENARIO info in KCONFIG_FILE: $(KCONFIG_FILE))
|
|
||||||
endif
|
|
||||||
|
|
||||||
override BOARD := $(BOARD_IN_KCONFIG)
|
|
||||||
override SCENARIO := $(SCENARIO_IN_KCONFIG)
|
|
||||||
|
|
||||||
RELEASE := $(shell grep CONFIG_RELEASE=y $(KCONFIG_FILE) | grep -v '\#')
|
|
||||||
ifneq ($(RELEASE),)
|
|
||||||
override RELEASE := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BOARD ?= kbl-nuc-i7
|
BOARD ?= kbl-nuc-i7
|
||||||
@ -118,7 +74,6 @@ BUILD_VERSION ?=
|
|||||||
BUILD_TAG ?=
|
BUILD_TAG ?=
|
||||||
HV_CFG_LOG = $(HV_OUT)/cfg.log
|
HV_CFG_LOG = $(HV_OUT)/cfg.log
|
||||||
VM_CONFIGS_DIR = $(T)/misc/vm_configs
|
VM_CONFIGS_DIR = $(T)/misc/vm_configs
|
||||||
DEFCONFIG_FILE = scenarios/$(SCENARIO)/$(BOARD)/$(BOARD).config
|
|
||||||
|
|
||||||
export TOOLS_OUT BOARD SCENARIO RELEASE
|
export TOOLS_OUT BOARD SCENARIO RELEASE
|
||||||
|
|
||||||
@ -126,13 +81,9 @@ export TOOLS_OUT BOARD SCENARIO RELEASE
|
|||||||
all: hypervisor devicemodel tools
|
all: hypervisor devicemodel tools
|
||||||
@cat $(HV_CFG_LOG)
|
@cat $(HV_CFG_LOG)
|
||||||
|
|
||||||
include $(T)/hypervisor/scripts/makefile/cfg_update.mk
|
|
||||||
|
|
||||||
#help functions to build acrn and install acrn/acrn symbols
|
#help functions to build acrn and install acrn/acrn symbols
|
||||||
define build_acrn
|
define build_acrn
|
||||||
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE) clean
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) clean
|
||||||
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE) defconfig
|
|
||||||
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE) oldconfig
|
|
||||||
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE)
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -145,35 +96,12 @@ define install_acrn_debug
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
hypervisor:
|
hypervisor:
|
||||||
@if [ "$(BOARD_FILE)" != "" ] && [ -f $(BOARD_FILE) ] && [ "$(SCENARIO_FILE)" != "" ] && [ -f $(SCENARIO_FILE) ] && [ "$(TARGET_DIR)" = "" ]; then \
|
$(MAKE) -C $(T)/hypervisor BOARD=$(BOARD) SCENARIO=$(SCENARIO) HV_OBJDIR=$(HV_OUT) RELEASE=$(RELEASE)
|
||||||
echo "No TARGET_DIR parameter is specified, the original configuration source is overwritten!";\
|
|
||||||
fi
|
|
||||||
$(MAKE) -C $(T)/hypervisor BOARD=$(BOARD) HV_OBJDIR=$(HV_OUT) BOARD_FILE=$(BOARD_FILE) SCENARIO_FILE=$(SCENARIO_FILE) TARGET_DIR=$(TARGET_DIR) defconfig;
|
|
||||||
$(MAKE) -C $(T)/hypervisor BOARD=$(BOARD) HV_OBJDIR=$(HV_OUT) BOARD_FILE=$(BOARD_FILE) SCENARIO_FILE=$(SCENARIO_FILE) TARGET_DIR=$(TARGET_DIR) oldconfig;
|
|
||||||
$(MAKE) -C $(T)/hypervisor BOARD=$(BOARD) HV_OBJDIR=$(HV_OUT) BOARD_FILE=$(BOARD_FILE) SCENARIO_FILE=$(SCENARIO_FILE) TARGET_DIR=$(TARGET_DIR)
|
|
||||||
@echo -e "\n\033[47;30mACRN Configuration Summary:\033[0m \nBOARD = $(BOARD)\t SCENARIO = $(SCENARIO)" > $(HV_CFG_LOG); \
|
@echo -e "\n\033[47;30mACRN Configuration Summary:\033[0m \nBOARD = $(BOARD)\t SCENARIO = $(SCENARIO)" > $(HV_CFG_LOG); \
|
||||||
echo -e "BUILD type = \c" >> $(HV_CFG_LOG); \
|
echo -e "BUILD type = \c" >> $(HV_CFG_LOG); \
|
||||||
if [ "$(RELEASE)" = "0" ]; then echo -e "DEBUG" >> $(HV_CFG_LOG); else echo -e "RELEASE" >> $(HV_CFG_LOG); fi; \
|
if [ "$(RELEASE)" = "0" ]; then echo -e "DEBUG" >> $(HV_CFG_LOG); else echo -e "RELEASE" >> $(HV_CFG_LOG); fi; \
|
||||||
if [ -f $(KCONFIG_FILE) ]; then \
|
|
||||||
echo -e "Hypervisor configuration is based on:\n\tKconfig file:\t$(KCONFIG_FILE);" >> $(HV_CFG_LOG); \
|
|
||||||
fi; \
|
|
||||||
echo -e "Hypervisor configuration is based on:" >> $(HV_CFG_LOG); \
|
|
||||||
if [ "$(TARGET_DIR)" = "" ]; then \
|
|
||||||
if [ ! -f $(KCONFIG_FILE) ]; then \
|
|
||||||
echo -e "\tdefconfig file:\t\t\t$(VM_CONFIGS_DIR)/$(DEFCONFIG_FILE);" >> $(HV_CFG_LOG); \
|
|
||||||
fi; \
|
|
||||||
elif [ ! -f $(KCONFIG_FILE) ]; then \
|
|
||||||
echo -e "\tdefconfig file:\t\t\t$(TARGET_DIR)/$(DEFCONFIG_FILE);" >> $(HV_CFG_LOG); \
|
|
||||||
fi; \
|
|
||||||
echo -e "\tOthers are set by default in:\t$(T)/hypervisor/arch/x86/Kconfig;" >> $(HV_CFG_LOG); \
|
|
||||||
echo -e "VM configuration is based on:" >> $(HV_CFG_LOG); \
|
echo -e "VM configuration is based on:" >> $(HV_CFG_LOG); \
|
||||||
if [ "$(CONFIG_XML_ENABLED)" = "true" ]; then \
|
echo -e "\tSource code at:\t\t\t$(HV_OUT)/configs" >> $(HV_CFG_LOG);
|
||||||
echo -e "\tBOARD File:\t\t$(BOARD_FILE);\n\t\tSCENARIO File:\t$(SCENARIO_FILE);" >> $(HV_CFG_LOG); \
|
|
||||||
elif [ "$(TARGET_DIR)" = "" ]; then \
|
|
||||||
echo -e "\tSource code at:\t\t\t$(VM_CONFIGS_DIR)" >> $(HV_CFG_LOG); \
|
|
||||||
else \
|
|
||||||
echo -e "\tSource code at:\t\t\t$(TARGET_DIR)" >> $(HV_CFG_LOG); \
|
|
||||||
fi;
|
|
||||||
@cat $(HV_CFG_LOG)
|
@cat $(HV_CFG_LOG)
|
||||||
|
|
||||||
devicemodel: tools
|
devicemodel: tools
|
||||||
@ -191,7 +119,6 @@ clean:
|
|||||||
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) clean
|
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) clean
|
||||||
$(MAKE) -C $(T)/doc BUILDDIR=$(DOC_OUT) clean
|
$(MAKE) -C $(T)/doc BUILDDIR=$(DOC_OUT) clean
|
||||||
rm -rf $(ROOT_OUT)
|
rm -rf $(ROOT_OUT)
|
||||||
rm -rf $(TARGET_DIR)
|
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: hypervisor-install devicemodel-install tools-install
|
install: hypervisor-install devicemodel-install tools-install
|
||||||
|
Loading…
Reference in New Issue
Block a user