mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-10-01 14:28:59 +00:00
Customer might have specific folder where stores their own configurations for their customized scenario/board, so add TARGET_DIR parameter to support option that build hyprvisor with specified configurations. So valid usages are: (target = all | hypervisor) 1. make <target> 2. make <target> KCONFIG_FILE=xxx [TARGET_DIR=xxx] 3. make <target> BOARD=xxx SCENARIO=xxx [TARGET_DIR=xxx] 4. make <target> BOARD_FILE=xxx SCENARIO_FILE=xxx [TARGET_DIR=xxx] 5. make <target> KCONFIG_FILE=xxx BOARD_FILE=xxx SCENARIO_FILE=xxx [TARGET_DIR=xxx] If TARGET_DIR parameter is not specified in make command, hypervisor will be built with board configurations under hypervisor/arch/x86/configs/ and scenario configurations under hypervisor/scenarios/. Moreover, the configurations would be overwritten if BOARD/SCENARIO files are specified in make command. If TARGET_DIR parameter is specified in make command, hypervisor will be built with configuration under that folder if no BOARD/SCENARIO files are specified. When BOARD/SCENARIO files are available in make command, the TARGET_DIR is used to store configurations that BOARD/SCENARIO file provided, i.e. Configurations in TARGET_DIR folder will be overwritten. Tracked-On: #4517 Signed-off-by: Victor Sun <victor.sun@intel.com>
66 lines
2.8 KiB
Makefile
66 lines
2.8 KiB
Makefile
CONFIG_XML_ENABLED ?=
|
|
UPDATE_RESULT = $(HV_OBJDIR)/.cfg_src_result
|
|
|
|
define check_xml_enabled =
|
|
CONFIG_XML_ENABLED := $(shell if [ "$(1)" != "" ] || [ "$(2)" != "" ]; then echo false; fi)
|
|
BOARD_IN_XML := $(shell echo `if [ "$(1)" != "" ]; then sed -n '/<acrn-config/p' $(1) | sed -r 's/.*board="(.*)".*/\1/g'; fi`)
|
|
SCENARIO_IN_XML := $(shell echo `if [ "$(2)" != "" ]; then sed -n '/<acrn-config/p' $(2) | sed -r 's/.*scenario="(.*)".*/\1/g'; fi`)
|
|
|
|
ifneq ($$(BOARD_IN_XML),)
|
|
ifneq ($$(SCENARIO_IN_XML),)
|
|
CONFIG_XML_ENABLED := true
|
|
endif
|
|
endif
|
|
|
|
endef
|
|
|
|
ifeq ($(CONFIG_XML_ENABLED),)
|
|
$(eval $(call check_xml_enabled,$(BOARD_FILE),$(SCENARIO_FILE)))
|
|
endif
|
|
|
|
ifeq ($(CONFIG_XML_ENABLED),true)
|
|
ifneq ($(BOARD_IN_KCONFIG),)
|
|
ifneq ($(BOARD_IN_XML),$(BOARD_IN_KCONFIG))
|
|
$(error BOARD $(BOARD_IN_XML) in $(BOARD_FILE) does not match BOARD $(BOARD_IN_KCONFIG) in $(KCONFIG_FILE))
|
|
endif
|
|
endif
|
|
ifneq ($(SCENARIO_IN_KCONFIG),)
|
|
ifneq ($(SCENARIO_IN_XML),$(SCENARIO_IN_KCONFIG))
|
|
$(error SCENARIO $(SCENARIO_IN_XML) in $(SCENARIO_FILE) does not match SCENARIO $(SCENARIO_IN_KCONFIG) in $(KCONFIG_FILE))
|
|
endif
|
|
endif
|
|
override BOARD := $(BOARD_IN_XML)
|
|
override SCENARIO := $(SCENARIO_IN_XML)
|
|
endif
|
|
|
|
update_config:
|
|
ifeq ($(CONFIG_XML_ENABLED),true)
|
|
@if [ ! -f $(UPDATE_RESULT) ]; then \
|
|
mkdir -p $(dir $(UPDATE_RESULT));\
|
|
if [ "$(TARGET_DIR)" = "" ]; then \
|
|
python3 ../misc/acrn-config/board_config/board_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) > $(UPDATE_RESULT);\
|
|
else \
|
|
python3 ../misc/acrn-config/board_config/board_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) --out $(TARGET_DIR) > $(UPDATE_RESULT);\
|
|
fi;\
|
|
cat $(UPDATE_RESULT);\
|
|
if [ "`sed -n /successfully/p $(UPDATE_RESULT)`" = "" ]; then rm -f $(UPDATE_RESULT); exit 1; fi;\
|
|
if [ "$(TARGET_DIR)" = "" ]; then \
|
|
python3 ../misc/acrn-config/scenario_config/scenario_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) > $(UPDATE_RESULT);\
|
|
else \
|
|
python3 ../misc/acrn-config/scenario_config/scenario_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) --out $(TARGET_DIR) > $(UPDATE_RESULT);\
|
|
fi;\
|
|
cat $(UPDATE_RESULT);\
|
|
if [ "`sed -n /successfully/p $(UPDATE_RESULT)`" = "" ]; then rm -f $(UPDATE_RESULT); exit 1; fi;\
|
|
echo "Import hypervisor Board/VM configuration from XMLs, configurations in source code has been overwritten!";\
|
|
elif [ "`sed -n /successfully/p $(UPDATE_RESULT)`" = "" ]; then \
|
|
echo "Problem is found on Board/VM configration patching, please rebuild."; rm -f $(UPDATE_RESULT); exit 1; \
|
|
else \
|
|
echo "Configurations is patched already!";\
|
|
fi;
|
|
else ifeq ($(CONFIG_XML_ENABLED),false)
|
|
@echo "Config XML file does not exist or with unknown format."
|
|
@exit 1
|
|
else
|
|
@echo "Using hypervisor configurations from source code directly."
|
|
endif
|