コード例 #1
0
def _isPolicyRun(env, disable_buildtags, build_policy, source=[]):
    isPolicyRun = False

    util = BuilderUtil(env)

    if (disable_buildtags is None or util.isKeyEnable(disable_buildtags) is False) and \
        build_policy.enabled_sec_image_policies != []:
        isPolicyRun = True
    else:
        enabled_policy_ids=[]
        for sec_image_policy in build_policy.enabled_sec_image_policies:
            enabled_policy_ids.append(sec_image_policy.id)
        util.printinfo("sectools is not run for {0} due to build tags constraint.".format(source))
        util.printinfo("enabled_sec_image_policies = {0}".format(enabled_policy_ids))
        util.printinfo("disable_buildtags = %s" % disable_buildtags)

    return isPolicyRun
コード例 #2
0
def build(env,
          target_base_dir,
          source,
          sign_id,
          signer=None,
          qc_sign=False,
          jtag_id=None,
          soc_hw_version=None,
          soc_vers=None,
          app_id=None,
          sectools_install_base_dir=None,
          install_file_name=None,
          msmid=None,
          msmid_jtagid_dict=None,
          msm_jtag_mapping_file=DEFAULT_MSM_JTAG_MAPPING_FILE,
          disable_featureflags=DEFAULT_DISABLE_FEATURE_FLAGS,
          config=DEFAULT_CONFIG_FILE,
          policy_file=DEFAULT_POLICY_FILE,
          pilsplitter_target_base_dir=None,
          pilsplitter_path=DEFAULT_PILSPLITTER_PATH,
          pilsplitter_featureflag=[],
          image_entry=None,
          relocatable=False):
    rt = []

    util = BuilderUtil(env)

    source = util.envsubst(source)
    if type(source) is not list:
        source = [source]
    source_path = os.path.realpath(str(source[0]))
    policy_file = os.path.realpath(util.envsubst(policy_file))
    target_dir_realpath = os.path.realpath(util.envsubst(target_base_dir))
    build_policy = BuildPolicy(policy_file, env)
    if msmid_jtagid_dict is None:
        msmid_jtagid_dict = get_msm_jtag_dict_from_file(env, msmid)

    # don't do anything if none of the tags match.
    if _isPolicyRun(env, disable_featureflags, build_policy,
                    source_path) is True:
        rt_signed_list = _execute_sign(env,
                                       target_base_dir=target_dir_realpath,
                                       source=source_path,
                                       signer=signer,
                                       qc_sign=qc_sign,
                                       sign_id=sign_id,
                                       jtag_id=jtag_id,
                                       soc_hw_version=soc_hw_version,
                                       soc_vers=soc_vers,
                                       app_id=app_id,
                                       config=os.path.realpath(
                                           util.envsubst(config)),
                                       msmid_jtagid_dict=msmid_jtagid_dict,
                                       build_policy=build_policy,
                                       image_entry=image_entry,
                                       relocatable=relocatable)
        rt.append(rt_signed_list)

        if sectools_install_base_dir is not None:
            rt_installed_list = _execute_install(
                env,
                sectools_install_base_dir=sectools_install_base_dir,
                install_file_name=install_file_name,
                sectools_builder_output=rt_signed_list,
                build_policy=build_policy)
            rt.append(rt_installed_list)

        if (len(pilsplitter_featureflag) == 0 or
            util.isKeyEnable(pilsplitter_featureflag)) and \
            pilsplitter_target_base_dir is not None:
            rt_pilsplit_list = _execute_pilsplit(
                env,
                pilsplitter_target_base_dir=pilsplitter_target_base_dir,
                install_file_name=install_file_name,
                sectools_builder_output=rt_signed_list,
                build_policy=build_policy,
                pilsplitter_path=pilsplitter_path)
            rt.append(rt_pilsplit_list)

    return rt
コード例 #3
0
def build(env,
        target_base_dir,
        source,
        sign_id,
        jtagid=None,
        sectools_install_base_dir = None,
        install_file_name = None,
        msmid = None,
        msmid_jtagid_dict = None,
        msm_jtag_mapping_file=DEFAULT_MSM_JTAG_MAPPING_FILE,
        disable_featureflags=DEFAULT_DISABLE_FEATURE_FLAGS,
        config=DEFAULT_CONFIG_FILE,
        policy_file=DEFAULT_POLICY_FILE,
        pilsplitter_target_base_dir = None,
        pilsplitter_path = DEFAULT_PILSPLITTER_PATH,
        pilsplitter_featureflag = [],
        image_entry = None,
        relocatable = False):
    rt = []

    util = BuilderUtil(env)

    source = util.envsubst(source)
    if type(source) is not list:
        source = [source]
    source_str = os.path.realpath(str(source[0]))
    policy_file = os.path.realpath(util.envsubst(policy_file))
    target_dir_realpath = os.path.realpath(util.envsubst(target_base_dir))

    build_policy = BuildPolicy(policy_file, env)

    # don't do anything if none of the tags match.
    if _isPolicyRun(env, disable_featureflags, build_policy, source_str) is True:

        if msmid_jtagid_dict is None:
            msmid_jtagid_dict = get_msm_jtag_dict_from_file(env, msmid)


        rt_signed_list = _execute_sign(env,
                          target_base_dir=target_dir_realpath,
                          source=source_str,
                          sign_id=sign_id,
                          config=os.path.realpath(util.envsubst(config)),
                          msmid_jtagid_dict=msmid_jtagid_dict,
                          build_policy=build_policy,
                          image_entry=image_entry,
                          relocatable=relocatable)
        rt.append(rt_signed_list)

        if sectools_install_base_dir is not None:
            rt_installed_list = _execute_install(env,
                sectools_install_base_dir=sectools_install_base_dir,
                install_file_name=install_file_name,
                sectools_builder_output=rt_signed_list,
                msmid_jtagid_dict=msmid_jtagid_dict,
                build_policy=build_policy)
            rt.append(rt_installed_list)

        if (len(pilsplitter_featureflag) == 0 or
            util.isKeyEnable(pilsplitter_featureflag)) and \
            pilsplitter_target_base_dir is not None:
            rt_pilsplit_list = _execute_pilsplit(env,
                pilsplitter_target_base_dir=pilsplitter_target_base_dir,
                install_file_name=install_file_name,
                sectools_builder_output=rt_signed_list,
                msmid_jtagid_dict=msmid_jtagid_dict,
                build_policy=build_policy,
                pilsplitter_path=pilsplitter_path)
            rt.append(rt_pilsplit_list)


    return rt