void image_print_contents(const void *ptr) { const image_header_t *hdr = (const image_header_t *)ptr; const char *p; #ifdef __BAREBOX__ p = " "; #else p = ""; #endif printf("%sImage Name: %.*s\n", p, IH_NMLEN, image_get_name(hdr)); #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || !defined(__BAREBOX__) printf("%sCreated: ", p); image_print_time((time_t)image_get_time(hdr)); #endif printf ("%sImage Type: ", p); image_print_type(hdr); printf ("%sData Size: ", p); image_print_size(image_get_data_size(hdr)); printf ("%sLoad Address: %08x\n", p, image_get_load(hdr)); printf ("%sEntry Point: %08x\n", p, image_get_ep(hdr)); if (image_check_type(hdr, IH_TYPE_MULTI) || image_check_type(hdr, IH_TYPE_SCRIPT)) { int i; ulong data, len; ulong count = image_multi_count(hdr); printf ("%sContents:\n", p); for (i = 0; i < count; i++) { image_multi_getimg(hdr, i, &data, &len); printf("%s Image %d: ", p, i); image_print_size(len); if (image_check_type(hdr, IH_TYPE_SCRIPT) && i > 0) { /* * the user may need to know offsets * if planning to do something with * multiple files */ printf("%s Offset = 0x%08lx\n", p, data); } } } }
/** * image_print_contents - prints out the contents of the legacy format image * @ptr: pointer to the legacy format image header * @p: pointer to prefix string * * image_print_contents() formats a multi line legacy image contents description. * The routine prints out all header fields followed by the size/offset data * for MULTI/SCRIPT images. * * returns: * no returned results */ void image_print_contents(const void *ptr) { const image_header_t *hdr = (const image_header_t *)ptr; const char __maybe_unused *p; p = IMAGE_INDENT_STRING; printf("%sImage Name: %.*s\n", p, IH_NMLEN, image_get_name(hdr)); if (IMAGE_ENABLE_TIMESTAMP) { printf("%sCreated: ", p); genimg_print_time((time_t)image_get_time(hdr)); } printf("%sImage Type: ", p); image_print_type(hdr); printf("%sData Size: ", p); genimg_print_size(image_get_data_size(hdr)); printf("%sLoad Address: %08x\n", p, image_get_load(hdr)); printf("%sEntry Point: %08x\n", p, image_get_ep(hdr)); if (image_check_type(hdr, IH_TYPE_MULTI) || image_check_type(hdr, IH_TYPE_SCRIPT)) { int i; ulong data, len; ulong count = image_multi_count(hdr); printf("%sContents:\n", p); for (i = 0; i < count; i++) { image_multi_getimg(hdr, i, &data, &len); printf("%s Image %d: ", p, i); genimg_print_size(len); if (image_check_type(hdr, IH_TYPE_SCRIPT) && i > 0) { /* * the user may need to know offsets * if planning to do something with * multiple files */ printf("%s Offset = 0x%08lx\n", p, data); } } } else if (image_check_type(hdr, IH_TYPE_FIRMWARE_IVT)) { printf("HAB Blocks: 0x%08x 0x0000 0x%08x\n", image_get_load(hdr) - image_get_header_size(), image_get_size(hdr) + image_get_header_size() - 0x1FE0); } }