Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx> --- common/uimage.c | 22 ++++++++++++---------- fs/uimagefs.c | 24 ++++++++++-------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/common/uimage.c b/common/uimage.c index 72c37b7d15d..3c9a79d9109 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)); diff --git a/fs/uimagefs.c b/fs/uimagefs.c index 7af10ca9864..3099f6a1e62 100644 --- a/fs/uimagefs.c +++ b/fs/uimagefs.c @@ -300,28 +300,24 @@ static int uimagefs_add_data_entry(struct uimagefs_handle *priv, size_t offset, return 0; } -#if defined(CONFIG_TIMESTAMP) static int uimagefs_add_time(struct uimagefs_handle *priv) { struct image_header *header = &priv->header; - struct rtc_time tm; - char *val; - to_tm(header->ih_time, &tm); - val = basprintf("%4d-%02d-%02d %2d:%02d:%02d UTC", - tm.tm_year, tm.tm_mon, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); + if (IS_ENABLED(CONFIG_TIMESTAMP)) { + struct rtc_time tm; + char *val; - return uimagefs_add_str(priv, UIMAGEFS_TIME, val); -} -#else -static int uimagefs_add_time(struct uimagefs_handle *priv) -{ - struct image_header *header = &priv->header; + to_tm(header->ih_time, &tm); + val = basprintf("%4d-%02d-%02d %2d:%02d:%02d UTC", + tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + + return uimagefs_add_str(priv, UIMAGEFS_TIME, val); + } return uimagefs_add_hex(priv, UIMAGEFS_TIME, header->ih_time); } -#endif static int uimagefs_add_os(struct uimagefs_handle *priv) { -- 2.39.0