示例#1
0
def parse_boot_info():

    err_dic = {}
    vm_types = []

    (err_dic, scenario_name) = board_cfg_lib.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")
        (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_rootfs = board_cfg_lib.get_sub_leaf_tag(
            board_cfg_lib.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):
        vm_type = board_cfg_lib.get_order_type_by_vmid(i)
        vm_types.append(vm_type)

    return (err_dic, sos_cmdlines, sos_rootfs, vuart0_dic, vuart1_dic,
            vm_types)
示例#2
0
def generate_file(config):
    """Start to generate board.c
    :param config: it is a file pointer of board information for writing to
    """
    err_dic = {}
    print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
    pre_vm_cnt = board_cfg_lib.get_pre_launch_cnt(
        board_cfg_lib.SCENARIO_INFO_FILE)

    # read mem size from scenario.xml
    hpa_size_list = board_cfg_lib.get_sub_leaf_tag(
        board_cfg_lib.SCENARIO_INFO_FILE, "memory", "size")
    ret = board_cfg_lib.is_hpa_size(hpa_size_list)
    if not ret:
        board_cfg_lib.print_red("Unknow type of host physical address size",
                                err=True)
        err_dic[
            'board config: generate ve820.c failed'] = "Unknow type of host physical address size"
        return err_dic

    hpa_size = hpa_size_list[0]
    if pre_vm_cnt != 0 and ('0x' in hpa_size or '0X' in hpa_size):
        err_dic = ve820_per_launch(config, hpa_size)
    else:
        non_ve820_pre_launch(config)

    return err_dic
示例#3
0
def generate_file(config):
    """Start to generate board.c
    :param config: it is a file pointer of board information for writing to
    """
    err_dic = {}
    print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
    pre_vm_cnt = board_cfg_lib.get_pre_launch_cnt(
        board_cfg_lib.SCENARIO_INFO_FILE)

    # read mem size from scenario.xml
    hpa_size_list = board_cfg_lib.get_sub_leaf_tag(
        board_cfg_lib.SCENARIO_INFO_FILE, "memory", "size")
    ret = board_cfg_lib.is_hpa_size(hpa_size_list)
    if not ret:
        board_cfg_lib.print_red("Unknow type of host physical address size",
                                err=True)
        err_dic[
            'board config: generate ve820.c failed'] = "Unknow type of host physical address size"
        return err_dic

    # read HPA2 mem size from scenario.xml
    hpa2_size_list = board_cfg_lib.get_sub_leaf_tag(
        board_cfg_lib.SCENARIO_INFO_FILE, "memory", "size_hpa2")
    ret = board_cfg_lib.is_hpa_size(hpa2_size_list)
    if not ret:
        board_cfg_lib.print_red(
            "Unknow type of second host physical address size", err=True)
        err_dic[
            'board config: generate ve820.c failed'] = "Unknow type of second host physical address size"
        return err_dic

    # HPA size for both VMs should have valid length.
    for i in range(pre_vm_cnt):
        if hpa_size_list[i] == '0x0' or hpa_size_list[i] == '0X0':
            board_cfg_lib.print_red("HPA size should not be zero", err=True)
            err_dic[
                'board config: generate ve820.c failed'] = "HPA size should not be zero"
            return err_dic

    if pre_vm_cnt != 0:
        err_dic = ve820_per_launch(config, hpa_size_list, hpa2_size_list)
    else:
        non_ve820_pre_launch(config)

    return err_dic