2018-05-15 09:09:20 +08:00
# global helper variables
T := $( CURDIR)
2018-12-11 16:00:56 +08:00
2019-10-30 13:35:57 +08:00
BOARD ?= kbl-nuc-i7
2018-12-11 16:00:56 +08:00
2019-08-06 19:46:31 +08:00
i f n e q ( , $( filter $ ( BOARD ) ,apl -mrb ) )
FIRMWARE ?= sbl
e l s e
FIRMWARE ?= uefi
2018-12-11 16:00:56 +08:00
e n d i f
2018-05-17 16:44:11 +08:00
RELEASE ?= 0
2019-08-14 11:27:21 +08:00
SCENARIO ?= sdc
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
2019-10-11 14:07:17 +08:00
EFI_OUT := misc/efi-stub
2018-05-15 09:09:20 +08:00
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-11-10 09:05:41 +08:00
DEFAULT_MENU_CONFIG_FILE ?= $( T) /hypervisor/build/.config
2019-11-19 17:19:41 +08:00
GENED_ACPI_INFO_HEADER = $( T) /hypervisor/arch/x86/configs/$( BOARD) /$( BOARD) _acpi_info.h
2019-12-09 12:13:49 +08:00
HV_CFG_LOG = $( HV_OUT) /cfg.log
2019-11-10 09:05:41 +08:00
i f n e q ( $( BOARD_FILE ) , )
override BOARD_FILE := $( shell if [ -f $( BOARD_FILE) ] ; then realpath $( BOARD_FILE) ; fi )
e n d i f
i f n e q ( $( SCENARIO_FILE ) , )
override SCENARIO_FILE := $( shell if [ -f $( SCENARIO_FILE) ] ; then realpath $( SCENARIO_FILE) ; fi )
e n d i f
2019-09-11 14:42:05 +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-09-17 11:55:47 +08:00
i f e q ( $( BOARD ) , a p l - n u c )
2019-11-10 09:05:41 +08:00
override BOARD := nuc6cayh
2019-09-17 11:55:47 +08:00
e l s e i f e q ( $( BOARD ) , k b l - n u c - i 7 )
2019-11-10 09:05:41 +08:00
override BOARD := nuc7i7dnb
2019-09-17 11:55:47 +08:00
e n d i f
2019-11-10 09:05:41 +08:00
#BOARD and SCENARIO definition priority:
# If we do menuconfig in advance, the menuconfig will define
# BOARD
# SCENARIO
# else if we have board/scenario file avaiable, BOARD and SCENARIO will be
# extracted from files.
# else if make comand has BORAD/SCENARIO parameters, BOARD and SCENARIO will
# be gotten from parameters
# else
# default value defined in this make file will be used
#
2019-11-12 14:11:58 +08:00
i n c l u d e $( T ) / h y p e r v i s o r / s c r i p t s / m a k e f i l e / c f g _ u p d a t e . m k
2019-11-09 11:18:58 +08:00
2019-11-10 09:05:41 +08:00
i f e q ( $( DEFAULT_MENU_CONFIG_FILE ) , $( wildcard $ ( DEFAULT_MENU_CONFIG_FILE ) ) )
BOARD_IN_MENUCONFIG := $( shell grep CONFIG_BOARD = $( DEFAULT_MENU_CONFIG_FILE) | awk -F '"' '{print $$2}' )
2019-12-05 15:42:17 +08:00
SCENARIO_IN_MENUCONFIG := $( shell grep -E "SDC=y|SDC2=y|INDUSTRY=y|LOGICAL_PARTITION=y|HYBRID=y" \
$( DEFAULT_MENU_CONFIG_FILE) | awk -F "=" '{print $$1}' | cut -d '_' -f 2- | tr A-Z a-z)
2019-11-10 09:05:41 +08:00
RELEASE := $( shell grep CONFIG_RELEASE = y $( DEFAULT_MENU_CONFIG_FILE) )
ifneq ( $( RELEASE) ,)
override RELEASE := 1
endif
ifneq ( $( BOARD_IN_MENUCONFIG) ,$( BOARD) )
override BOARD := $( BOARD_IN_MENUCONFIG)
endif
ifneq ( $( SCENARIO_IN_MENUCONFIG) ,$( SCENARIO) )
override SCENARIO := $( SCENARIO_IN_MENUCONFIG)
endif
e n d i f
2019-09-27 17:15:36 +08:00
#help functions to build acrn and install acrn/acrn symbols
d e f i n e b u i l d _ a c r n
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 4) RELEASE = $( RELEASE) clean
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 4) RELEASE = $( RELEASE) defconfig
@echo " $( 3) =y " >> $( HV_OUT) -$( 1) /$( 2) /.config
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 4) RELEASE = $( RELEASE) oldconfig
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 4) RELEASE = $( RELEASE)
echo "building hypervisor as EFI executable..."
2019-10-24 14:22:42 +08:00
@if [ " $( 1) " = "uefi" ] ; then \
2019-10-11 14:07:17 +08:00
$( MAKE) -C $( T) /misc/efi-stub HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) SCENARIO = $( 4) EFI_OBJDIR = $( HV_OUT) -$( 1) /$( 2) /$( EFI_OUT) ; \
2019-09-27 17:15:36 +08:00
fi
e n d e f
d e f i n e i n s t a l l _ a c r n
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 3) RELEASE = $( RELEASE) install
2019-10-24 14:22:42 +08:00
@if [ " $( 1) " = "uefi" ] ; then \
2019-10-11 14:07:17 +08:00
$( MAKE) -C $( T) /misc/efi-stub HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 3) RELEASE = $( RELEASE) EFI_OBJDIR = $( HV_OUT) -$( 1) /$( 2) /$( EFI_OUT) install; \
2019-09-27 17:15:36 +08:00
fi
e n d e f
d e f i n e i n s t a l l _ a c r n _ d e b u g
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 3) RELEASE = $( RELEASE) install-debug
2019-10-24 14:22:42 +08:00
@if [ " $( 1) " = "uefi" ] ; then \
2019-10-11 14:07:17 +08:00
$( MAKE) -C $( T) /misc/efi-stub HV_OBJDIR = $( HV_OUT) -$( 1) /$( 2) BOARD = $( 2) FIRMWARE = $( 1) SCENARIO = $( 3) RELEASE = $( RELEASE) EFI_OBJDIR = $( HV_OUT) -$( 1) /$( 2) /$( EFI_OUT) install-debug; \
2019-09-27 17:15:36 +08:00
fi
e n d e f
2019-09-19 23:07:10 +08:00
hypervisor :
2019-11-09 11:18:58 +08:00
@if [ " $( SCENARIO) " != "sdc" ] && [ " $( SCENARIO) " != "sdc2" ] && [ " $( SCENARIO) " != "industry" ] \
&& [ " $( SCENARIO) " != "logical_partition" ] && [ " $( SCENARIO) " != "hybrid" ] ; then \
echo " SCENARIO < $( SCENARIO) > is not supported. " ; exit 1; \
2019-09-17 11:55:47 +08:00
fi
2019-12-09 12:13:49 +08:00
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) clean;
2019-11-10 09:05:41 +08:00
@if [ -f $( DEFAULT_MENU_CONFIG_FILE) ] ; then \
mkdir -p $( HV_OUT) && cp $( DEFAULT_MENU_CONFIG_FILE) $( HV_OUT) /.config; \
else \
2019-11-11 23:46:29 +08:00
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) BOARD_FILE = $( BOARD_FILE) SCENARIO_FILE = $( SCENARIO_FILE) defconfig; \
2019-12-09 12:13:49 +08:00
echo " CONFIG_ $( shell echo $( SCENARIO) | tr a-z A-Z) =y " >> $( HV_OUT) /.config; \
2019-11-10 09:05:41 +08:00
if [ " $( CONFIG_XML_ENABLED) " = "true" ] ; then \
echo "CONFIG_ENFORCE_VALIDATED_ACPI_INFO=y" >> $( HV_OUT) /.config; \
2019-11-19 17:19:41 +08:00
fi ; \
2019-09-17 11:55:47 +08:00
fi
2019-11-11 23:46:29 +08:00
$( MAKE) -C $( T) /hypervisor HV_OBJDIR = $( HV_OUT) BOARD_FILE = $( BOARD_FILE) SCENARIO_FILE = $( SCENARIO_FILE)
2019-11-09 11:18:58 +08:00
#ifeq ($(FIRMWARE),uefi)
@if [ " $( SCENARIO) " != "logical_partition" ] && [ " $( SCENARIO) " != "hybrid" ] ; then \
echo "building hypervisor as EFI executable..." ; \
$( MAKE) -C $( T) /misc/efi-stub HV_OBJDIR = $( HV_OUT) EFI_OBJDIR = $( HV_OUT) /$( EFI_OUT) ; \
fi
#endif
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) ; \
if [ -f $( DEFAULT_MENU_CONFIG_FILE) ] ; then \
echo "Hypervisor configuration is based on menuconfig file: ./hypervisor/build/.config;" >> $( HV_CFG_LOG) ; \
else \
echo " Hypervisor configuration is based on ./hypervisor/arch/x86/Kconfig and ./hypervisor/arch/x86/configs/ $( BOARD) .config; " >> $( HV_CFG_LOG) ; \
fi ; \
if [ " $( CONFIG_XML_ENABLED) " = "true" ] ; then \
echo " VM configuration is based on $( BOARD_FILE) and $( SCENARIO_FILE) ; " >> $( HV_CFG_LOG) ; \
else \
echo "VM configuration is based on current code base;" >> $( HV_CFG_LOG) ; \
fi ; \
if [ -f $( GENED_ACPI_INFO_HEADER) ] && [ " $( CONFIG_XML_ENABLED) " != "true" ] ; then \
echo -e " \033[33mWarning: The platform ACPI info is based on acrn-config generated $( GENED_ACPI_INFO_HEADER) , please make sure its validity.\033[0m " >> $( HV_CFG_LOG) ; \
fi
@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) RELEASE = $( RELEASE) clean
$( 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)
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-12-18 13:42:53 +08:00
i f e q ( $( FIRMWARE ) , u e f i )
2019-10-11 14:07:17 +08:00
$( MAKE) -C $( T) /misc/efi-stub HV_OBJDIR = $( HV_OUT) BOARD = $( BOARD) FIRMWARE = $( FIRMWARE) SCENARIO = $( SCENARIO) EFI_OBJDIR = $( HV_OUT) /$( EFI_OUT) all install
2018-12-10 19:32:42 +08:00
e n d i f
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
i f e q ( $( FIRMWARE ) , u e f i )
2019-10-11 14:07:17 +08:00
$( MAKE) -C $( T) /misc/efi-stub HV_OBJDIR = $( HV_OUT) BOARD = $( BOARD) FIRMWARE = $( FIRMWARE) SCENARIO = $( SCENARIO) EFI_OBJDIR = $( HV_OUT) /$( EFI_OUT) all install-debug
2019-01-22 11:12:53 +08:00
e n d i f
2019-09-27 17:15:36 +08:00
apl-mrb-sbl-sdc :
$( call build_acrn,sbl,apl-mrb,CONFIG_SDC,sdc)
apl-up2-sbl-sdc :
$( call build_acrn,sbl,apl-up2,CONFIG_SDC,sdc)
kbl-nuc-i7-uefi-industry :
2019-10-30 13:35:57 +08:00
$( call build_acrn,uefi,nuc7i7dnb,CONFIG_INDUSTRY,industry)
2019-10-08 13:29:55 +08:00
apl-up2-uefi-hybrid :
$( call build_acrn,uefi,apl-up2,CONFIG_HYBRID,hybrid)
2019-09-27 17:15:36 +08:00
2019-10-08 13:29:55 +08:00
sbl-hypervisor : apl -mrb -sbl -sdc \
apl-up2-sbl-sdc \
kbl-nuc-i7-uefi-industry \
apl-up2-uefi-hybrid
2019-09-27 17:15:36 +08:00
apl-mrb-sbl-sdc-install :
$( call install_acrn,sbl,apl-mrb,sdc)
apl-up2-sbl-sdc-install :
$( call install_acrn,sbl,apl-up2,sdc)
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
2019-10-08 13:29:55 +08:00
sbl-hypervisor-install : apl -mrb -sbl -sdc -install \
apl-up2-sbl-sdc-install \
kbl-nuc-i7-uefi-industry-install \
apl-up2-uefi-hybrid-install
2019-09-27 17:15:36 +08:00
apl-mrb-sbl-sdc-install-debug :
$( call install_acrn_debug,sbl,apl-mrb,sdc)
apl-up2-sbl-sdc-install-debug :
$( call install_acrn_debug,sbl,apl-up2,sdc)
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
2019-10-08 13:29:55 +08:00
sbl-hypervisor-install-debug : apl -mrb -sbl -sdc -install -debug \
apl-up2-sbl-sdc-install-debug \
kbl-nuc-i7-uefi-industry-install-debug \
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