2020-03-16 22:40:14 +08:00
|
|
|
# acrn-hypervisor/Makefile
|
2018-05-15 09:09:20 +08:00
|
|
|
|
|
|
|
# global helper variables
|
|
|
|
T := $(CURDIR)
|
2018-12-11 16:00:56 +08:00
|
|
|
|
2020-03-24 10:58:52 +08:00
|
|
|
TARGET_DIR ?=
|
|
|
|
|
2020-03-16 23:53:05 +08:00
|
|
|
# BOARD/SCENARIO/BOARD_FILE/SCENARIO_FILE/KCONFIG_FILE parameters sanity check:
|
|
|
|
#
|
|
|
|
# Only below usages are VALID: (target = all | hypervisor)
|
|
|
|
# 1. make <target>
|
2020-03-24 10:58:52 +08:00
|
|
|
# 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]
|
2020-03-16 23:53:05 +08:00
|
|
|
#
|
|
|
|
# Especially for case 1 that no any parameters are specified:
|
|
|
|
# a. If hypervisor/build/.config file which generated by "make menuconfig" exist,
|
|
|
|
# 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,
|
|
|
|
# the default BOARD/SCENARIO will be loaded:
|
|
|
|
# i.e. equal: make <target> BOARD=$(BOARD) SCENARIO=$(SCENARIO)
|
|
|
|
#
|
2020-03-24 10:58:52 +08:00
|
|
|
# For case 2/3, configurations are imported from TARGET_DIR when TARGET_DIR is specified;
|
2020-04-16 09:54:43 +08:00
|
|
|
# For case 4, configurations are from XML files and saved to TARGET_DIR if it is specified;
|
2020-03-24 10:58:52 +08:00
|
|
|
#
|
2020-03-16 23:53:05 +08:00
|
|
|
# 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 "
|
|
|
|
|
2020-03-16 22:40:14 +08:00
|
|
|
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
|
|
|
|
|
2020-03-16 23:53:05 +08:00
|
|
|
ifneq ($(BOARD)$(SCENARIO),)
|
|
|
|
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
|
|
|
$(error BOARD/SCENARIO parameter could not coexist with BOARD_FILE/SCENARIO_FILE)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-07-15 16:40:24 +08:00
|
|
|
ifneq ($(TARGET_DIR),)
|
|
|
|
CFG_DIR := $(realpath $(TARGET_DIR))
|
|
|
|
ifeq ($(CFG_DIR),)
|
|
|
|
ifeq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
2020-03-24 10:58:52 +08:00
|
|
|
$(error TARGET_DIR $(TARGET_DIR) does not exist)
|
|
|
|
endif
|
|
|
|
endif
|
2020-07-15 16:40:24 +08:00
|
|
|
|
|
|
|
override TARGET_DIR := $(abspath $(TARGET_DIR))
|
2020-03-24 10:58:52 +08:00
|
|
|
endif
|
|
|
|
|
2020-03-16 23:53:05 +08:00
|
|
|
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
|
|
|
ifneq ($(BOARD_FILE), $(wildcard $(BOARD_FILE)))
|
|
|
|
$(error BOARD_FILE: $(BOARD_FILE) does not exist)
|
|
|
|
endif
|
|
|
|
ifneq ($(SCENARIO_FILE), $(wildcard $(SCENARIO_FILE)))
|
|
|
|
$(error SCENARIO_FILE: $(SCENARIO_FILE) does not exist)
|
|
|
|
endif
|
|
|
|
|
|
|
|
override BOARD_FILE := $(realpath $(BOARD_FILE))
|
|
|
|
override SCENARIO_FILE := $(realpath $(SCENARIO_FILE))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(KCONFIG_FILE), $(wildcard $(KCONFIG_FILE)))
|
|
|
|
ifneq ($(BOARD)$(SCENARIO),)
|
2020-04-16 09:54:43 +08:00
|
|
|
$(error BOARD/SCENARIO parameter could not coexist with Kconfig file: $(KCONFIG_FILE))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
|
|
|
$(error BOARD_FILE/SCENARIO_FILE parameter could not coexist with Kconfig file: $(KCONFIG_FILE))
|
2020-03-16 23:53:05 +08:00
|
|
|
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
|
|
|
|
|
2020-04-13 09:47:26 +08:00
|
|
|
SCENARIO_IN_KCONFIG := $(shell grep CONFIG_SCENARIO= $(KCONFIG_FILE) | grep -v '\#' | awk -F '"' '{print $$2}')
|
2020-03-16 23:53:05 +08:00
|
|
|
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
|
|
|
|
|
2019-10-30 13:35:57 +08:00
|
|
|
BOARD ?= kbl-nuc-i7
|
2018-12-11 16:00:56 +08:00
|
|
|
|
2020-07-15 16:40:24 +08:00
|
|
|
ifeq ($(BOARD), apl-nuc)
|
|
|
|
override BOARD := nuc6cayh
|
|
|
|
else ifeq ($(BOARD), kbl-nuc-i7)
|
|
|
|
override BOARD := nuc7i7dnb
|
|
|
|
endif
|
|
|
|
|
2019-08-06 19:46:31 +08:00
|
|
|
ifneq (,$(filter $(BOARD),apl-mrb))
|
|
|
|
FIRMWARE ?= sbl
|
|
|
|
else
|
|
|
|
FIRMWARE ?= uefi
|
2018-12-11 16:00:56 +08:00
|
|
|
endif
|
|
|
|
|
2020-07-16 12:27:22 +08:00
|
|
|
SCENARIO ?= industry
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2018-05-23 19:24:29 +08:00
|
|
|
O ?= build
|
|
|
|
ROOT_OUT := $(shell mkdir -p $(O);cd $(O);pwd)
|
2018-05-15 09:09:20 +08:00
|
|
|
HV_OUT := $(ROOT_OUT)/hypervisor
|
|
|
|
DM_OUT := $(ROOT_OUT)/devicemodel
|
2019-07-29 12:21:54 +08:00
|
|
|
TOOLS_OUT := $(ROOT_OUT)/misc/tools
|
2018-06-12 17:38:43 +08:00
|
|
|
DOC_OUT := $(ROOT_OUT)/doc
|
2018-08-06 10:09:27 +08:00
|
|
|
BUILD_VERSION ?=
|
|
|
|
BUILD_TAG ?=
|
2019-12-09 12:13:49 +08:00
|
|
|
HV_CFG_LOG = $(HV_OUT)/cfg.log
|
2020-07-15 16:40:24 +08:00
|
|
|
VM_CONFIGS_DIR = $(T)/misc/vm_configs
|
|
|
|
DEFCONFIG_FILE = scenarios/$(SCENARIO)/$(BOARD)/$(BOARD).config
|
2019-11-10 09:05:41 +08:00
|
|
|
|
2019-11-09 11:18:58 +08:00
|
|
|
export TOOLS_OUT BOARD SCENARIO FIRMWARE RELEASE
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2018-08-09 09:25:13 +08:00
|
|
|
.PHONY: all hypervisor devicemodel tools doc
|
|
|
|
all: hypervisor devicemodel tools
|
2019-12-09 12:13:49 +08:00
|
|
|
@cat $(HV_CFG_LOG)
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2019-11-12 14:11:58 +08:00
|
|
|
include $(T)/hypervisor/scripts/makefile/cfg_update.mk
|
2019-11-09 11:18:58 +08:00
|
|
|
|
2019-09-27 17:15:36 +08:00
|
|
|
#help functions to build acrn and install acrn/acrn symbols
|
|
|
|
define build_acrn
|
2020-04-13 09:47:26 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-$(1)/$(2) BOARD=$(2) FIRMWARE=$(1) SCENARIO=$(3) RELEASE=$(RELEASE) clean
|
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-$(1)/$(2) BOARD=$(2) FIRMWARE=$(1) SCENARIO=$(3) RELEASE=$(RELEASE) defconfig
|
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-$(1)/$(2) BOARD=$(2) FIRMWARE=$(1) SCENARIO=$(3) RELEASE=$(RELEASE) oldconfig
|
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-$(1)/$(2) BOARD=$(2) FIRMWARE=$(1) SCENARIO=$(3) RELEASE=$(RELEASE)
|
2019-09-27 17:15:36 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define install_acrn
|
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-$(1)/$(2) BOARD=$(2) FIRMWARE=$(1) SCENARIO=$(3) RELEASE=$(RELEASE) install
|
|
|
|
endef
|
|
|
|
|
|
|
|
define install_acrn_debug
|
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-$(1)/$(2) BOARD=$(2) FIRMWARE=$(1) SCENARIO=$(3) RELEASE=$(RELEASE) install-debug
|
|
|
|
endef
|
|
|
|
|
2019-09-19 23:07:10 +08:00
|
|
|
hypervisor:
|
2020-03-24 10:58:52 +08:00
|
|
|
@if [ "$(BOARD_FILE)" != "" ] && [ -f $(BOARD_FILE) ] && [ "$(SCENARIO_FILE)" != "" ] && [ -f $(SCENARIO_FILE) ] && [ "$(TARGET_DIR)" = "" ]; then \
|
|
|
|
echo "No TARGET_DIR parameter is specified, the original configuration source is overwritten!";\
|
|
|
|
fi
|
2020-07-15 16:40:24 +08:00
|
|
|
$(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)
|
2019-12-09 12:13:49 +08:00
|
|
|
@echo -e "\n\033[47;30mACRN Configuration Summary:\033[0m \nBOARD = $(BOARD)\t SCENARIO = $(SCENARIO)" > $(HV_CFG_LOG); \
|
2020-04-16 09:54:43 +08:00
|
|
|
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; \
|
2020-03-16 22:40:14 +08:00
|
|
|
if [ -f $(KCONFIG_FILE) ]; then \
|
|
|
|
echo -e "Hypervisor configuration is based on:\n\tKconfig file:\t$(KCONFIG_FILE);" >> $(HV_CFG_LOG); \
|
2019-12-09 12:13:49 +08:00
|
|
|
fi; \
|
2020-07-15 16:40:24 +08:00
|
|
|
echo -e "Hypervisor configuration is based on:" >> $(HV_CFG_LOG); \
|
2020-03-24 10:58:52 +08:00
|
|
|
if [ "$(TARGET_DIR)" = "" ]; then \
|
|
|
|
if [ ! -f $(KCONFIG_FILE) ]; then \
|
2020-07-15 16:40:24 +08:00
|
|
|
echo -e "\tdefconfig file:\t\t\t$(VM_CONFIGS_DIR)/$(DEFCONFIG_FILE);" >> $(HV_CFG_LOG); \
|
2020-03-24 10:58:52 +08:00
|
|
|
fi; \
|
|
|
|
elif [ ! -f $(KCONFIG_FILE) ]; then \
|
2020-07-15 16:40:24 +08:00
|
|
|
echo -e "\tdefconfig file:\t\t\t$(TARGET_DIR)/$(DEFCONFIG_FILE);" >> $(HV_CFG_LOG); \
|
2020-03-24 10:58:52 +08:00
|
|
|
fi; \
|
|
|
|
echo -e "\tOthers are set by default in:\t$(T)/hypervisor/arch/x86/Kconfig;" >> $(HV_CFG_LOG); \
|
2020-07-15 16:40:24 +08:00
|
|
|
echo -e "VM configuration is based on:" >> $(HV_CFG_LOG); \
|
2019-12-09 12:13:49 +08:00
|
|
|
if [ "$(CONFIG_XML_ENABLED)" = "true" ]; then \
|
2020-07-15 16:40:24 +08:00
|
|
|
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); \
|
2019-12-09 12:13:49 +08:00
|
|
|
else \
|
2020-07-15 16:40:24 +08:00
|
|
|
echo -e "\tSource code at:\t\t\t$(TARGET_DIR)" >> $(HV_CFG_LOG); \
|
2020-07-16 13:01:30 +08:00
|
|
|
fi;
|
2019-12-09 12:13:49 +08:00
|
|
|
@cat $(HV_CFG_LOG)
|
2018-05-24 17:39:59 +08:00
|
|
|
|
2018-05-30 02:16:56 +08:00
|
|
|
devicemodel: tools
|
2019-04-16 10:59:25 +08:00
|
|
|
$(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG) DM_ASL_COMPILER=$(ASL_COMPILER) RELEASE=$(RELEASE)
|
2018-05-15 09:09:20 +08:00
|
|
|
|
|
|
|
tools:
|
|
|
|
mkdir -p $(TOOLS_OUT)
|
2019-07-29 12:21:54 +08:00
|
|
|
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) RELEASE=$(RELEASE)
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2018-06-12 17:38:43 +08:00
|
|
|
doc:
|
2019-01-17 05:35:20 +08:00
|
|
|
$(MAKE) -C $(T)/doc html BUILDDIR=$(DOC_OUT)
|
2018-06-12 17:38:43 +08:00
|
|
|
|
2018-05-15 09:09:20 +08:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2019-07-29 12:21:54 +08:00
|
|
|
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) clean
|
2019-01-17 05:35:20 +08:00
|
|
|
$(MAKE) -C $(T)/doc BUILDDIR=$(DOC_OUT) clean
|
2018-05-15 09:09:20 +08:00
|
|
|
rm -rf $(ROOT_OUT)
|
2020-03-24 10:58:52 +08:00
|
|
|
rm -rf $(TARGET_DIR)
|
2018-05-18 16:38:19 +08:00
|
|
|
|
2018-05-17 03:21:45 +08:00
|
|
|
.PHONY: install
|
2018-08-09 09:25:13 +08:00
|
|
|
install: hypervisor-install devicemodel-install tools-install
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2019-09-19 23:07:10 +08:00
|
|
|
hypervisor-install:
|
2019-08-14 11:27:21 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) SCENARIO=$(SCENARIO) RELEASE=$(RELEASE) install
|
2018-05-17 03:21:45 +08:00
|
|
|
|
2019-09-19 23:07:10 +08:00
|
|
|
hypervisor-install-debug:
|
2019-08-14 11:27:21 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) SCENARIO=$(SCENARIO) RELEASE=$(RELEASE) install-debug
|
2019-01-22 11:12:53 +08:00
|
|
|
|
2019-09-27 17:15:36 +08:00
|
|
|
kbl-nuc-i7-uefi-industry:
|
2020-04-13 09:47:26 +08:00
|
|
|
$(call build_acrn,uefi,nuc7i7dnb,industry)
|
2019-10-08 13:29:55 +08:00
|
|
|
apl-up2-uefi-hybrid:
|
2020-04-13 09:47:26 +08:00
|
|
|
$(call build_acrn,uefi,apl-up2,hybrid)
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-07-16 12:27:22 +08:00
|
|
|
sbl-hypervisor: kbl-nuc-i7-uefi-industry \
|
2019-10-08 13:29:55 +08:00
|
|
|
apl-up2-uefi-hybrid
|
2019-09-27 17:15:36 +08:00
|
|
|
|
|
|
|
kbl-nuc-i7-uefi-industry-install:
|
2019-10-30 13:35:57 +08:00
|
|
|
$(call install_acrn,uefi,nuc7i7dnb,industry)
|
2019-10-08 13:29:55 +08:00
|
|
|
apl-up2-uefi-hybrid-install:
|
|
|
|
$(call install_acrn,uefi,apl-up2,hybrid)
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-07-16 12:27:22 +08:00
|
|
|
sbl-hypervisor-install: kbl-nuc-i7-uefi-industry-install \
|
2019-10-08 13:29:55 +08:00
|
|
|
apl-up2-uefi-hybrid-install
|
2019-09-27 17:15:36 +08:00
|
|
|
|
|
|
|
kbl-nuc-i7-uefi-industry-install-debug:
|
2019-10-30 13:35:57 +08:00
|
|
|
$(call install_acrn_debug,uefi,nuc7i7dnb,industry)
|
2019-10-08 13:29:55 +08:00
|
|
|
apl-up2-uefi-hybrid-install-debug:
|
|
|
|
$(call install_acrn_debug,uefi,apl-up2,hybrid)
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-07-16 12:27:22 +08:00
|
|
|
sbl-hypervisor-install-debug: kbl-nuc-i7-uefi-industry-install-debug \
|
2019-10-08 13:29:55 +08:00
|
|
|
apl-up2-uefi-hybrid-install-debug
|
2019-01-22 11:12:53 +08:00
|
|
|
|
2018-05-17 03:21:45 +08:00
|
|
|
devicemodel-install:
|
2019-01-17 05:35:20 +08:00
|
|
|
$(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) install
|
2018-05-17 03:21:45 +08:00
|
|
|
|
2018-05-17 06:59:53 +08:00
|
|
|
tools-install:
|
2019-07-29 12:21:54 +08:00
|
|
|
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) RELEASE=$(RELEASE) install
|