From 678d8c1665b969264abc13dbd10c80c9cf4dd8dc Mon Sep 17 00:00:00 2001 From: dongshen Date: Sun, 23 Aug 2020 17:05:46 -0700 Subject: [PATCH] acrn-config: fix build issue for mrb board Add missing IVSHMEM tag in mrb board xml file to fix build issue Correct misspelled function name Use better error messages Tracked-On: #5221 Signed-off-by: dongshen --- misc/acrn-config/library/hv_cfg_lib.py | 4 +-- .../scenario_config/scenario_cfg_gen.py | 34 ++++++++++--------- .../scenario_config/vm_configurations_c.py | 4 +-- .../config-xmls/apl-mrb/logical_partition.xml | 4 +++ 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/misc/acrn-config/library/hv_cfg_lib.py b/misc/acrn-config/library/hv_cfg_lib.py index 0d7a7d2a2..230320802 100644 --- a/misc/acrn-config/library/hv_cfg_lib.py +++ b/misc/acrn-config/library/hv_cfg_lib.py @@ -30,10 +30,10 @@ def empty_check(val, prime_item, item, sub_item=''): if not val or val == None: if sub_item: key = 'hv,{},{},{}'.format(prime_item, item, sub_item) - ERR_LIST[key] = "{} should not empty".format(sub_item) + ERR_LIST[key] = "{} should not be empty".format(sub_item) else: key = 'hv,{},{}'.format(prime_item, item) - ERR_LIST[key] = "{} should not empty".format(item) + ERR_LIST[key] = "{} should not be empty".format(item) return True return False diff --git a/misc/acrn-config/scenario_config/scenario_cfg_gen.py b/misc/acrn-config/scenario_config/scenario_cfg_gen.py index b924d05f2..f3adba141 100755 --- a/misc/acrn-config/scenario_config/scenario_cfg_gen.py +++ b/misc/acrn-config/scenario_config/scenario_cfg_gen.py @@ -27,8 +27,10 @@ GEN_FILE = ["vm_configurations.h", "vm_configurations.c", "pci_dev.c", ".config" def get_scenario_item_values(board_info, scenario_info): """ - Get items which capable multi select for user - :param board_info: it is a file what contains board information for script to read from + Glue code to provide user selectable options to config UI tool. + Return a dictionary of key-value pairs containing features and corresponding lists of + user selectable values to the config UI tool. + :param board_info: file that contains board information """ hv_cfg_lib.ERR_LIST = {} scenario_item_values = {} @@ -41,7 +43,7 @@ def get_scenario_item_values(board_info, scenario_info): common.get_vm_num(scenario_info) common.get_vm_types() - # pre scenario + # per scenario guest_flags = copy.deepcopy(common.GUEST_FLAG) guest_flags.remove('0UL') scenario_item_values['vm,vm_type'] = scenario_cfg_lib.LOAD_VM_TYPE @@ -52,7 +54,7 @@ def get_scenario_item_values(board_info, scenario_info): scenario_item_values["vm,os_config,kern_type"] = scenario_cfg_lib.KERN_TYPE_LIST scenario_item_values.update(scenario_cfg_lib.avl_vuart_ui_select(scenario_info)) - # pre board_private + # board (scenario_item_values["vm,board_private,rootfs"], num) = board_cfg_lib.get_rootfs(board_info) scenario_item_values["hv,DEBUG_OPTIONS,RELEASE"] = hv_cfg_lib.N_Y @@ -82,10 +84,10 @@ def get_scenario_item_values(board_info, scenario_info): def validate_scenario_setting(board_info, scenario_info): """ - This is validate the data setting from scenario xml - :param board_info: it is a file what contains board information for script to read from - :param scenario_info: it is a file what user have already setting to - :return: return a dictionary contain errors + Validate settings in scenario xml + :param board_info: board file + :param scenario_info: scenario file + :return: return a dictionary that contains errors """ hv_cfg_lib.ERR_LIST = {} scenario_cfg_lib.ERR_LIST = {} @@ -111,8 +113,8 @@ def validate_scenario_setting(board_info, scenario_info): 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 + Generate board related source code + :param args: command line args """ err_dic = {} @@ -139,13 +141,13 @@ def main(args): return err_dic if common.VM_COUNT > common.MAX_VM_NUM: - err_dic['vm count'] = "The vm count in config xml should be less or equal {}!".format(common.MAX_VM_NUM) + err_dic['vm count'] = "Number of VMs in scenario xml file should be no greater than {}!".format(common.MAX_VM_NUM) return err_dic - # check if this is the scenario config which matched board info + # check if this is the scenario config which matches board info (err_dic, status) = common.is_config_file_match() if not status: - err_dic['scenario config'] = "The board xml and scenario xml should be matched!" + err_dic['scenario config'] = "The board xml file does not match scenario xml file!" return err_dic if params['--out']: @@ -170,7 +172,7 @@ def main(args): get_scenario_item_values(params['--board'], params['--scenario']) (err_dic, scenario_items) = validate_scenario_setting(params['--board'], params['--scenario']) if err_dic: - common.print_red("Validate the scenario item failure", err=True) + common.print_red("Scenario xml file validation failed:", err=True) return err_dic # generate board defconfig @@ -199,9 +201,9 @@ def main(args): pci_dev_c.generate_file(scenario_items['vm'], config) if not err_dic: - print("Scenario configurations for {} is generated successfully.".format(scenario)) + print("Scenario configuration files were created successfully.") else: - print("Scenario configurations for {} is generated failed.".format(scenario)) + print("Failed to create scenario configuration files.") return err_dic diff --git a/misc/acrn-config/scenario_config/vm_configurations_c.py b/misc/acrn-config/scenario_config/vm_configurations_c.py index 30f9b5aef..94cfd9f3e 100644 --- a/misc/acrn-config/scenario_config/vm_configurations_c.py +++ b/misc/acrn-config/scenario_config/vm_configurations_c.py @@ -382,7 +382,7 @@ def gen_post_launch_vm(vm_type, vm_i, scenario_items, config): print("\t},", file=config) -def pre_launch_definiation(vm_info, config): +def pre_launch_definition(vm_info, config): for vm_i,vm_type in common.VM_TYPES.items(): if scenario_cfg_lib.VM_DB[vm_type]['load_type'] not in ["PRE_LAUNCHED_VM", "POST_LAUNCHED_VM"]: @@ -404,7 +404,7 @@ def generate_file(scenario_items, config): gen_source_header(config) for vm_i,pci_dev_num in vm_info.cfg_pci.pci_dev_num.items(): if pci_dev_num >= 2: - pre_launch_definiation(vm_info, config) + pre_launch_definition(vm_info, config) break print("struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {", file=config) diff --git a/misc/vm_configs/xmls/config-xmls/apl-mrb/logical_partition.xml b/misc/vm_configs/xmls/config-xmls/apl-mrb/logical_partition.xml index 76cae9fff..9c24efc7b 100644 --- a/misc/vm_configs/xmls/config-xmls/apl-mrb/logical_partition.xml +++ b/misc/vm_configs/xmls/config-xmls/apl-mrb/logical_partition.xml @@ -27,6 +27,10 @@ y n n + + n + +