Lines Matching refs:fdt

125 			     void *fdt, const char *name, const char *fname)  in fdt_property_file()  argument
145 ret = fdt_property_placeholder(fdt, "data", sbuf.st_size, &ptr); in fdt_property_file()
162 static int fdt_property_strf(void *fdt, const char *name, const char *fmt, ...) in fdt_property_strf() argument
170 return fdt_property_string(fdt, name, str); in fdt_property_strf()
200 static void add_crc_node(void *fdt) in add_crc_node() argument
202 fdt_begin_node(fdt, "hash-1"); in add_crc_node()
203 fdt_property_string(fdt, FIT_ALGO_PROP, "crc32"); in add_crc_node()
204 fdt_end_node(fdt); in add_crc_node()
213 static int fit_write_images(struct image_tool_params *params, char *fdt) in fit_write_images() argument
221 fdt_begin_node(fdt, "images"); in fit_write_images()
226 fdt_begin_node(fdt, str); in fit_write_images()
227 fdt_property_string(fdt, FIT_DESC_PROP, params->imagename); in fit_write_images()
228 fdt_property_string(fdt, FIT_TYPE_PROP, typename); in fit_write_images()
229 fdt_property_string(fdt, FIT_ARCH_PROP, in fit_write_images()
231 fdt_property_string(fdt, FIT_OS_PROP, in fit_write_images()
233 fdt_property_string(fdt, FIT_COMP_PROP, 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()
245 add_crc_node(fdt); in fit_write_images()
246 fdt_end_node(fdt); in fit_write_images()
255 fdt_begin_node(fdt, str); in fit_write_images()
258 fdt_property_string(fdt, FIT_DESC_PROP, str); in fit_write_images()
259 ret = fdt_property_file(params, fdt, FIT_DATA_PROP, in fit_write_images()
263 fdt_property_string(fdt, FIT_TYPE_PROP, typename); in fit_write_images()
264 fdt_property_string(fdt, FIT_ARCH_PROP, in fit_write_images()
266 fdt_property_string(fdt, FIT_COMP_PROP, in fit_write_images()
268 add_crc_node(fdt); in fit_write_images()
269 fdt_end_node(fdt); in fit_write_images()
274 fdt_begin_node(fdt, FIT_RAMDISK_PROP "-1"); in fit_write_images()
276 fdt_property_string(fdt, FIT_TYPE_PROP, FIT_RAMDISK_PROP); in fit_write_images()
277 fdt_property_string(fdt, FIT_OS_PROP, in fit_write_images()
279 fdt_property_string(fdt, FIT_ARCH_PROP, in fit_write_images()
282 ret = fdt_property_file(params, fdt, FIT_DATA_PROP, in fit_write_images()
286 add_crc_node(fdt); in fit_write_images()
287 fdt_end_node(fdt); in fit_write_images()
290 fdt_end_node(fdt); in fit_write_images()
304 static void fit_write_configs(struct image_tool_params *params, char *fdt) in fit_write_configs() argument
311 fdt_begin_node(fdt, "configurations"); in fit_write_configs()
312 fdt_property_string(fdt, FIT_DEFAULT_PROP, "conf-1"); in fit_write_configs()
320 fdt_begin_node(fdt, str); in fit_write_configs()
323 fdt_property_string(fdt, FIT_DESC_PROP, str); in fit_write_configs()
327 fdt_property_string(fdt, typename, str); in fit_write_configs()
328 fdt_property_string(fdt, FIT_LOADABLE_PROP, str); in fit_write_configs()
331 fdt_property_string(fdt, FIT_RAMDISK_PROP, in fit_write_configs()
335 fdt_property_string(fdt, FIT_FDT_PROP, str); in fit_write_configs()
336 fdt_end_node(fdt); in fit_write_configs()
340 fdt_begin_node(fdt, "conf-1"); in fit_write_configs()
343 fdt_property_string(fdt, typename, str); in fit_write_configs()
346 fdt_property_string(fdt, FIT_RAMDISK_PROP, in fit_write_configs()
349 fdt_end_node(fdt); in fit_write_configs()
352 fdt_end_node(fdt); in fit_write_configs()
355 static int fit_build_fdt(struct image_tool_params *params, char *fdt, int size) in fit_build_fdt() argument
359 ret = fdt_create(fdt, size); in fit_build_fdt()
362 fdt_finish_reservemap(fdt); in fit_build_fdt()
363 fdt_begin_node(fdt, ""); in fit_build_fdt()
364 fdt_property_strf(fdt, FIT_DESC_PROP, in fit_build_fdt()
367 fdt_property_strf(fdt, "creator", "U-Boot mkimage %s", PLAIN_VERSION); in fit_build_fdt()
368 fdt_property_u32(fdt, "#address-cells", 1); 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()
373 fdt_end_node(fdt); in fit_build_fdt()
374 ret = fdt_finish(fdt); in fit_build_fdt()
378 return fdt_totalsize(fdt); in fit_build_fdt()
445 void *fdt; in fit_extract_data() local
453 fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false, false); in fit_extract_data()
456 fit_size = fdt_totalsize(fdt); in fit_extract_data()
458 images = fdt_path_offset(fdt, FIT_IMAGES_PATH); in fit_extract_data()
464 image_number = fdtdec_get_child_count(fdt, images); in fit_extract_data()
477 for (node = fdt_first_subnode(fdt, images); in fit_extract_data()
479 node = fdt_next_subnode(fdt, node)) { in fit_extract_data()
483 data = fdt_getprop(fdt, node, FIT_DATA_PROP, &len); in fit_extract_data()
489 ret = fdt_delprop(fdt, node, FIT_DATA_PROP); in fit_extract_data()
496 fdt_setprop_u32(fdt, node, FIT_DATA_POSITION_PROP, in fit_extract_data()
499 fdt_setprop_u32(fdt, node, FIT_DATA_OFFSET_PROP, in fit_extract_data()
502 fdt_setprop_u32(fdt, node, FIT_DATA_SIZE_PROP, len); in fit_extract_data()
507 fdt_pack(fdt); in fit_extract_data()
509 new_size = fdt_totalsize(fdt); in fit_extract_data()
511 fdt_set_totalsize(fdt, new_size); in fit_extract_data()
512 debug("Size reduced from %x to %x\n", fit_size, fdt_totalsize(fdt)); in fit_extract_data()
514 munmap(fdt, sbuf.st_size); in fit_extract_data()
550 munmap(fdt, sbuf.st_size); in fit_extract_data()
559 void *fdt, *old_fdt; in fit_import_data() local
575 fdt = calloc(1, size); in fit_import_data()
576 if (!fdt) { in fit_import_data()
582 ret = fdt_open_into(old_fdt, fdt, size); in fit_import_data()
590 images = fdt_path_offset(fdt, FIT_IMAGES_PATH); in fit_import_data()
597 for (node = fdt_first_subnode(fdt, images); in fit_import_data()
599 node = fdt_next_subnode(fdt, node)) { in fit_import_data()
603 buf_ptr = fdtdec_get_int(fdt, node, "data-offset", -1); in fit_import_data()
604 len = fdtdec_get_int(fdt, node, "data-size", -1); in fit_import_data()
609 ret = fdt_setprop(fdt, node, "data", in fit_import_data()
625 fdt_pack(fdt); in fit_import_data()
627 new_size = fdt_totalsize(fdt); in fit_import_data()
637 if (write(fd, fdt, new_size) != new_size) { in fit_import_data()
644 free(fdt); in fit_import_data()
651 free(fdt); in fit_import_data()