mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] uImage fixes
@ 2024-01-03 17:07 Antony Pavlov
  2024-01-03 17:07 ` [PATCH 1/2] uImage: use IS_ENABLED(CONFIG_TIMESTAMP) Antony Pavlov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Antony Pavlov @ 2024-01-03 17:07 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Antony Pavlov (2):
  uImage: use IS_ENABLED(CONFIG_TIMESTAMP)
  common: Kconfig: TIMESTAMP: fix help

 common/Kconfig  |  7 +++----
 common/uimage.c | 22 ++++++++++++----------
 fs/uimagefs.c   | 24 ++++++++++--------------
 3 files changed, 25 insertions(+), 28 deletions(-)

-- 
2.39.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] uImage: use IS_ENABLED(CONFIG_TIMESTAMP)
  2024-01-03 17:07 [PATCH 0/2] uImage fixes Antony Pavlov
@ 2024-01-03 17:07 ` Antony Pavlov
  2024-01-03 17:07 ` [PATCH 2/2] common: Kconfig: TIMESTAMP: fix help Antony Pavlov
  2024-01-04 11:19 ` [PATCH 0/2] uImage fixes Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Antony Pavlov @ 2024-01-03 17:07 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] common: Kconfig: TIMESTAMP: fix help
  2024-01-03 17:07 [PATCH 0/2] uImage fixes Antony Pavlov
  2024-01-03 17:07 ` [PATCH 1/2] uImage: use IS_ENABLED(CONFIG_TIMESTAMP) Antony Pavlov
@ 2024-01-03 17:07 ` Antony Pavlov
  2024-01-04 11:19 ` [PATCH 0/2] uImage fixes Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Antony Pavlov @ 2024-01-03 17:07 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

At the moment CONFIG_TIMESTAMP help text is inherited from U-Boot.
Fix it in accordance with barebox realities.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 common/Kconfig | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index c8c23a8e03a..3efa8402b9b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -533,12 +533,11 @@ config TIMESTAMP
 	bool
 	default y
 	select GREGORIAN_CALENDER
-	prompt "print timestamp information from images"
+	prompt "print timestamp information from uImages"
 	help
 	  When CONFIG_TIMESTAMP is selected, the timestamp
-	  (date and time) of an image is printed by image
-	  commands like bootm or iminfo. This option is
-	  automatically enabled when you select CFG_CMD_DATE .
+	  (date and time) of an uImage is printed by image
+	  commands like bootm or uimage.
 
 menuconfig BOOTM
 	select UIMAGE
-- 
2.39.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] uImage fixes
  2024-01-03 17:07 [PATCH 0/2] uImage fixes Antony Pavlov
  2024-01-03 17:07 ` [PATCH 1/2] uImage: use IS_ENABLED(CONFIG_TIMESTAMP) Antony Pavlov
  2024-01-03 17:07 ` [PATCH 2/2] common: Kconfig: TIMESTAMP: fix help Antony Pavlov
@ 2024-01-04 11:19 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-01-04 11:19 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox, Ahmad Fatoum

On Wed, Jan 03, 2024 at 08:07:23PM +0300, Antony Pavlov wrote:
> Antony Pavlov (2):
>   uImage: use IS_ENABLED(CONFIG_TIMESTAMP)
>   common: Kconfig: TIMESTAMP: fix help

Applied, thanks

Sascha

> 
>  common/Kconfig  |  7 +++----
>  common/uimage.c | 22 ++++++++++++----------
>  fs/uimagefs.c   | 24 ++++++++++--------------
>  3 files changed, 25 insertions(+), 28 deletions(-)
> 
> -- 
> 2.39.0
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-04 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 17:07 [PATCH 0/2] uImage fixes Antony Pavlov
2024-01-03 17:07 ` [PATCH 1/2] uImage: use IS_ENABLED(CONFIG_TIMESTAMP) Antony Pavlov
2024-01-03 17:07 ` [PATCH 2/2] common: Kconfig: TIMESTAMP: fix help Antony Pavlov
2024-01-04 11:19 ` [PATCH 0/2] uImage fixes Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox