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-08-05 00:45:09 +08:00
|
|
|
# ACRN Version Information
|
|
|
|
include VERSION
|
2022-05-16 15:59:34 +08:00
|
|
|
SCM_VERSION := $(shell [ -d .git ] && git describe --exact-match 1>/dev/null 2>&1 || git describe --dirty)
|
|
|
|
ifneq ($(SCM_VERSION),)
|
|
|
|
SCM_VERSION := "-"$(SCM_VERSION)
|
|
|
|
endif
|
|
|
|
export FULL_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)$(EXTRA_VERSION)$(SCM_VERSION)
|
2021-08-05 00:45:09 +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))
|
2022-04-23 04:46:28 +08:00
|
|
|
override SCENARIO := $(abspath $(SCENARIO_FILE))
|
2021-01-14 14:04:48 +08:00
|
|
|
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)),)
|
2022-04-23 04:46:28 +08:00
|
|
|
override SCENARIO := $(abspath $(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-03-02 06:32:12 +08:00
|
|
|
TOOLS_OUT := $(ROOT_OUT)/misc
|
2018-06-12 17:38:43 +08:00
|
|
|
DOC_OUT := $(ROOT_OUT)/doc
|
2021-08-05 00:45:09 +08:00
|
|
|
TARBALL_OUT := $(ROOT_OUT)/tarball
|
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
|
2021-03-23 05:26:23 +08:00
|
|
|
ASL_COMPILER ?= $(shell which iasl)
|
2022-02-15 19:07:57 +08:00
|
|
|
DPKG_BIN ?= $(shell which dpkg)
|
2022-03-18 17:57:59 +08:00
|
|
|
YARN_BIN ?= $(shell which yarn)
|
|
|
|
CARGO_BIN ?= $(shell which cargo)
|
2022-07-04 09:47:59 +08:00
|
|
|
IASL_MIN_VER = "20190703"
|
2019-11-10 09:05:41 +08:00
|
|
|
|
2021-03-03 22:07:34 +08:00
|
|
|
.PHONY: all hypervisor devicemodel tools life_mngr doc
|
2018-08-09 09:25:13 +08:00
|
|
|
all: hypervisor devicemodel tools
|
2019-12-09 12:13:49 +08:00
|
|
|
@cat $(HV_CFG_LOG)
|
2022-02-15 19:07:57 +08:00
|
|
|
@if [ -x "$(DPKG_BIN)" ]; then \
|
|
|
|
DEB_BOARD=$$(grep "BOARD" $(HV_CFG_LOG) | awk -F '= ' '{print $$2 }'); \
|
|
|
|
DEB_SCENARIO=$$(grep "SCENARIO" $(HV_CFG_LOG) | awk -F '= ' '{print $$2 }'); \
|
|
|
|
python3 misc/packaging/gen_acrn_deb.py acrn_all $(ROOT_OUT) --version=$(FULL_VERSION) --board_name="$$DEB_BOARD" --scenario="$$DEB_SCENARIO"; \
|
|
|
|
fi
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2022-07-04 15:07:28 +08:00
|
|
|
HV_MAKEOPTS := -C $(T)/hypervisor BOARD=$(BOARD) SCENARIO=$(SCENARIO) HV_OBJDIR=$(HV_OUT) RELEASE=$(RELEASE) ASL_COMPILER=$(ASL_COMPILER) IASL_MIN_VER=$(IASL_MIN_VER)
|
2022-02-15 19:07:57 +08:00
|
|
|
|
2021-09-26 22:42:40 +08:00
|
|
|
board_inspector:
|
2022-02-15 19:07:57 +08:00
|
|
|
@if [ -x "$(DPKG_BIN)" ]; then \
|
|
|
|
python3 misc/packaging/gen_acrn_deb.py board_inspector $(ROOT_OUT) --version=$(FULL_VERSION); \
|
|
|
|
else \
|
|
|
|
echo -e "The 'dpkg' utility is not available. Unable to create Debian package for board_inspector."; \
|
|
|
|
fi
|
2021-02-28 11:26:58 +08:00
|
|
|
|
2022-03-18 17:57:59 +08:00
|
|
|
configurator:
|
|
|
|
@if [ -x "$(YARN_BIN)" ] && [ -x "$(CARGO_BIN)" ]; then \
|
2022-05-16 15:59:34 +08:00
|
|
|
python3 misc/packaging/gen_acrn_deb.py configurator $(ROOT_OUT) --version=$(FULL_VERSION); \
|
2022-03-18 17:57:59 +08:00
|
|
|
else \
|
|
|
|
echo -e "'yarn' or 'cargo' utility is not available. Unable to create Debian package for configurator."; \
|
|
|
|
fi
|
|
|
|
|
2021-03-25 23:44:04 +08:00
|
|
|
hypervisor: hvdefconfig
|
2021-02-28 11:26:58 +08:00
|
|
|
$(MAKE) $(HV_MAKEOPTS)
|
|
|
|
@echo -e "ACRN Configuration Summary:" > $(HV_CFG_LOG)
|
|
|
|
@$(MAKE) showconfig $(HV_MAKEOPTS) -s >> $(HV_CFG_LOG)
|
2019-12-09 12:13:49 +08:00
|
|
|
@cat $(HV_CFG_LOG)
|
2018-05-24 17:39:59 +08:00
|
|
|
|
2021-02-28 11:26:58 +08:00
|
|
|
# Targets that manipulate hypervisor configurations
|
|
|
|
hvdefconfig:
|
|
|
|
@$(MAKE) defconfig $(HV_MAKEOPTS)
|
|
|
|
|
|
|
|
hvshowconfig:
|
|
|
|
@$(MAKE) showconfig $(HV_MAKEOPTS) -s
|
|
|
|
|
|
|
|
hvdiffconfig:
|
|
|
|
@$(MAKE) diffconfig $(HV_MAKEOPTS)
|
|
|
|
|
|
|
|
hvapplydiffconfig:
|
|
|
|
@$(MAKE) applydiffconfig $(HV_MAKEOPTS) PATCH=$(abspath $(PATCH))
|
|
|
|
|
2018-05-30 02:16:56 +08:00
|
|
|
devicemodel: tools
|
2022-07-04 09:47:59 +08:00
|
|
|
$(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG) TOOLS_OUT=$(TOOLS_OUT) RELEASE=$(RELEASE) IASL_MIN_VER=$(IASL_MIN_VER)
|
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
|
|
|
|
2021-03-03 22:07:34 +08:00
|
|
|
life_mngr:
|
|
|
|
mkdir -p $(TOOLS_OUT)
|
|
|
|
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) RELEASE=$(RELEASE) life_mngr
|
|
|
|
|
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)
|
2022-05-18 17:35:14 +08:00
|
|
|
python3 misc/packaging/gen_acrn_deb.py clean $(ROOT_OUT) --version=$(FULL_VERSION);
|
2018-05-18 16:38:19 +08:00
|
|
|
|
2021-03-03 22:07:34 +08:00
|
|
|
.PHONY: install life_mngr-install
|
2018-08-09 09:25:13 +08:00
|
|
|
install: hypervisor-install devicemodel-install tools-install
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2021-08-05 22:23:49 +08:00
|
|
|
hypervisor-install: hypervisor
|
2021-02-28 11:26:58 +08:00
|
|
|
$(MAKE) $(HV_MAKEOPTS) install
|
2018-05-17 03:21:45 +08:00
|
|
|
|
2019-09-19 23:07:10 +08:00
|
|
|
hypervisor-install-debug:
|
2021-02-28 11:26:58 +08:00
|
|
|
$(MAKE) $(HV_MAKEOPTS) install-debug
|
2019-01-22 11:12:53 +08:00
|
|
|
|
2021-08-05 22:23:49 +08:00
|
|
|
devicemodel-install: tools-install devicemodel
|
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
|
|
|
|
2021-08-05 22:23:49 +08:00
|
|
|
tools-install: tools
|
2019-07-29 12:21:54 +08:00
|
|
|
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) RELEASE=$(RELEASE) install
|
2021-03-03 22:07:34 +08:00
|
|
|
|
|
|
|
life_mngr-install:
|
|
|
|
$(MAKE) -C $(T)/misc OUT_DIR=$(TOOLS_OUT) RELEASE=$(RELEASE) acrn-life-mngr-install
|
2021-08-05 00:45:09 +08:00
|
|
|
|
|
|
|
.PHONY: targz-pkg
|
|
|
|
targz-pkg:
|
|
|
|
$(MAKE) install DESTDIR=$(TARBALL_OUT)
|
|
|
|
cd $(TARBALL_OUT) && \
|
|
|
|
tar -zcvf $(ROOT_OUT)/acrn-$(FULL_VERSION).tar.gz *
|