diff options
Diffstat (limited to 'common/uimage.c')
-rw-r--r-- | common/uimage.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/common/uimage.c b/common/uimage.c index 42e9d9023f..cc9e5e510a 100644 --- a/common/uimage.c +++ b/common/uimage.c @@ -29,17 +29,19 @@ static inline int uimage_is_multi_image(struct uimage_handle *handle) void uimage_print_contents(struct uimage_handle *handle) { struct image_header *hdr = &handle->header; -#if defined(CONFIG_TIMESTAMP) - struct rtc_time tm; -#endif + printf(" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name); -#if defined(CONFIG_TIMESTAMP) - printf(" Created: "); - to_tm(hdr->ih_time, &tm); - printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n", - tm.tm_year, tm.tm_mon, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); -#endif + + if (IS_ENABLED(CONFIG_TIMESTAMP)) { + struct rtc_time tm; + + printf(" Created: "); + to_tm(hdr->ih_time, &tm); + printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n", + tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + } + #if defined(CONFIG_BOOTM_SHOW_TYPE) printf(" OS: %s\n", image_get_os_name(hdr->ih_os)); printf(" Architecture: %s\n", image_get_arch_name(hdr->ih_arch)); @@ -98,7 +100,7 @@ struct uimage_handle *uimage_open(const char *filename) fd = open(filename, O_RDONLY); if (fd < 0) { - printf("could not open: %s\n", errno_str()); + printf("could not open: %m\n"); free(copy); return NULL; } @@ -109,7 +111,7 @@ struct uimage_handle *uimage_open(const char *filename) handle->copy = copy; if (read(fd, header, sizeof(*header)) < 0) { - printf("could not read: %s\n", errno_str()); + printf("could not read: %m\n"); goto err_out; } @@ -216,23 +218,23 @@ EXPORT_SYMBOL(uimage_close); static int uimage_fd; -static int uimage_fill(void *buf, unsigned int len) +static long uimage_fill(void *buf, unsigned long len) { return read_full(uimage_fd, buf, len); } -static int uncompress_copy(unsigned char *inbuf_unused, int len, - int(*fill)(void*, unsigned int), - int(*flush)(void*, unsigned int), +static int uncompress_copy(unsigned char *inbuf_unused, long len, + long(*fill)(void*, unsigned long), + long(*flush)(void*, unsigned long), unsigned char *outbuf_unused, - int *pos, + long *pos, void(*error_fn)(char *x)) { int ret; void *buf = xmalloc(PAGE_SIZE); while (len) { - int now = min(len, PAGE_SIZE); + int now = min_t(long, len, PAGE_SIZE); ret = fill(buf, now); if (ret < 0) goto err; @@ -293,17 +295,17 @@ EXPORT_SYMBOL(uimage_verify); * Load a uimage, flushing output to flush function */ int uimage_load(struct uimage_handle *handle, unsigned int image_no, - int(*flush)(void*, unsigned int)) + long(*flush)(void*, unsigned long)) { image_header_t *hdr = &handle->header; struct uimage_handle_data *iha; int ret; loff_t off; - int (*uncompress_fn)(unsigned char *inbuf, int len, - int(*fill)(void*, unsigned int), - int(*flush)(void*, unsigned int), + int (*uncompress_fn)(unsigned char *inbuf, long len, + long(*fill)(void*, unsigned long), + long(*flush)(void*, unsigned long), unsigned char *output, - int *pos, + long *pos, void(*error)(char *x)); if (image_no >= handle->nb_data_entries) @@ -334,7 +336,7 @@ static void *uimage_buf; static size_t uimage_size; static struct resource *uimage_resource; -static int uimage_sdram_flush(void *buf, unsigned int len) +static long uimage_sdram_flush(void *buf, unsigned long len) { if (uimage_size + len > resource_size(uimage_resource)) { resource_size_t start = uimage_resource->start; |