diff --git a/misc/acrn-config/board_config/acpi_platform_h.py b/misc/acrn-config/board_config/acpi_platform_h.py
index 1896191e0..425ab802e 100644
--- a/misc/acrn-config/board_config/acpi_platform_h.py
+++ b/misc/acrn-config/board_config/acpi_platform_h.py
@@ -4,6 +4,7 @@
#
import board_cfg_lib
+import common
PLATFORM_HEADER = r"""/* DO NOT MODIFY THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
*/
@@ -88,7 +89,7 @@ def multi_info_parser(config, default_platform, msg_s, msg_e):
write_direct = ['PM1A_EVT_ACCESS_SIZE', 'PM1A_EVT_ADDRESS', 'PM1A_CNT_ADDRESS']
pm_ac_sz = OverridAccessSize()
- multi_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, msg_s, msg_e)
+ multi_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, msg_s, msg_e)
# S3/S5 not supported by BIOS
sx_name = msg_s.split('_')[0].strip('<')
@@ -129,7 +130,7 @@ def write_direct_info_parser(config, msg_s, msg_e):
:param msg_s: it is a pattern of key stings what start to match from board information
:param msg_e: it is a pattern of key stings what end to match from board information
"""
- vector_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, msg_s, msg_e)
+ vector_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, msg_s, msg_e)
for vector in vector_lines:
print("{}".format(vector.strip()), file=config)
@@ -145,7 +146,7 @@ def drhd_info_parser(config):
prev_num = 0
drhd_lines = board_cfg_lib.get_info(
- board_cfg_lib.BOARD_INFO_FILE, "", "")
+ common.BOARD_INFO_FILE, "", "")
# write DRHD
print("/* DRHD of DMAR */", file=config)
diff --git a/misc/acrn-config/board_config/board_c.py b/misc/acrn-config/board_config/board_c.py
index cc5e807f5..772f25796 100644
--- a/misc/acrn-config/board_config/board_c.py
+++ b/misc/acrn-config/board_config/board_c.py
@@ -7,6 +7,7 @@ import sys
import enum
import subprocess
import board_cfg_lib
+import common
class RDT(enum.Enum):
L2 = 0
@@ -28,7 +29,7 @@ MSR_IA32_L3_MASK_END = 0x00000D0F
def gen_dmar_structure(config):
"""Generate dmar structure information"""
- dmar_info_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "", "")
+ dmar_info_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "", "")
drhd_cnt = 0
drhd_dev_scope_cnt = []
dev_scope_type = []
@@ -119,7 +120,7 @@ def gen_rdt_res(config):
err_dic = {}
rdt_res_str =""
res_present = [0, 0, 0]
- (rdt_resources, rdt_res_clos_max, rdt_res_mask_max) = board_cfg_lib.clos_info_parser(board_cfg_lib.BOARD_INFO_FILE)
+ (rdt_resources, rdt_res_clos_max, rdt_res_mask_max) = board_cfg_lib.clos_info_parser(common.BOARD_INFO_FILE)
if len(rdt_res_clos_max) != 0:
common_clos_max = min(rdt_res_clos_max)
else:
@@ -159,7 +160,7 @@ def gen_rdt_res(config):
print("};\n", file=config)
res_present[RDT.MBA.value] = 1
else:
- err_dic['board config: generate board.c failed'] = "The input of {} was corrupted!".format(board_cfg_lib.BOARD_INFO_FILE)
+ err_dic['board config: generate board.c failed'] = "The input of {} was corrupted!".format(common.BOARD_INFO_FILE)
return err_dic
if res_present[RDT.L2.value] == 0:
@@ -201,9 +202,9 @@ def gen_px_cx(config):
:param config: it is a file pointer of board information for writing to
"""
cpu_brand_lines = board_cfg_lib.get_info(
- board_cfg_lib.BOARD_INFO_FILE, "", "")
- cx_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "", "")
- px_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "", "")
+ common.BOARD_INFO_FILE, "", "")
+ cx_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "", "")
+ px_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "", "")
gen_single_data(cx_lines, 'c', config)
gen_single_data(px_lines, 'p', config)
diff --git a/misc/acrn-config/board_config/board_cfg_gen.py b/misc/acrn-config/board_config/board_cfg_gen.py
index 9e0728bfb..3e8c5fea6 100755
--- a/misc/acrn-config/board_config/board_cfg_gen.py
+++ b/misc/acrn-config/board_config/board_cfg_gen.py
@@ -15,8 +15,8 @@ import misc_cfg_h
import new_board_kconfig
import common
-ACRN_PATH = board_cfg_lib.SOURCE_ROOT_DIR
-ACRN_CONFIG_TARGET = ACRN_PATH + "hypervisor/arch/x86/configs/"
+ACRN_PATH = common.SOURCE_ROOT_DIR
+ACRN_CONFIG_DEF = ACRN_PATH + "hypervisor/arch/x86/configs/"
ACRN_DEFAULT_ACPI = ACRN_PATH + "hypervisor/include/arch/x86/default_acpi_info.h"
GEN_FILE = ["pci_devices.h", "board.c", "_acpi_info.h", "misc_cfg.h", ".config"]
@@ -27,48 +27,50 @@ def main(args):
This is main function to start generate source code related with board
:param args: it is a command line args for the script
"""
- global ACRN_CONFIG_TARGET
err_dic = {}
- (err_dic, board_info_file, scenario_info_file, output_folder) = board_cfg_lib.get_param(args)
+ (err_dic, board_info_file, scenario_info_file, output_folder) = common.get_param(args)
if err_dic:
return err_dic
if output_folder:
- ACRN_CONFIG_TARGET = os.path.abspath(output_folder) + '/'
+ common.ACRN_CONFIG_TARGET = os.path.abspath(output_folder) + '/'
# check env
- err_dic = board_cfg_lib.prepare()
+ err_dic = common.prepare()
if err_dic:
return err_dic
common.BOARD_INFO_FILE = board_info_file
common.SCENARIO_INFO_FILE = scenario_info_file
common.get_vm_num(scenario_info_file)
- board_cfg_lib.BOARD_INFO_FILE = board_info_file
- board_cfg_lib.SCENARIO_INFO_FILE = scenario_info_file
- board_cfg_lib.get_vm_num(scenario_info_file)
# get board name
- (err_dic, board) = board_cfg_lib.get_board_name()
+ (err_dic, board) = common.get_board_name()
if err_dic:
return err_dic
board_cfg_lib.BOARD_NAME = board
# check if this is the scenario config which matched board info
- (err_dic, status) = board_cfg_lib.is_config_file_match()
+ (err_dic, status) = common.is_config_file_match()
if not status:
err_dic['board config: Not match'] = "The board xml and scenario xml should be matched"
return err_dic
- board_dir = ACRN_CONFIG_TARGET + board + '/'
- board_cfg_lib.mkdir(board_dir)
+ if common.ACRN_CONFIG_TARGET:
+ board_dir = common.ACRN_CONFIG_TARGET + board + '/'
+ else:
+ board_dir = ACRN_CONFIG_DEF + board + '/'
+ common.mkdir(board_dir)
config_pci = board_dir + GEN_FILE[0]
config_board = board_dir + GEN_FILE[1]
config_acpi = board_dir + board + GEN_FILE[2]
config_misc_cfg = board_dir + GEN_FILE[3]
- config_board_kconfig = ACRN_CONFIG_TARGET + board + GEN_FILE[4]
+ if common.ACRN_CONFIG_TARGET:
+ config_board_kconfig = common.ACRN_CONFIG_TARGET + board + GEN_FILE[4]
+ else:
+ config_board_kconfig = ACRN_CONFIG_DEF + board + GEN_FILE[4]
# generate board.c
with open(config_board, 'w+') as config:
@@ -108,7 +110,7 @@ def ui_entry_api(board_info, scenario_info):
arg_list = ['board_cfg_gen.py', '--board', board_info, '--scenario', scenario_info]
- err_dic = board_cfg_lib.prepare()
+ err_dic = common.prepare()
if err_dic:
return err_dic
@@ -123,4 +125,4 @@ if __name__ == '__main__':
err_dic = main(ARGS)
if err_dic:
for err_k, err_v in err_dic.items():
- board_cfg_lib.print_red("{}: {}".format(err_k, err_v), err=True)
+ common.print_red("{}: {}".format(err_k, err_v), err=True)
diff --git a/misc/acrn-config/board_config/misc_cfg_h.py b/misc/acrn-config/board_config/misc_cfg_h.py
index b7a4a321f..c80ec90a0 100644
--- a/misc/acrn-config/board_config/misc_cfg_h.py
+++ b/misc/acrn-config/board_config/misc_cfg_h.py
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: BSD-3-Clause
#
+import common
import board_cfg_lib
MISC_CFG_HEADER = """
@@ -49,21 +50,21 @@ def parse_boot_info():
err_dic = {}
vm_types = []
- (err_dic, scenario_name) = board_cfg_lib.get_scenario_name()
+ (err_dic, scenario_name) = common.get_scenario_name()
if err_dic:
return (err_dic, sos_cmdlines, sos_rootfs, vuart0_dic, vuart1_dic, vm_types)
if scenario_name != "logical_partition":
- sos_cmdlines = board_cfg_lib.get_sub_leaf_tag(board_cfg_lib.SCENARIO_INFO_FILE, "board_private", "bootargs")
- sos_rootfs = board_cfg_lib.get_sub_leaf_tag(board_cfg_lib.SCENARIO_INFO_FILE, "board_private", "rootfs")
+ sos_cmdlines = common.get_sub_leaf_tag(common.SCENARIO_INFO_FILE, "board_private", "bootargs")
+ sos_rootfs = common.get_sub_leaf_tag(common.SCENARIO_INFO_FILE, "board_private", "rootfs")
(err_dic, vuart0_dic, vuart1_dic) = board_cfg_lib.get_board_private_vuart("board_private", "console")
else:
- sos_cmdlines = board_cfg_lib.get_sub_leaf_tag(board_cfg_lib.SCENARIO_INFO_FILE, "os_config", "bootargs")
+ sos_cmdlines = common.get_sub_leaf_tag(common.SCENARIO_INFO_FILE, "os_config", "bootargs")
- sos_rootfs = board_cfg_lib.get_sub_leaf_tag(board_cfg_lib.SCENARIO_INFO_FILE, "os_config", "rootfs")
+ sos_rootfs = common.get_sub_leaf_tag(common.SCENARIO_INFO_FILE, "os_config", "rootfs")
(err_dic, vuart0_dic, vuart1_dic) = board_cfg_lib.get_board_private_vuart("os_config", "console")
- for i in range(board_cfg_lib.VM_COUNT):
+ for i in range(common.VM_COUNT):
vm_type = board_cfg_lib.get_order_type_by_vmid(i)
vm_types.append(vm_type)
@@ -77,7 +78,7 @@ def find_hi_mmio_window(config):
mmio_max = 0
is_hi_mmio = False
- iomem_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "", "")
+ iomem_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "", "")
for line in iomem_lines:
if "PCI Bus" not in line:
@@ -85,12 +86,12 @@ def find_hi_mmio_window(config):
line_start_addr = int(line.split('-')[0], 16)
line_end_addr = int(line.split('-')[1].split()[0], 16)
- if line_start_addr < board_cfg_lib.SIZE_4G and line_end_addr < board_cfg_lib.SIZE_4G:
+ if line_start_addr < common.SIZE_4G and line_end_addr < common.SIZE_4G:
continue
- elif line_start_addr < board_cfg_lib.SIZE_4G and line_end_addr >= board_cfg_lib.SIZE_4G:
+ elif line_start_addr < common.SIZE_4G and line_end_addr >= common.SIZE_4G:
i_cnt += 1
is_hi_mmio = True
- mmio_min = board_cfg_lib.SIZE_4G
+ mmio_min = common.SIZE_4G
mmio_max = line_end_addr
continue
@@ -116,7 +117,7 @@ def generate_file(config):
Start to generate board.c
:param config: it is a file pointer of board information for writing to
"""
- board_cfg_lib.get_valid_irq(board_cfg_lib.BOARD_INFO_FILE)
+ board_cfg_lib.get_valid_irq(common.BOARD_INFO_FILE)
# get cpu processor list
cpu_list = board_cfg_lib.get_processor_info()
@@ -143,14 +144,14 @@ def generate_file(config):
# parse the setting ttys vuatx dic: {vmid:base/irq}
vuart0_setting = Vuart()
vuart1_setting = Vuart()
- vuart0_setting = board_cfg_lib.get_vuart_info_id(board_cfg_lib.SCENARIO_INFO_FILE, 0)
- vuart1_setting = board_cfg_lib.get_vuart_info_id(board_cfg_lib.SCENARIO_INFO_FILE, 1)
+ vuart0_setting = board_cfg_lib.get_vuart_info_id(common.SCENARIO_INFO_FILE, 0)
+ vuart1_setting = board_cfg_lib.get_vuart_info_id(common.SCENARIO_INFO_FILE, 1)
# sos command lines information
sos_cmdlines = [i for i in sos_cmdlines[0].split() if i != '']
# get native rootfs list from board_info.xml
- (root_devs, root_dev_num) = board_cfg_lib.get_rootfs(board_cfg_lib.BOARD_INFO_FILE)
+ (root_devs, root_dev_num) = board_cfg_lib.get_rootfs(common.BOARD_INFO_FILE)
# start to generate misc_cfg.h
print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
@@ -160,7 +161,7 @@ def generate_file(config):
print("#define MAX_PCPU_NUM\t{}U".format(max_cpu_num), file=config)
# set macro of max clos number
- (_, clos_max, _) = board_cfg_lib.clos_info_parser(board_cfg_lib.BOARD_INFO_FILE)
+ (_, clos_max, _) = board_cfg_lib.clos_info_parser(common.BOARD_INFO_FILE)
if len(clos_max) != 0:
common_clos_max = min(clos_max)
else:
diff --git a/misc/acrn-config/board_config/new_board_kconfig.py b/misc/acrn-config/board_config/new_board_kconfig.py
index 273475bd2..88c8d9544 100644
--- a/misc/acrn-config/board_config/new_board_kconfig.py
+++ b/misc/acrn-config/board_config/new_board_kconfig.py
@@ -6,6 +6,7 @@
import sys
import subprocess
import board_cfg_lib
+import common
DESC = """# Board defconfig generated by acrn-config tool
@@ -26,7 +27,7 @@ VM_NUM_MAP_TOTAL_HV_RAM_SIZE = {
7:0x10E00000,
}
-MEM_ALIGN = 2 * board_cfg_lib.SIZE_M
+MEM_ALIGN = 2 * common.SIZE_M
def find_avl_memory(ram_range, hpa_size, hv_start_offset):
@@ -62,7 +63,7 @@ def get_ram_range():
ram_range = {}
io_mem_lines = board_cfg_lib.get_info(
- board_cfg_lib.BOARD_INFO_FILE, "", "")
+ common.BOARD_INFO_FILE, "", "")
for line in io_mem_lines:
if 'System RAM' not in line:
@@ -81,9 +82,9 @@ def get_serial_type():
ttys_value = ''
# Get ttySx information from board config file
- ttys_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "", "")
+ ttys_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "", "")
- (err_dic, scenario_name) = board_cfg_lib.get_scenario_name()
+ (err_dic, scenario_name) = common.get_scenario_name()
if scenario_name == "logical_partition":
ttyn = 'ttyS0'
else:
@@ -112,7 +113,7 @@ def is_rdt_supported():
"""
Returns True if platform supports RDT else False
"""
- (rdt_resources, rdt_res_clos_max, _) = board_cfg_lib.clos_info_parser(board_cfg_lib.BOARD_INFO_FILE)
+ (rdt_resources, rdt_res_clos_max, _) = board_cfg_lib.clos_info_parser(common.BOARD_INFO_FILE)
if len(rdt_resources) == 0 or len(rdt_res_clos_max) == 0:
return False
else:
@@ -127,10 +128,10 @@ def generate_file(config):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}
- if board_cfg_lib.VM_COUNT in list(VM_NUM_MAP_TOTAL_HV_RAM_SIZE.keys()):
- hv_ram_size = VM_NUM_MAP_TOTAL_HV_RAM_SIZE[board_cfg_lib.VM_COUNT]
+ if common.VM_COUNT in list(VM_NUM_MAP_TOTAL_HV_RAM_SIZE.keys()):
+ hv_ram_size = VM_NUM_MAP_TOTAL_HV_RAM_SIZE[common.VM_COUNT]
else:
- board_cfg_lib.print_red("VM num should not be greater than 8", err=True)
+ common.print_red("VM num should not be greater than 8", err=True)
err_dic["board config: total vm number error"] = "VM num should not be greater than 8"
return err_dic
@@ -144,10 +145,10 @@ def generate_file(config):
total_size = reserved_ram + hv_ram_size
avl_start_addr = find_avl_memory(ram_range, str(total_size), hv_start_offset)
hv_start_addr = int(avl_start_addr, 16) + int(hex(reserved_ram), 16)
- hv_start_addr = board_cfg_lib.round_up(hv_start_addr, MEM_ALIGN)
+ hv_start_addr = common.round_up(hv_start_addr, MEM_ALIGN)
# add config scenario name
- (err_dic, scenario_name) = board_cfg_lib.get_scenario_name()
+ (err_dic, scenario_name) = common.get_scenario_name()
print("{}".format(DESC), file=config)
print("CONFIG_{}=y".format(scenario_name.upper()), file=config)
diff --git a/misc/acrn-config/board_config/pci_devices_h.py b/misc/acrn-config/board_config/pci_devices_h.py
index d7e8f3f40..8a474964b 100644
--- a/misc/acrn-config/board_config/pci_devices_h.py
+++ b/misc/acrn-config/board_config/pci_devices_h.py
@@ -5,6 +5,7 @@
import collections
import board_cfg_lib
+import common
PCI_HEADER = r"""
#ifndef PCI_DEVICES_H_
@@ -59,11 +60,11 @@ def get_size(line):
# get size string from format, Region n: Memory at x ... [size=NK]
size_str = line.split()[-1].strip(']').split('=')[1]
if 'G' in size_str:
- size = int(size_str.strip('G')) * board_cfg_lib.SIZE_G
+ size = int(size_str.strip('G')) * common.SIZE_G
elif 'M' in size_str:
- size = int(size_str.strip('M')) * board_cfg_lib.SIZE_M
+ size = int(size_str.strip('M')) * common.SIZE_M
elif 'K' in size_str:
- size = int(size_str.strip('K')) * board_cfg_lib.SIZE_K
+ size = int(size_str.strip('K')) * common.SIZE_K
else:
size = int(size_str)
@@ -74,7 +75,7 @@ def remap_bar_addr_to_high(bar_addr, line):
"""Generate vbar address"""
global HI_MMIO_OFFSET
size = get_size(line)
- cur_addr = board_cfg_lib.round_up(bar_addr, size)
+ cur_addr = common.round_up(bar_addr, size)
HI_MMIO_OFFSET = cur_addr + size
return cur_addr
@@ -88,7 +89,7 @@ def parser_pci():
cal_sub_pci_name = []
pci_lines = board_cfg_lib.get_info(
- board_cfg_lib.BOARD_INFO_FILE, "", "")
+ common.BOARD_INFO_FILE, "", "")
for line in pci_lines:
tmp_bar_mem = Bar_Mem()
@@ -100,7 +101,7 @@ def parser_pci():
bar_addr = int(get_value_after_str(line, "at"), 16)
bar_num = line.split()[1].strip(':')
- if bar_addr >= board_cfg_lib.SIZE_4G or bar_addr < board_cfg_lib.SIZE_2G:
+ if bar_addr >= common.SIZE_4G or bar_addr < common.SIZE_2G:
if not tmp_bar_attr.remappable:
continue
@@ -155,7 +156,7 @@ def write_pbdf(i_cnt, bdf, bar_attr, config):
tmp_sub_name = "_".join(bar_attr.name.split()).upper()
else:
if '-' in bar_attr.name:
- tmp_sub_name = board_cfg_lib.undline_name(bar_attr.name) + "_" + str(i_cnt)
+ tmp_sub_name = common.undline_name(bar_attr.name) + "_" + str(i_cnt)
else:
tmp_sub_name = "_".join(bar_attr.name.split()).upper() + "_" + str(i_cnt)
@@ -185,7 +186,7 @@ def write_vbar(i_cnt, bdf, pci_bar_dic, bar_attr, config):
align = ' ' * 48
ptdev_mmio_str = ''
- tmp_sub_name = board_cfg_lib.undline_name(bar_attr.name) + "_" + str(i_cnt)
+ tmp_sub_name = common.undline_name(bar_attr.name) + "_" + str(i_cnt)
if bdf in pci_bar_dic.keys():
bar_list = list(pci_bar_dic[bdf].keys())
bar_len = len(bar_list)
diff --git a/misc/acrn-config/library/board_cfg_lib.py b/misc/acrn-config/library/board_cfg_lib.py
index 39e81695b..b9e3374b7 100644
--- a/misc/acrn-config/library/board_cfg_lib.py
+++ b/misc/acrn-config/library/board_cfg_lib.py
@@ -7,18 +7,10 @@ import re
import sys
import common
-SOURCE_ROOT_DIR = common.SOURCE_ROOT_DIR
BOARD_NAME = ''
-BOARD_INFO_FILE = "board_info.txt"
-SCENARIO_INFO_FILE = ""
-
BIOS_INFO = ['BIOS Information', 'Vendor:', 'Version:', 'Release Date:', 'BIOS Revision:']
-
BASE_BOARD = ['Base Board Information', 'Manufacturer:', 'Product Name:', 'Version:']
-BOARD_NAMES = ['apl-mrb', 'apl-nuc', 'apl-up2', 'dnv-cb2', 'nuc6cayh',
- 'nuc7i7dnb', 'kbl-nuc-i7', 'icl-rvp']
-
LEGACY_TTYS = {
'ttyS0':'0x3F8',
'ttyS1':'0x2F8',
@@ -28,8 +20,6 @@ LEGACY_TTYS = {
NATIVE_CONSOLE_DIC = {}
VALID_LEGACY_IRQ = []
-VM_COUNT = 0
-
ERR_LIST = {}
HEADER_LICENSE = common.open_license() + "\n"
@@ -40,69 +30,6 @@ KNOWN_HIDDEN_PDEVS_BOARD_DB = {
'apl-up2':['00:0d:0'],
}
-SIZE_K = common.SIZE_K
-SIZE_M = common.SIZE_M
-SIZE_2G = common.SIZE_2G
-SIZE_4G = common.SIZE_4G
-SIZE_G = common.SIZE_G
-
-def prepare():
- """ check environment """
- return common.prepare()
-
-
-def print_yel(msg, warn=False):
- """
- Print the message with color of yellow
- :param msg: the stings which will be output to STDOUT
- :param warn: the condition if needs to be output the color of yellow with 'Warning'
- """
- common.print_yel(msg, warn)
-
-
-def print_red(msg, err=False):
- """
- Print the message with color of red
- :param msg: the stings which will be output to STDOUT
- :param err: the condition if needs to be output the color of red with 'Error'
- """
- common.print_red(msg, err)
-
-
-def get_board_name():
- """
- Get board name from board.xml at fist line
- :param board_info: it is a file what contains board information for script to read from
- """
- return common.get_board_name()
-
-
-def get_scenario_name():
- """
- Get scenario name from scenario.xml at fist line
- :param scenario_info: it is a file what contains board information for script to read from
- """
- return common.get_scenario_name()
-
-
-def is_config_file_match():
-
- return common.is_config_file_match()
-
-
-def usage(file_name):
- """ This is usage for how to use this tool """
- common.usage(file_name)
-
-
-def get_param(args):
- """
- Get the script parameters from command line
- :param args: this the command line of string for the script without script name
- """
- return common.get_param(args)
-
-
def get_info(board_info, msg_s, msg_e):
"""
Get information which specify by argument
@@ -145,8 +72,8 @@ def handle_bios_info(config):
Handle bios information
:param config: it is a file pointer of bios information for writing to
"""
- bios_lines = get_info(BOARD_INFO_FILE, "", "")
- board_lines = get_info(BOARD_INFO_FILE, "", "")
+ bios_lines = get_info(common.BOARD_INFO_FILE, "", "")
+ board_lines = get_info(common.BOARD_INFO_FILE, "", "")
print("/*", file=config)
if not bios_lines or not board_lines:
@@ -212,17 +139,6 @@ def get_max_clos_mask(board_file):
return list(re.split(', |\s |,', rdt_res)), list(map(int, rdt_res_clos_max.split(','))), list(re.split(', |\s |,', rdt_res_mask_max))
-def get_sub_leaf_tag(config_file, branch_tag, tag_str=''):
- """
- This is get tag value by tag_str from config file
- :param config_file: it is a file what contains information for script to read from
- :param branch_tag: it is key of patter to config file branch tag item
- :param tag_str: it is key of pattern to config file leaf tag item
- :return: value of tag_str item
- """
- return common.get_sub_leaf_tag(config_file, branch_tag, tag_str)
-
-
def get_rootfs(config_file):
"""
This will get rootfs partition from board information
@@ -254,23 +170,13 @@ def clos_info_parser(board_info):
return get_max_clos_mask(board_info)
-def get_vm_num(config_file):
- """
- This is get vm count
- :param config_file: it is a file what contains vm information for script to read from
- :return: number of vm
- """
- global VM_COUNT
- VM_COUNT = common.get_vm_num(config_file)
-
-
def get_order_type_by_vmid(idx):
"""
This is get pre launched vm count
:param idx: index of vm id
:return: vm type of index to vmid
"""
- (err_dic, order_type) = common.get_load_order_by_vmid(SCENARIO_INFO_FILE, VM_COUNT, idx)
+ (err_dic, order_type) = common.get_load_order_by_vmid(common.SCENARIO_INFO_FILE, common.VM_COUNT, idx)
if err_dic:
ERR_LIST.update(err_dic)
@@ -304,7 +210,7 @@ def alloc_irq():
def get_valid_console():
""" Get valid console with mapping {ttyS:irq} returned """
- used_console_lines = get_info(BOARD_INFO_FILE, "", "")
+ used_console_lines = get_info(common.BOARD_INFO_FILE, "", "")
vuart0_valid_console = []
vuart1_valid_console = ['ttyS0', 'ttyS1', 'ttyS2', 'ttyS3', 'ttyS4', 'ttyS5', 'ttyS6', 'ttyS7']
@@ -348,12 +254,12 @@ def parser_vuart_console():
3. ttyS2
"""
ttys_n = ''
- (err_dic, scenario_name) = get_scenario_name()
+ (err_dic, scenario_name) = common.get_scenario_name()
if scenario_name != "logical_partition":
- ttys = get_sub_leaf_tag(SCENARIO_INFO_FILE, "board_private", "console")
+ ttys = common.get_sub_leaf_tag(common.SCENARIO_INFO_FILE, "board_private", "console")
else:
- ttys = get_sub_leaf_tag(SCENARIO_INFO_FILE, "os_config", "console")
+ ttys = common.get_sub_leaf_tag(common.SCENARIO_INFO_FILE, "os_config", "console")
if not ttys or ttys[0] == None:
return (err_dic, ttys_n)
@@ -383,7 +289,7 @@ def get_board_private_vuart(branch_tag, tag_console):
if ttys_n:
- (vuart0_valid_console, vuart1_valid_console, show_vuart1) = console_to_show(BOARD_INFO_FILE)
+ (vuart0_valid_console, vuart1_valid_console, show_vuart1) = console_to_show(common.BOARD_INFO_FILE)
# VUART0
if ttys_n not in list(NATIVE_CONSOLE_DIC.keys()):
@@ -467,7 +373,7 @@ def get_processor_info():
"""
processor_list = []
tmp_list = []
- processor_info = get_info(BOARD_INFO_FILE, "", "")
+ processor_info = get_info(common.BOARD_INFO_FILE, "", "")
if not processor_info:
key = "CPU PROCESSOR_INFO error:"
@@ -578,22 +484,3 @@ def get_pci_info(board_info):
pci_bdf_vpid[bdf_str] = vid_pid
return (pci_desc, pci_bdf_vpid)
-
-
-def undline_name(name):
- """
- This convert name which has contain '-' to '_'
- :param name: name which contain '-' and ' '
- :return: name_str which contain'_'
- """
- return common.undline_name(name)
-
-
-def round_up(addr, mem_align):
- """Keep memory align"""
- return common.round_up(addr, mem_align)
-
-
-def mkdir(path):
-
- common.mkdir(path)
diff --git a/misc/acrn-config/library/common.py b/misc/acrn-config/library/common.py
index 045e89c95..5acd680ac 100644
--- a/misc/acrn-config/library/common.py
+++ b/misc/acrn-config/library/common.py
@@ -10,6 +10,7 @@ import shutil
import subprocess
import xml.etree.ElementTree as ET
+ACRN_CONFIG_TARGET = ''
SOURCE_ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../')
HV_LICENSE_FILE = SOURCE_ROOT_DIR + 'misc/acrn-config/library/hypervisor_license'
@@ -258,6 +259,7 @@ def get_vm_num(config_file):
:param config_file: it is a file what contains information for script to read from
:return: total vm number
"""
+ global VM_COUNT
vm_count = 0
root = get_config_root(config_file)
for item in root: