diff --git a/misc/acrn-config/config_app/templates/scenario.html b/misc/acrn-config/config_app/templates/scenario.html index aae16535c..9eca87ed2 100644 --- a/misc/acrn-config/config_app/templates/scenario.html +++ b/misc/acrn-config/config_app/templates/scenario.html @@ -169,8 +169,7 @@ readonly>{{sub_elem_text}} {% else %} + id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">{{sub_elem_text}} {% endif %} {% else %} diff --git a/misc/acrn-config/library/board_cfg_lib.py b/misc/acrn-config/library/board_cfg_lib.py index 6c52a3b26..05f78985f 100644 --- a/misc/acrn-config/library/board_cfg_lib.py +++ b/misc/acrn-config/library/board_cfg_lib.py @@ -199,10 +199,20 @@ def get_rootfs(config_file): :param config_file: it is a file which contain board information :return: rootfs partition list """ - rootfs_lines = get_info(config_file, "", "") root_dev_list = [] + rootfs_lines = get_info(config_file, "", "") + + # none 'BLOCK_DEVICE_INFO' tag + if rootfs_lines == None: + return root_dev_list for rootfs_line in rootfs_lines: + if not rootfs_line: + break + + if not common.handle_root_dev(rootfs_line): + continue + root_dev = rootfs_line.strip().split(':')[0] root_dev_list.append(root_dev) diff --git a/misc/acrn-config/library/common.py b/misc/acrn-config/library/common.py index c237a2021..762d82717 100644 --- a/misc/acrn-config/library/common.py +++ b/misc/acrn-config/library/common.py @@ -285,9 +285,8 @@ def get_post_vm_count(config_file): # get post vm number root = get_config_root(config_file) for item in root: - for sub in item: - if sub.tag == "load_order" and sub.text == "POST_LAUNCHED_VM": - post_vm_count += 1 + if item.tag == "uos": + post_vm_count += 1 return post_vm_count @@ -307,22 +306,23 @@ def get_tree_tag_val(config_file, tag_str): return False -def get_branch_tag(config_file, 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 tag_str: it is key of pattern to config file item - :return: value of tag_str item list - """ - tmp_tag = [] - root = get_config_root(config_file) - for item in root: - - for sub in item: - if sub.tag == tag_str: - tmp_tag.append(sub.text) - - return tmp_tag +#def get_spec_branch_tag(config_file, tag_str, p_id): +# """ +# 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 tag_str: it is key of pattern to config file item +# :return: value of tag_str item list +# """ +# tmp_tag = '' +# root = get_config_root(config_file) +# for item in root: +# if item.tag != 'vm' and item.attrib['id'] != str(p_id): +# continue +# for sub in item: +# if sub.tag == tag_str: +# tmp_tag = sub.text +# +# return tmp_tag def get_branch_tag_val(config_file, tag_str): @@ -342,6 +342,25 @@ def get_branch_tag_val(config_file, tag_str): return tmp_tag +def get_spec_branch_tag_val(config_file, tag_str, uos_id): + """ + 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 tag_str: it is key of pattern to config file item + :return: value of tag_str item list + """ + tmp_tag = '' + root = get_config_root(config_file) + for item in root: + if item.attrib['id'] != uos_id: + continue + for sub in item: + if sub.tag == tag_str: + tmp_tag = sub.text + + return tmp_tag + + def get_branch_tag_map(config_file, tag_str): """ This is get tag value by tag_str from config file @@ -363,6 +382,22 @@ def get_branch_tag_map(config_file, tag_str): return tmp_tag +def get_spec_leaf_tag_val(config_file, branch_tag, tag_str, uos_id): + tmp_tag = '' + root = get_config_root(config_file) + for item in root: + if item.attrib['id'] != uos_id: + continue + for sub in item: + if sub.tag == branch_tag: + for leaf in sub: + if leaf.tag == tag_str and tag_str != "guest_flag" and tag_str != "pcpu_id" and\ + sub.tag != "vuart": + tmp_tag = leaf.text + continue + return tmp_tag + + def get_leaf_tag_val(config_file, branch_tag, tag_str): """ This is get tag value by tag_str from config file @@ -534,6 +569,18 @@ def vm_pre_launch_cnt(config_file): return pre_launch_cnt +def handle_root_dev(line): + """Handle if it match root device information pattern + :param line: one line of information which had decoded to 'ASCII' + """ + for root_type in line.split(): + # only support ext4 rootfs + if "ext4" in root_type: + return True + + return False + + def get_max_clos(board_file): """ Parse CLOS information diff --git a/misc/acrn-config/library/scenario_cfg_lib.py b/misc/acrn-config/library/scenario_cfg_lib.py index 053255be8..c2f66efd7 100644 --- a/misc/acrn-config/library/scenario_cfg_lib.py +++ b/misc/acrn-config/library/scenario_cfg_lib.py @@ -137,12 +137,19 @@ def get_rootdev_info(board_info): :return: root devices list """ rootdev_list = [] - rootdev_info = get_info(board_info, "", "") + rootdev_info = get_info(board_info, "", "") + + # none 'BLOCK_DEVICE_INFO' tag + if rootdev_info == None: + return rootdev_list for rootdev_line in rootdev_info: if not rootdev_line: break + if not common.handle_root_dev(rootdev_line): + continue + root_dev = rootdev_line.strip().split(':')[0] rootdev_list.append(root_dev) diff --git a/misc/acrn-config/scenario_config/vm_configurations_c.py b/misc/acrn-config/scenario_config/vm_configurations_c.py index 10d78af3e..dca2dc30c 100644 --- a/misc/acrn-config/scenario_config/vm_configurations_c.py +++ b/misc/acrn-config/scenario_config/vm_configurations_c.py @@ -218,7 +218,7 @@ def gen_sdc_source(vm_info, config): print("\t\t/* Allow SOS to reboot the host since " + "there is supposed to be the highest severity guest */", file=config) print("\t\t.guest_flags = {0},".format(sos_guest_flags), file=config) - if not vm_info.clos_set[0].strip(): + if vm_info.clos_set[0] == None or not vm_info.clos_set[0].strip(): print("\t\t.clos = {0}U,".format(0), file=config) else: print("\t\t.clos = {0}U,".format(vm_info.clos_set[0]), file=config) @@ -298,7 +298,7 @@ def gen_sdc2_source(vm_info, config): print("\t\t/* Allow SOS to reboot the host since " + "there is supposed to be the highest severity guest */", file=config) print("\t\t.guest_flags = {0},".format(sos_guest_flags), file=config) - if not vm_info.clos_set[0].strip(): + if vm_info.clos_set[0] == None or not vm_info.clos_set[0].strip(): print("\t\t.clos = {0}U,".format(0), file=config) else: print("\t\t.clos = {0}U,".format(vm_info.clos_set[0]), file=config) @@ -416,7 +416,7 @@ def gen_logical_partition_source(vm_info, config): print("\t\t.guest_flags = {0},".format(guest_flags), file=config) - if not vm_info.clos_set[i].strip(): + if vm_info.clos_set[i] == None or not vm_info.clos_set[i].strip(): print("\t\t.clos = {0}U,".format(0), file=config) else: print("\t\t.clos = {0}U,".format(vm_info.clos_set[i]), file=config) @@ -475,7 +475,7 @@ def gen_industry_source(vm_info, config): return err_dic print("\t\t") print("\t\t.guest_flags = {0},".format(sos_guest_flags), file=config) - if not vm_info.clos_set[i].strip(): + if vm_info.clos_set[i] == None or not vm_info.clos_set[i].strip(): print("\t\t.clos = {0}U,".format(0), file=config) else: print("\t\t.clos = {0}U,".format(vm_info.clos_set[i]), file=config) @@ -541,7 +541,7 @@ def gen_hybrid_source(vm_info, config): print("\t\t.guest_flags = {0},".format(sos_guest_flags), file=config) if i == 0: print("\t\t.pcpu_bitmap = VM0_CONFIG_PCPU_BITMAP,", file=config) - if not vm_info.clos_set[i].strip(): + if vm_info.clos_set[i] == None or not vm_info.clos_set[i].strip(): print("\t\t.clos = {0}U,".format(0), file=config) else: print("\t\t.clos = {0}U,".format(vm_info.clos_set[i]), file=config) diff --git a/misc/acrn-config/target/misc.py b/misc/acrn-config/target/misc.py index 908b0bf7c..9d6b41fe7 100644 --- a/misc/acrn-config/target/misc.py +++ b/misc/acrn-config/target/misc.py @@ -160,12 +160,12 @@ def dump_system_ram(config): print("", file=config) -def dump_root_dev(config): - """This will get available root device +def dump_block_dev(config): + """This will get available block device :param config: file pointer that opened for writing board config information """ cmd = 'blkid' - desc = 'ROOT_DEVICE_INFO' + desc = 'BLOCK_DEVICE_INFO' parser_lib.dump_execute(cmd, desc, config) print("", file=config) @@ -230,7 +230,7 @@ def generate_info(board_info): dump_system_ram(config) - dump_root_dev(config) + dump_block_dev(config) dump_ttys(config) diff --git a/misc/acrn-config/target/parser_lib.py b/misc/acrn-config/target/parser_lib.py index d0dce2ac9..4bb9d7d9e 100644 --- a/misc/acrn-config/target/parser_lib.py +++ b/misc/acrn-config/target/parser_lib.py @@ -131,7 +131,7 @@ def dump_execute(cmd, desc, config): if not ret: continue - if desc == "ROOT_DEVICE_INFO": + if desc == "BLOCK_DEVICE_INFO": ret = handle_root_dev(line) if not ret: continue diff --git a/misc/acrn-config/xmls/board-xmls/apl-mrb.xml b/misc/acrn-config/xmls/board-xmls/apl-mrb.xml index ff571282f..661d2bd9d 100644 --- a/misc/acrn-config/xmls/board-xmls/apl-mrb.xml +++ b/misc/acrn-config/xmls/board-xmls/apl-mrb.xml @@ -293,11 +293,11 @@ 100000000-27fffffff : System RAM - + /dev/mmcblk1p1: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4" PARTLABEL="sos_rootfs" PARTUUID="5bd5afa7-ab7e-46f3-85ad-0cfd285d5d76" /dev/mmcblk0p1: TYPE="ext4" /dev/sda3: TYPE="ext4" - + BDF:(00:18.0) seri:/dev/ttyS0 base:0xB3640000 irq:4 diff --git a/misc/acrn-config/xmls/board-xmls/apl-up2.xml b/misc/acrn-config/xmls/board-xmls/apl-up2.xml index 3cded9887..138998ee0 100644 --- a/misc/acrn-config/xmls/board-xmls/apl-up2.xml +++ b/misc/acrn-config/xmls/board-xmls/apl-up2.xml @@ -273,10 +273,10 @@ 100000000-17fffffff : System RAM - + /dev/mmcblk0p3: UUID="bb0d14f3-e780-41d9-bcca-6f3ef493216c" TYPE="ext4" PARTLABEL="primary" PARTUUID="87cd7180-6c0b-4bc9-a0d0-5406a95988cc" /dev/sda3: TYPE="ext4" - + BDF:(00:18.0) seri:/dev/ttyS0 base:0x91526000 irq:4 diff --git a/misc/acrn-config/xmls/board-xmls/nuc6cayh.xml b/misc/acrn-config/xmls/board-xmls/nuc6cayh.xml index c5e4bdc04..cc2c17bfa 100644 --- a/misc/acrn-config/xmls/board-xmls/nuc6cayh.xml +++ b/misc/acrn-config/xmls/board-xmls/nuc6cayh.xml @@ -231,9 +231,9 @@ 100000000-27fffffff : System RAM - + /dev/sda3: LABEL="root" UUID="b8352fb7-25f5-481d-aa6f-015a7c76c5aa" TYPE="ext4" PARTLABEL="/" PARTUUID="9a305316-3c78-436c-9c21-3be1b324428d" - + BDF:(00:18.0) seri:/dev/ttyS0 base:0x91420000 irq:4 diff --git a/misc/acrn-config/xmls/board-xmls/nuc7i7dnb.xml b/misc/acrn-config/xmls/board-xmls/nuc7i7dnb.xml index 0eb5fbc0c..93c9a025f 100644 --- a/misc/acrn-config/xmls/board-xmls/nuc7i7dnb.xml +++ b/misc/acrn-config/xmls/board-xmls/nuc7i7dnb.xml @@ -225,10 +225,10 @@ 100000000-2707fffff : System RAM - + /dev/nvme0n1p3: LABEL="root" UUID="deb9eba1-9ab6-4d1e-95b9-aa1d2f7b660e" TYPE="ext4" PARTLABEL="/" PARTUUID="80521cfb-cce4-4ccc-8cf8-46a045196c73" /dev/sda3: TYPE="ext4" - + BDF:(02:00.0) seri:/dev/ttyS0 base:0x3F8 irq:4