Esempio n. 1
0
def isEnabled(env,
        featureflags=[],
        disable_featureflags=DEFAULT_DISABLE_FEATURE_FLAGS,
        policy_file=DEFAULT_POLICY_FILE):

    build_policy = BuildPolicy(policy_file, env)
    return _isPolicyRun(env, disable_featureflags, build_policy) and build_policy.isFeatureEnabled(featureflags)
Esempio n. 2
0
def getUnsignedInstallPath(env,
        install_base_dir,
        featureflags=DEFAULT_INSTALL_DEFAULT_FLAGS,
        disable_featureflags=DEFAULT_DISABLE_FEATURE_FLAGS,
        policy_file=DEFAULT_POLICY_FILE):

    build_policy = BuildPolicy(policy_file, env)

    unsigned_install_path = install_base_dir
    if _isPolicyRun(env, disable_featureflags, build_policy) and build_policy.isFeatureEnabled(featureflags):
        unsigned_install_path = os.path.normpath(os.path.join(install_base_dir, "unsigned"))

    return unsigned_install_path
Esempio n. 3
0
def install(env,
            sectools_install_base_dir,
            sectools_builder_output,
            alternate_source=None,
            install_file_name=None,
            msmid=None,
            msmid_jtagid_dict=None,
            msm_jtag_mapping_file=DEFAULT_MSM_JTAG_MAPPING_FILE,
            disable_buildtags=DEFAULT_DISABLE_FEATURE_FLAGS,
            policy_file=DEFAULT_POLICY_FILE):

    rt_list = []
    build_policy = BuildPolicy(policy_file, env)

    if _isPolicyRun(env, disable_buildtags, build_policy,
                    sectools_builder_output) is True:

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

        rt_list = _execute_install(
            env,
            sectools_install_base_dir=sectools_install_base_dir,
            install_file_name=install_file_name,
            sectools_builder_output=sectools_builder_output,
            alternate_source=alternate_source,
            msmid_jtagid_dict=msmid_jtagid_dict,
            build_policy=build_policy)

    return rt_list
Esempio n. 4
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):
    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 = []
        rt_installed_list = []
        for sec_image_policy in build_policy.enabled_sec_image_policies:
            rtt = _execute_sec_image_policy(
                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,
                sec_image_policy=sec_image_policy)
            rt_signed_list.append(rtt)
        rt = 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,
                alternate_source=None,
                msmid_jtagid_dict=msmid_jtagid_dict,
                build_policy=build_policy)
            rt = rt_installed_list

    return rt
Esempio n. 5
0
def install(env,
            sectools_install_base_dir,
            sectools_builder_output,
            install_file_name=None,
            disable_buildtags=DEFAULT_DISABLE_FEATURE_FLAGS,
            policy_file=DEFAULT_POLICY_FILE):

    rt_list = []
    build_policy = BuildPolicy(policy_file, env)

    if _isPolicyRun(env, disable_buildtags, build_policy,
                    sectools_builder_output) is True:
        rt_list = _execute_install(
            env,
            sectools_install_base_dir=sectools_install_base_dir,
            install_file_name=install_file_name,
            sectools_builder_output=sectools_builder_output[0],
            build_policy=build_policy)

    return rt_list
Esempio n. 6
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