Skip to contentSkip to conversation

uImage fixes

PATCH Applied Antony Pavlov 2 participants 4 messages Jan 3, 2024 – Jan 4, 2024 VFS

lore
Share & tools
lore
#0 lore raw

cover uImage fixes

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(-)
Signature · 1 line
2.39.0
#1 lore raw

PATCH 1/2 uImage: use IS_ENABLED(CONFIG_TIMESTAMP)

---
 common/uimage.c | 22 ++++++++++++----------
 fs/uimagefs.c   | 24 ++++++++++--------------
 2 files changed, 22 insertions(+), 24 deletions(-)
common/uimage.c +12 -10
index 72c37b7d15d..3c9a79d9109 100644
@@ -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));
fs/uimagefs.c +10 -14
index 7af10ca9864..3099f6a1e62 100644
@@ -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)
 {
Signature · 1 line
2.39.0
#2 lore raw

PATCH 2/2 common: Kconfig: TIMESTAMP: fix help

In reply to Antony Pavlov

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

---
 common/Kconfig | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
common/Kconfig +3 -4
index c8c23a8e03a..3efa8402b9b 100644
@@ -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
Signature · 1 line
2.39.0
Applied
#3 lore raw
In reply to Antony Pavlov
Quoted 3 lines · Antony Pavlov

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

Applied, thanks

Sascha

Quoted 10 lines
 common/Kconfig  |  7 +++----
 common/uimage.c | 22 ++++++++++++----------
 fs/uimagefs.c   | 24 ++++++++++--------------
 3 files changed, 25 insertions(+), 28 deletions(-)
Signature · 1 line
2.39.0
Signature · 4 lines
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 |