def create_commands(filenames, ipname, fwvol): """Create Commands for the merge and replace of firmware section.""" inputfiles, num_replace_files = sbrgn_image.ip_inputfiles(filenames, ipname) build_list = ip_options.get(ipname) # get the file name to be used to replace firmware volume ui_name = build_list[0][1] cmd_list = sbrgn_image.build_command_list(build_list, inputfiles, num_replace_files) cmd = replace_ip(filenames[len(filenames) - 1], fwvol, ui_name, filenames[0]) cmd_list.append(cmd) return cmd_list
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)