2020-03-16 22:40:14 +08:00
|
|
|
# acrn-hypervisor/Makefile
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2020-12-07 18:16:23 +08:00
|
|
|
# Explicitly set the shell to be used
|
|
|
|
SHELL := /bin/bash
|
|
|
|
|
2018-05-15 09:09:20 +08:00
|
|
|
# global helper variables
|
|
|
|
T := $(CURDIR)
|
2018-12-11 16:00:56 +08:00
|
|
|
|
2021-01-14 14:04:48 +08:00
|
|
|
ifdef TARGET_DIR
|
|
|
|
$(warning TARGET_DIR is obsoleted because generated configuration files are now stored in the build directory)
|
|
|
|
endif
|
|
|
|
|
|
|
|
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
|
2020-03-24 10:58:52 +08:00
|
|
|
|
2021-01-14 14:04:48 +08:00
|
|
|
# BOARD/SCENARIO/BOARD_FILE/SCENARIO_FILE parameters sanity check:
|
2020-03-16 23:53:05 +08:00
|
|
|
#
|
|
|
|
# Only below usages are VALID: (target = all | hypervisor)
|
|
|
|
# 1. make <target>
|
2021-01-14 14:04:48 +08:00
|
|
|
# 2. make <target> BOARD=xxx SCENARIO=xxx
|
|
|
|
# 3. make <target> BOARD_FILE=xxx SCENARIO_FILE=xxx
|
2020-03-16 23:53:05 +08:00
|
|
|
#
|
2021-01-14 14:04:48 +08:00
|
|
|
# For case 1 that no any parameters are specified, the default BOARD/SCENARIO will be loaded:
|
|
|
|
# i.e. equal: make <target> BOARD=kbl-nuc-i7 SCENARIO=industry
|
2020-03-16 23:53:05 +08:00
|
|
|
#
|
2021-01-14 14:04:48 +08:00
|
|
|
# For case 2/3, configurations are from XML files and saved to HV_OUT
|
2020-03-16 22:40:14 +08:00
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-01-14 14:04:48 +08:00
|
|
|
override BOARD := $(realpath $(BOARD_FILE))
|
|
|
|
override SCENARIO := $(realpath $(SCENARIO_FILE))
|
|
|
|
else
|
|
|
|
# BOARD/SCENARIO pointing to XML files must be converted to absolute paths before being passed to hypervisor/Makefile
|
|
|
|
# because paths relative to acrn-hypervisor/ are typically invalid when relative to acrn-hypervisor/Makefile
|
|
|
|
ifneq ($(realpath $(BOARD)),)
|
|
|
|
override BOARD := $(realpath $(BOARD))
|
2020-03-16 23:53:05 +08:00
|
|
|
endif
|
2021-01-14 14:04:48 +08:00
|
|
|
ifneq ($(realpath $(SCENARIO)),)
|
|
|
|
override SCENARIO := $(realpath $(SCENARIO))
|
2020-03-16 23:53:05 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-02-28 10:59:52 +08:00
|
|
|
# Backward-compatibility for RELEASE=(0|1)
|
|
|
|
ifeq ($(RELEASE),1)
|
|
|
|
override RELEASE := y
|
|
|
|
else
|
|
|
|
ifeq ($(RELEASE),0)
|
|
|
|
override RELEASE := n
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
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
|
2021-01-23 07:24:06 +08:00
|
|
|
TOOLS_OUT := $(ROOT_OUT)/misc/debug_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
|
2021-01-23 07:24:06 +08:00
|
|
|
VM_CONFIGS_DIR = $(T)/misc/config_tools
|
2019-11-10 09:05:41 +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-09-27 17:15:36 +08:00
|
|
|
#help functions to build acrn and install acrn/acrn symbols
|
|
|
|
define build_acrn
|
2021-01-14 14:04:48 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) clean
|
2020-08-24 13:21:02 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE)
|
2019-09-27 17:15:36 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define install_acrn
|
2020-08-24 13:21:02 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE) install
|
2019-09-27 17:15:36 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define install_acrn_debug
|
2020-08-24 13:21:02 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)/$(1) BOARD=$(1) SCENARIO=$(2) RELEASE=$(RELEASE) install-debug
|
2019-09-27 17:15:36 +08:00
|
|
|
endef
|
|
|
|
|
2019-09-19 23:07:10 +08:00
|
|
|
hypervisor:
|
2021-01-14 14:04:48 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor BOARD=$(BOARD) SCENARIO=$(SCENARIO) HV_OBJDIR=$(HV_OUT) RELEASE=$(RELEASE)
|
2020-12-07 18:12:44 +08:00
|
|
|
@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); \
|
|
|
|
if [ "$(RELEASE)" = "0" ]; then echo -e "DEBUG" >> $(HV_CFG_LOG); else echo -e "RELEASE" >> $(HV_CFG_LOG); fi; \
|
|
|
|
echo -e "VM configuration is based on:" >> $(HV_CFG_LOG); \
|
2021-01-14 14:04:48 +08:00
|
|
|
echo -e "\tSource code at:\t\t\t$(HV_OUT)/configs" >> $(HV_CFG_LOG);
|
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
|
2021-02-28 10:50:33 +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) TOOLS_OUT=$(TOOLS_OUT) 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)
|
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:
|
2020-08-24 13:21:02 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) SCENARIO=$(SCENARIO) RELEASE=$(RELEASE) install
|
2018-05-17 03:21:45 +08:00
|
|
|
|
2019-09-19 23:07:10 +08:00
|
|
|
hypervisor-install-debug:
|
2020-08-24 13:21:02 +08:00
|
|
|
$(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) SCENARIO=$(SCENARIO) RELEASE=$(RELEASE) install-debug
|
2019-01-22 11:12:53 +08:00
|
|
|
|
2020-08-24 13:21:02 +08:00
|
|
|
kbl-nuc-i7-industry:
|
|
|
|
$(call build_acrn,nuc7i7dnb,industry)
|
|
|
|
apl-up2-hybrid:
|
|
|
|
$(call build_acrn,apl-up2,hybrid)
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-08-24 13:21:02 +08:00
|
|
|
sbl-hypervisor: kbl-nuc-i7-industry \
|
|
|
|
apl-up2-hybrid
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-08-24 13:21:02 +08:00
|
|
|
kbl-nuc-i7-industry-install:
|
|
|
|
$(call install_acrn,nuc7i7dnb,industry)
|
|
|
|
apl-up2-hybrid-install:
|
|
|
|
$(call install_acrn,apl-up2,hybrid)
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-08-24 13:21:02 +08:00
|
|
|
sbl-hypervisor-install: kbl-nuc-i7-industry-install \
|
|
|
|
apl-up2-hybrid-install
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-08-24 13:21:02 +08:00
|
|
|
kbl-nuc-i7-industry-install-debug:
|
|
|
|
$(call install_acrn_debug,nuc7i7dnb,industry)
|
|
|
|
apl-up2-hybrid-install-debug:
|
|
|
|
$(call install_acrn_debug,apl-up2,hybrid)
|
2019-09-27 17:15:36 +08:00
|
|
|
|
2020-08-24 13:21:02 +08:00
|
|
|
sbl-hypervisor-install-debug: kbl-nuc-i7-industry-install-debug \
|
|
|
|
apl-up2-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
|