mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
Makefile: support make with external configurations
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>
This commit is contained in:
@@ -76,6 +76,14 @@ ifeq ($(SCENARIO),)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_DIR),)
|
||||
BOARD_CFG_DIR := arch/x86/configs/$(BOARD)
|
||||
SCENARIO_CFG_DIR := scenarios/$(SCENARIO)
|
||||
else
|
||||
BOARD_CFG_DIR := $(TARGET_DIR)/$(BOARD)
|
||||
SCENARIO_CFG_DIR := $(TARGET_DIR)/$(SCENARIO)
|
||||
endif
|
||||
|
||||
LD_IN_TOOL = scripts/genld.sh
|
||||
BASH = $(shell which bash)
|
||||
|
||||
@@ -170,8 +178,8 @@ INCLUDE_PATH += include/hw
|
||||
INCLUDE_PATH += boot/include
|
||||
INCLUDE_PATH += boot/include/guest
|
||||
INCLUDE_PATH += $(HV_OBJDIR)/include
|
||||
INCLUDE_PATH += arch/x86/configs/$(BOARD)
|
||||
INCLUDE_PATH += scenarios/$(SCENARIO)
|
||||
INCLUDE_PATH += $(BOARD_CFG_DIR)
|
||||
INCLUDE_PATH += $(SCENARIO_CFG_DIR)
|
||||
|
||||
CC ?= gcc
|
||||
AS ?= as
|
||||
@@ -257,10 +265,10 @@ HW_C_SRCS += common/sched_bvt.c
|
||||
endif
|
||||
HW_C_SRCS += hw/pci.c
|
||||
HW_C_SRCS += arch/x86/configs/vm_config.c
|
||||
HW_C_SRCS += arch/x86/configs/$(BOARD)/board.c
|
||||
HW_C_SRCS += scenarios/$(SCENARIO)/vm_configurations.c
|
||||
ifneq (,$(wildcard scenarios/$(SCENARIO)/pci_dev.c))
|
||||
HW_C_SRCS += scenarios/$(SCENARIO)/pci_dev.c
|
||||
HW_C_SRCS += $(BOARD_CFG_DIR)/board.c
|
||||
HW_C_SRCS += $(SCENARIO_CFG_DIR)/vm_configurations.c
|
||||
ifneq (,$(wildcard $(SCENARIO_CFG_DIR)/pci_dev.c))
|
||||
HW_C_SRCS += $(SCENARIO_CFG_DIR)/pci_dev.c
|
||||
endif
|
||||
HW_C_SRCS += boot/acpi_base.c
|
||||
HW_C_SRCS += boot/cmdline.c
|
||||
@@ -378,7 +386,7 @@ VERSION := $(HV_OBJDIR)/include/version.h
|
||||
# Create platform_acpi_info.h
|
||||
TEMPLATE_ACPI_INFO_HEADER := arch/x86/configs/platform_acpi_info.h
|
||||
BOARDTEMPLATE_ACPI_INFO_HEADER := arch/x86/configs/$(BOARD)/platform_acpi_info.h
|
||||
SOURCE_ACPI_INFO_HEADER := arch/x86/configs/$(BOARD)/$(BOARD)_acpi_info.h
|
||||
SOURCE_ACPI_INFO_HEADER := $(BOARD_CFG_DIR)/$(BOARD)_acpi_info.h
|
||||
TARGET_ACPI_INFO_HEADER := $(HV_OBJDIR)/include/platform_acpi_info.h
|
||||
|
||||
$(TARGET_ACPI_INFO_HEADER): $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
@@ -388,7 +396,7 @@ ifeq ($(CONFIG_ENFORCE_VALIDATED_ACPI_INFO),y)
|
||||
echo "Expected ACPI info header at $(SOURCE_ACPI_INFO_HEADER)" && \
|
||||
echo "" && \
|
||||
echo "The ACPI info header for this board is not available. Please use" && \
|
||||
echo "acrn-config tool for the target board to generate a validated one." \
|
||||
echo "acrn-config tool for the target board to generate a validated one." && \
|
||||
echo "If you want to build the hypervisor with the template ACPI info," && \
|
||||
echo "unset ENFORCE_VALIDATED_ACPI_INFO using 'make menuconfig'." && \
|
||||
false; \
|
||||
@@ -506,6 +514,16 @@ distclean:
|
||||
PHONY: (VERSION)
|
||||
$(VERSION):
|
||||
@echo "SCENARIO <$(SCENARIO)> for BOARD <$(BOARD)> is specified."
|
||||
@if [ ! -d $(BOARD_CFG_DIR) ]; then \
|
||||
echo "Configurations for BOARD $(BOARD) is not found."; exit 1; \
|
||||
else \
|
||||
echo "Found BOARD configurations under $(BOARD_CFG_DIR)"; \
|
||||
fi;
|
||||
@if [ ! -d $(SCENARIO_CFG_DIR) ]; then \
|
||||
echo "Configurations for SCENARIO $(SCENARIO) is not found."; exit 1; \
|
||||
else \
|
||||
echo "Found SCENARIO configurations under $(SCENARIO_CFG_DIR)"; \
|
||||
fi;
|
||||
touch $(VERSION)
|
||||
@COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\
|
||||
DIRTY=`git diff-index --name-only HEAD`;\
|
||||
|
@@ -37,10 +37,18 @@ update_config:
|
||||
ifeq ($(CONFIG_XML_ENABLED),true)
|
||||
@if [ ! -f $(UPDATE_RESULT) ]; then \
|
||||
mkdir -p $(dir $(UPDATE_RESULT));\
|
||||
python3 ../misc/acrn-config/board_config/board_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) > $(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;\
|
||||
python3 ../misc/acrn-config/scenario_config/scenario_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) > $(UPDATE_RESULT);\
|
||||
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!";\
|
||||
|
@@ -72,9 +72,18 @@ $(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
.PHONY: defconfig
|
||||
defconfig: $(KCONFIG_DEPS)
|
||||
@mkdir -p $(HV_OBJDIR)
|
||||
@BOARD=$(TARGET_BOARD) \
|
||||
python3 $(KCONFIG_DIR)/defconfig.py Kconfig \
|
||||
$(HV_OBJDIR)/$(HV_CONFIG)
|
||||
@if [ ! -f $(KCONFIG_FILE) ] && [ "$(CONFIG_XML_ENABLED)" != "true" ]; then \
|
||||
BOARD=$(TARGET_BOARD) python3 $(KCONFIG_DIR)/defconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG); \
|
||||
else \
|
||||
if [ "$(KCONFIG_FILE)" != "" ] && [ -f $(KCONFIG_FILE) ]; then \
|
||||
echo "Writing $(HV_OBJDIR)/$(HV_CONFIG) with $(KCONFIG_FILE)"; \
|
||||
cp $(KCONFIG_FILE) $(HV_OBJDIR)/$(HV_CONFIG); \
|
||||
elif [ "$(CONFIG_XML_ENABLED)" = "true" ] && [ "$(TARGET_DIR)" != "" ] && [ -d $(TARGET_DIR) ]; then \
|
||||
echo "Writing $(HV_OBJDIR)/$(HV_CONFIG) with $(TARGET_DIR)/$(BOARD).config"; \
|
||||
cp $(TARGET_DIR)/$(BOARD).config $(HV_OBJDIR)/$(HV_CONFIG); \
|
||||
fi; \
|
||||
python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) RELEASE=$(RELEASE); \
|
||||
fi
|
||||
|
||||
# Use silentoldconfig to forcefully update the current .config, or generate a
|
||||
# new one if no previous .config exists. This target can be used as a
|
||||
@@ -98,7 +107,7 @@ savedefconfig: $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
|
||||
$(eval $(call check_dep_exec,menuconfig,MENUCONFIG_DEPS))
|
||||
export KCONFIG_CONFIG := $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
menuconfig: $(MENUCONFIG_DEPS) $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
menuconfig: $(MENUCONFIG_DEPS) defconfig
|
||||
@python3 $(shell which menuconfig) Kconfig
|
||||
|
||||
CFLAGS += -include $(HV_OBJDIR)/$(HV_CONFIG_H)
|
||||
|
Reference in New Issue
Block a user