mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-18 19:57:31 +00:00
config_tools: use ASL_COMPILER as the path to the "iasl" compiler
At build time (on the *dev* machine), config_tools depends on "iasl" to generate the binary of ACPI tables for pre-launched VMs. This patch does: - pass ASL_COMPILER to config_tools By default, ASL_COMPILER is initialized by "which iasl" at build time. User could override it by specifying ASL_COMPILER as the build option, like below: make BOARD=xxxx SCENARIO=yyyy ASL_COMPILER=/usr/local/bin/iasl - use ASL_COMPILER as the path to the "iasl" compiler in config_tools v1 -> v2: - add a check to make sure ASL_COMPILER is initialized to a value 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:
parent
59b6d7b404
commit
3f0fae81b2
2
Makefile
2
Makefile
@ -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)
|
||||
HV_MAKEOPTS := -C $(T)/hypervisor BOARD=$(BOARD) SCENARIO=$(SCENARIO) HV_OBJDIR=$(HV_OUT) RELEASE=$(RELEASE) ASL_COMPILER=$(ASL_COMPILER)
|
||||
|
||||
board_inspector:
|
||||
@if [ -x "$(DPKG_BIN)" ]; then \
|
||||
|
@ -11,6 +11,7 @@ GCC_MINOR=$(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
|
||||
#enable stack overflow check
|
||||
STACK_PROTECTOR := 1
|
||||
|
||||
ASL_COMPILER ?= $(shell which iasl)
|
||||
BASEDIR := $(shell pwd)
|
||||
HV_OBJDIR ?= $(CURDIR)/build
|
||||
HV_MODDIR ?= $(HV_OBJDIR)/modules
|
||||
@ -397,7 +398,7 @@ VERSION := $(HV_OBJDIR)/include/version.h
|
||||
PRE_BUILD_DIR := ../misc/hv_prebuild
|
||||
|
||||
.PHONY: all
|
||||
all: pre_build $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
|
||||
all: env_check pre_build $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
|
||||
|
||||
install: $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
|
||||
install -D $(HV_OBJDIR)/$(HV_FILE).32.out $(DESTDIR)$(libdir)/acrn/$(HV_FILE).$(BOARD).$(SCENARIO).32.out
|
||||
@ -413,13 +414,19 @@ install-debug: $(HV_OBJDIR)/$(HV_FILE).map $(HV_OBJDIR)/$(HV_FILE).out
|
||||
install -D $(HV_OBJDIR)/$(HV_FILE).out $(DESTDIR)$(libdir)/acrn/$(HV_FILE).$(BOARD).$(SCENARIO).out
|
||||
install -D $(HV_OBJDIR)/$(HV_FILE).map $(DESTDIR)$(libdir)/acrn/$(HV_FILE).$(BOARD).$(SCENARIO).map
|
||||
|
||||
.PHONY: env_check
|
||||
env_check:
|
||||
ifndef ASL_COMPILER
|
||||
$(error Please either install "iasl" or provide the path to "iasl" by using the ASL_COMPILER variable)
|
||||
endif
|
||||
|
||||
.PHONY: pre_build
|
||||
pre_build: $(HV_CONFIG_H) $(HV_CONFIG_TIMESTAMP)
|
||||
@echo "Start pre-build static check ..."
|
||||
$(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)
|
||||
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)
|
||||
@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
|
||||
|
||||
|
@ -46,7 +46,7 @@ def move_rtct_ssram_and_bin_entries(rtct, new_base_addr, new_area_max_size):
|
||||
rtct.header.checksum = 0
|
||||
rtct.header.checksum = 0 - sum(bytes(rtct))
|
||||
|
||||
def asl_to_aml(dest_vm_acpi_path, dest_vm_acpi_bin_path, scenario_etree, allocation_etree):
|
||||
def asl_to_aml(dest_vm_acpi_path, dest_vm_acpi_bin_path, scenario_etree, allocation_etree, iasl_path):
|
||||
'''
|
||||
compile asl code of ACPI table to aml code.
|
||||
:param dest_vm_acpi_path: the path of the asl code of ACPI tables
|
||||
@ -61,7 +61,7 @@ def asl_to_aml(dest_vm_acpi_path, dest_vm_acpi_bin_path, scenario_etree, allocat
|
||||
for acpi_table in ACPI_TABLE_LIST:
|
||||
if acpi_table[0] == 'tpm2.asl':
|
||||
if 'tpm2.asl' in os.listdir(dest_vm_acpi_path):
|
||||
rc = exec_command('iasl {}'.format(acpi_table[0]))
|
||||
rc = exec_command('{} {}'.format(iasl_path, acpi_table[0]))
|
||||
if rc == 0 and os.path.isfile(os.path.join(dest_vm_acpi_path, acpi_table[1])):
|
||||
shutil.move(os.path.join(dest_vm_acpi_path, acpi_table[1]),
|
||||
os.path.join(dest_vm_acpi_bin_path, acpi_table[1]))
|
||||
@ -86,7 +86,7 @@ def asl_to_aml(dest_vm_acpi_path, dest_vm_acpi_bin_path, scenario_etree, allocat
|
||||
fp.close()
|
||||
else:
|
||||
if acpi_table[0].endswith(".asl"):
|
||||
rc = exec_command('iasl {}'.format(acpi_table[0]))
|
||||
rc = exec_command('{} {}'.format(iasl_path, acpi_table[0]))
|
||||
if rc == 0 and os.path.isfile(os.path.join(dest_vm_acpi_path, acpi_table[1])):
|
||||
shutil.move(os.path.join(dest_vm_acpi_path, acpi_table[1]),
|
||||
os.path.join(dest_vm_acpi_bin_path, acpi_table[1]))
|
||||
@ -218,7 +218,7 @@ def exec_command(cmd):
|
||||
return rc
|
||||
|
||||
|
||||
def check_iasl():
|
||||
def check_iasl(iasl_path):
|
||||
'''
|
||||
check iasl installed
|
||||
:return: True if iasl installed.
|
||||
@ -226,7 +226,7 @@ def check_iasl():
|
||||
try:
|
||||
p_version = 'ASL+ Optimizing Compiler/Disassembler version'
|
||||
min_version = 20190703
|
||||
output = subprocess.check_output(['iasl', '-v']).decode('utf8')
|
||||
output = subprocess.check_output([iasl_path, '-v']).decode('utf8')
|
||||
if p_version in output:
|
||||
try:
|
||||
for line in output.split('\n'):
|
||||
@ -269,7 +269,7 @@ def main(args):
|
||||
if os.path.isdir(DEST_ACPI_BIN_PATH):
|
||||
shutil.rmtree(DEST_ACPI_BIN_PATH)
|
||||
|
||||
if not check_iasl():
|
||||
if not check_iasl(args.iasl_path):
|
||||
print("Please install iasl tool with version >= 20190703 from https://www.acpica.org/downloads before ACPI generation.")
|
||||
return 1
|
||||
|
||||
@ -279,7 +279,7 @@ def main(args):
|
||||
dest_vm_acpi_path = os.path.join(DEST_ACPI_PATH, config)
|
||||
dest_vm_acpi_bin_path = os.path.join(DEST_ACPI_BIN_PATH, config)
|
||||
os.makedirs(dest_vm_acpi_bin_path)
|
||||
if asl_to_aml(dest_vm_acpi_path, dest_vm_acpi_bin_path, scenario_etree, allocation_etree):
|
||||
if asl_to_aml(dest_vm_acpi_path, dest_vm_acpi_bin_path, scenario_etree, allocation_etree, args.iasl_path):
|
||||
return 1
|
||||
aml_to_bin(dest_vm_acpi_path, dest_vm_acpi_bin_path, config+'.bin', board_etree, scenario_etree, allocation_etree)
|
||||
|
||||
@ -287,11 +287,13 @@ 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]"
|
||||
"[ --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("--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/")
|
||||
|
Loading…
Reference in New Issue
Block a user