Example #1
0
def generate_sub_region_fv(
        image_file,
        sub_region_descriptor,
        output_fv_file=os.path.join(os.path.curdir, "SubRegion.FV")
):

    sub_region_image = "SubRegionImage.bin"
    fv_ffs_file_list = []

    for file_index, ffs_file in enumerate(sub_region_descriptor.ffs_files):

        sbrgn_image.generate_sub_region_image(ffs_file, sub_region_image)
        ip, ip_ops = sbrgn_image.ip_info_from_guid(ffs_file.ffs_guid)

        # if ffs GUID is not found exit.
        if ip is None:
            print("FFS GUIS {} not found".format(ffs_file.ffs_guid))
            exit(-1)

        # Inputfiles should be minium of two files to work with function.
        inputfiles, num_files = sbrgn_image.ip_inputfiles(
            [None, sub_region_image],
            ip
            )

        cmds = sbrgn_image.build_command_list(ip_ops, inputfiles, num_files)

        if utils.execute_cmds(logger, cmds) == 1:
            exit(-1)

        ffs_file_path = "tmp.{}.ffs".format(file_index)
        os.rename("tmp.ffs", ffs_file_path)
        fv_ffs_file_list.append(ffs_file_path)

        fv_cmd_list = sbrgn_image.build_fv_from_ffs_files(
                     sub_region_descriptor,
                     output_fv_file,
                     fv_ffs_file_list)

    if utils.execute_cmds(logger, fv_cmd_list) == 1:
        print("Error generating FV File")
        exit(-1)
Example #2
0
def merge_and_replace(filename, guid_values, fwvol):
    """Perform merge and replace of section using different executable."""

    cmds = create_commands(filename, guid_values, fwvol)

    logger.info("\nStarting merge and replacement of section")

    # Merging and Replacing
    status = utils.execute_cmds(logger, cmds)

    return status
Example #3
0
        gen_cap_cmd += [
            "--signer-private-cert", args.OpenSslSignerPrivateCertFile
        ]
        gen_cap_cmd += ["--other-public-cert", args.OpenSslOtherPublicCertFile]
        gen_cap_cmd += [
            "--trusted-public-cert", args.OpenSslTrustedPublicCertFile
        ]
    elif any([
            args.OpenSslSignerPrivateCertFile, args.OpenSslOtherPublicCertFile,
            args.OpenSslTrustedPublicCertFile
    ]):
        print('All-or-none of the certificate files must be provided.')
        exit(2)

    gen_cap_cmd += ["-v"]

    if args.SigningToolPath is not None:
        gen_cap_cmd += ["--signing-tool-path", args.SigningToolPath]
    gen_cap_cmd += [sub_region_fv_file]

    status = utils.execute_cmds(logger, [gen_cap_cmd])

    # Creating list of files to remove
    to_remove = glob.glob("tmp.*")
    to_remove.extend(glob.glob("SubRegionFv.*"))
    to_remove.append("SubRegionImage.bin")

    utils.cleanup(to_remove)

    sys.exit(status)