Lines Matching refs:params
27 static int fit_add_file_data(struct image_tool_params *params, size_t size_inc, in fit_add_file_data() argument
37 tfd = mmap_fdt(params->cmdname, tmpfile, size_inc, &ptr, &sbuf, true, in fit_add_file_data()
42 if (params->keydest) { in fit_add_file_data()
45 destfd = mmap_fdt(params->cmdname, params->keydest, size_inc, in fit_add_file_data()
56 if (params->datafile || params->reset_timestamp) { in fit_add_file_data()
57 time_t time = imagetool_get_source_date(params->cmdname, in fit_add_file_data()
63 ret = fit_cipher_data(params->keydir, dest_blob, ptr, in fit_add_file_data()
64 params->comment, in fit_add_file_data()
65 params->require_keys, in fit_add_file_data()
66 params->engine_id, in fit_add_file_data()
67 params->cmdname); in fit_add_file_data()
71 ret = fit_add_verification_data(params->keydir, dest_blob, ptr, in fit_add_file_data()
72 params->comment, in fit_add_file_data()
73 params->require_keys, in fit_add_file_data()
74 params->engine_id, in fit_add_file_data()
75 params->cmdname); in fit_add_file_data()
92 static int fit_calc_size(struct image_tool_params *params) in fit_calc_size() argument
97 size = imagetool_get_filesize(params, params->datafile); in fit_calc_size()
102 if (params->fit_ramdisk) { in fit_calc_size()
103 size = imagetool_get_filesize(params, params->fit_ramdisk); in fit_calc_size()
109 for (cont = params->content_head; cont; cont = cont->next) { in fit_calc_size()
110 size = imagetool_get_filesize(params, cont->fname); in fit_calc_size()
124 static int fdt_property_file(struct image_tool_params *params, in fdt_property_file() argument
135 params->cmdname, fname, strerror(errno)); in fdt_property_file()
141 params->cmdname, fname, strerror(errno)); in fdt_property_file()
151 params->cmdname, fname, strerror(errno)); in fdt_property_file()
213 static int fit_write_images(struct image_tool_params *params, char *fdt) in fit_write_images() argument
224 typename = genimg_get_type_short_name(params->fit_image_type); in fit_write_images()
227 fdt_property_string(fdt, FIT_DESC_PROP, params->imagename); in fit_write_images()
230 genimg_get_arch_short_name(params->arch)); in fit_write_images()
232 genimg_get_os_short_name(params->os)); in fit_write_images()
234 genimg_get_comp_short_name(params->comp)); in fit_write_images()
235 fdt_property_u32(fdt, FIT_LOAD_PROP, params->addr); in fit_write_images()
236 fdt_property_u32(fdt, FIT_ENTRY_PROP, params->ep); in fit_write_images()
242 ret = fdt_property_file(params, fdt, FIT_DATA_PROP, params->datafile); in fit_write_images()
250 for (cont = params->content_head; cont; cont = cont->next) { in fit_write_images()
259 ret = fdt_property_file(params, fdt, FIT_DATA_PROP, in fit_write_images()
265 genimg_get_arch_short_name(params->arch)); in fit_write_images()
273 if (params->fit_ramdisk) { in fit_write_images()
278 genimg_get_os_short_name(params->os)); in fit_write_images()
280 genimg_get_arch_short_name(params->arch)); in fit_write_images()
282 ret = fdt_property_file(params, fdt, FIT_DATA_PROP, in fit_write_images()
283 params->fit_ramdisk); in fit_write_images()
304 static void fit_write_configs(struct image_tool_params *params, char *fdt) in fit_write_configs() argument
315 for (cont = params->content_head; cont; cont = cont->next) { in fit_write_configs()
325 typename = genimg_get_type_short_name(params->fit_image_type); in fit_write_configs()
330 if (params->fit_ramdisk) in fit_write_configs()
341 typename = genimg_get_type_short_name(params->fit_image_type); in fit_write_configs()
345 if (params->fit_ramdisk) in fit_write_configs()
355 static int fit_build_fdt(struct image_tool_params *params, char *fdt, int size) in fit_build_fdt() argument
366 genimg_get_type_name(params->fit_image_type)); in fit_build_fdt()
369 ret = fit_write_images(params, fdt); in fit_build_fdt()
372 fit_write_configs(params, fdt); in fit_build_fdt()
381 static int fit_build(struct image_tool_params *params, const char *fname) in fit_build() argument
388 size = fit_calc_size(params); in fit_build()
394 params->cmdname, size); in fit_build()
397 ret = fit_build_fdt(params, buf, size); in fit_build()
400 params->cmdname); in fit_build()
407 params->cmdname, fname, strerror(errno)); in fit_build()
413 params->cmdname, fname, strerror(errno)); in fit_build()
438 static int fit_extract_data(struct image_tool_params *params, const char *fname) in fit_extract_data() argument
452 align_size = params->bl_len ? params->bl_len : 4; in fit_extract_data()
453 fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false, false); in fit_extract_data()
494 if (params->external_offset > 0) { in fit_extract_data()
497 params->external_offset + buf_ptr); in fit_extract_data()
524 if (params->external_offset > 0) { in fit_extract_data()
525 if (params->external_offset < new_size) { in fit_extract_data()
527 params->external_offset, new_size); in fit_extract_data()
531 new_size = params->external_offset; in fit_extract_data()
557 static int fit_import_data(struct image_tool_params *params, const char *fname) in fit_import_data() argument
567 fd = mmap_fdt(params->cmdname, fname, 0, &old_fdt, &sbuf, false, false); in fit_import_data()
633 params->cmdname, fname, strerror(errno)); in fit_import_data()
724 static int fit_handle_file(struct image_tool_params *params) in fit_handle_file() argument
736 if (strlen (params->imagefile) + in fit_handle_file()
740 params->imagefile, params->cmdname); in fit_handle_file()
743 sprintf (tmpfile, "%s%s", params->imagefile, MKIMAGE_TMPFILE_SUFFIX); in fit_handle_file()
746 if (params->auto_its) { in fit_handle_file()
747 if (fit_build(params, tmpfile)) { in fit_handle_file()
749 params->cmdname); in fit_handle_file()
753 } else if (params->datafile) { in fit_handle_file()
756 MKIMAGE_DTC, params->dtc, tmpfile, params->datafile); in fit_handle_file()
760 params->imagefile, tmpfile); in fit_handle_file()
768 params->cmdname, cmd, strerror(errno)); in fit_handle_file()
773 ret = fit_import_data(params, tmpfile); in fit_handle_file()
801 ret = fit_add_file_data(params, size_inc, tmpfile); in fit_handle_file()
808 params->cmdname, ret); in fit_handle_file()
813 if (params->external_data) { in fit_handle_file()
814 ret = fit_extract_data(params, tmpfile); in fit_handle_file()
819 if (rename (tmpfile, params->imagefile) == -1) { in fit_handle_file()
821 params->cmdname, tmpfile, params->imagefile, in fit_handle_file()
825 unlink (params->imagefile); in fit_handle_file()
874 static int fit_extract_contents(void *ptr, struct image_tool_params *params) in fit_extract_contents() argument
901 if ((params->pflag < 0) || (count <= params->pflag)) { in fit_extract_contents()
902 printf("No such component at '%d'\n", params->pflag); in fit_extract_contents()
916 if (params->pflag == count) { in fit_extract_contents()
923 params->outfile); in fit_extract_contents()
933 static int fit_check_params(struct image_tool_params *params) in fit_check_params() argument
935 if (params->auto_its) in fit_check_params()
937 return ((params->dflag && params->fflag) || in fit_check_params()
938 (params->fflag && params->lflag) || in fit_check_params()
939 (params->lflag && params->dflag)); in fit_check_params()