config_tools: verify "iasl" version against IASL_MIN_VER

To avoid hardcoding the minimum "iasl" version in multiple places, IASL_MIN_VER
is defined in the top-level Makefile and is passed to config_tools.

This patch verifies "iasl" version against IASL_MIN_VER directly in
config_tools.

Tracked-On: #7880

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Shiqing Gao 2022-07-04 15:07:28 +08:00 committed by acrnsi-robot
parent 3f0fae81b2
commit 3eb1237db3
3 changed files with 11 additions and 6 deletions

View File

@ -97,7 +97,7 @@ all: hypervisor devicemodel tools
python3 misc/packaging/gen_acrn_deb.py acrn_all $(ROOT_OUT) --version=$(FULL_VERSION) --board_name="$$DEB_BOARD" --scenario="$$DEB_SCENARIO"; \
fi
HV_MAKEOPTS := -C $(T)/hypervisor BOARD=$(BOARD) SCENARIO=$(SCENARIO) HV_OBJDIR=$(HV_OUT) RELEASE=$(RELEASE) ASL_COMPILER=$(ASL_COMPILER)
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)
board_inspector:
@if [ -x "$(DPKG_BIN)" ]; then \

View File

@ -12,6 +12,7 @@ GCC_MINOR=$(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
STACK_PROTECTOR := 1
ASL_COMPILER ?= $(shell which iasl)
IASL_MIN_VER ?= "20190703"
BASEDIR := $(shell pwd)
HV_OBJDIR ?= $(CURDIR)/build
HV_MODDIR ?= $(HV_OBJDIR)/modules
@ -426,7 +427,7 @@ pre_build: $(HV_CONFIG_H) $(HV_CONFIG_TIMESTAMP)
$(MAKE) -C $(PRE_BUILD_DIR) BOARD=$(BOARD) SCENARIO=$(SCENARIO) TARGET_DIR=$(HV_CONFIG_DIR)
@$(HV_OBJDIR)/hv_prebuild_check.out
@echo "generate the binary of ACPI tables for pre-launched VMs ..."
python3 ../misc/config_tools/acpi_gen/bin_gen.py --board $(HV_OBJDIR)/.board.xml --scenario $(HV_OBJDIR)/.scenario.xml --asl $(HV_CONFIG_DIR) --out $(HV_OBJDIR) --iasl_path $(ASL_COMPILER)
python3 ../misc/config_tools/acpi_gen/bin_gen.py --board $(HV_OBJDIR)/.board.xml --scenario $(HV_OBJDIR)/.scenario.xml --asl $(HV_CONFIG_DIR) --out $(HV_OBJDIR) --iasl_path $(ASL_COMPILER) --iasl_min_ver $(IASL_MIN_VER)
@echo "generate the serial configuration file for service VM ..."
python3 ../misc/config_tools/service_vm_config/serial_config.py --allocation $(HV_OBJDIR)/configs/allocation.xml --scenario $(HV_OBJDIR)/.scenario.xml --out $(HV_OBJDIR)/serial.conf

View File

@ -218,20 +218,21 @@ def exec_command(cmd):
return rc
def check_iasl(iasl_path):
def check_iasl(iasl_path, iasl_min_ver):
'''
check iasl installed
:return: True if iasl installed.
'''
try:
p_version = 'ASL+ Optimizing Compiler/Disassembler version'
min_version = 20190703
min_version = int(iasl_min_ver)
output = subprocess.check_output([iasl_path, '-v']).decode('utf8')
if p_version in output:
try:
for line in output.split('\n'):
if line.find(p_version) >= 0:
version = int(line.split(p_version)[1].strip())
print('iasl version is {}'.format(version))
if version >= min_version:
return True
except:
@ -269,8 +270,9 @@ def main(args):
if os.path.isdir(DEST_ACPI_BIN_PATH):
shutil.rmtree(DEST_ACPI_BIN_PATH)
if not check_iasl(args.iasl_path):
print("Please install iasl tool with version >= 20190703 from https://www.acpica.org/downloads before ACPI generation.")
if not check_iasl(args.iasl_path, args.iasl_min_ver):
print('Please install iasl tool with version >= {} from https://www.acpica.org/downloads '
'before ACPI generation.'.format(args.iasl_min_ver))
return 1
for config in os.listdir(DEST_ACPI_PATH):
@ -288,12 +290,14 @@ def main(args):
if __name__ == '__main__':
parser = argparse.ArgumentParser(usage="python3 bin_gen.py --board [board] --scenario [scenario]"
" --iasl_path [the path to the iasl compiler]"
" --iasl_min_ver [the minimum iasl version]"
"[ --out [output dir of acpi ASL code]]",
description="the tool to generate ACPI binary for Pre-launched VMs")
parser.add_argument("--board", required=True, help="the XML file summarizing characteristics of the target board")
parser.add_argument("--scenario", required=True, help="the XML file specifying the scenario to be set up")
parser.add_argument("--asl", default=None, help="the input folder to store the ACPI ASL code. ")
parser.add_argument("--iasl_path", default=None, help="the path to the iasl compiler.")
parser.add_argument("--iasl_min_ver", default=None, help="the minimum iasl version.")
parser.add_argument("--out", default=None, help="the output folder to store the ACPI binary code. "
"If not specified, the path for the binary code is"
"build/hypervisor/acpi/")