mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] FIT: improve error message when uncompressing non-compressed files
@ 2024-10-09 13:05 Ahmad Fatoum
  2024-10-14 12:21 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-10-09 13:05 UTC (permalink / raw)
  To: barebox; +Cc: uol, ejo, Ahmad Fatoum

If due to user error, an uncompressed kernel is added into a FIT image,
but compression = "gzip" is specified, a quite cryptic message results:

  ERROR: FIT: cannot handle filetype ARM aarch64 Linux image
  ERROR: FIT: data couldn't be decompressed
  ERROR: Loading dtb image failed with: Function not implemented

Adapt the error messages a bit, so it says instead:

  ERROR: FIT: unsupported compression filetype "aarch64 Linux image"
  ERROR: FIT: gzip data couldn't be decompressed
  ERROR: Loading FIT image failed with: Function not implemented

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/bootm.c     | 10 ++++++++--
 common/image-fit.c |  2 +-
 lib/uncompress.c   |  2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/common/bootm.c b/common/bootm.c
index 2de68a0b5e1a..b6ab358426f6 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -761,8 +761,14 @@ int bootm_boot(struct bootm_data *bootm_data)
 	}
 
 	if (ret) {
-		pr_err("Loading %s image failed with: %pe\n",
-		       file_type_to_short_string(os_type), ERR_PTR(ret));
+		const char *os_type_str;
+
+		if (os_type == filetype_oftree)
+			os_type_str = "FIT";
+		else
+			os_type_str = file_type_to_short_string(os_type);
+
+		pr_err("Loading %s image failed with: %pe\n", os_type_str, ERR_PTR(ret));
 		goto err_out;
 	}
 
diff --git a/common/image-fit.c b/common/image-fit.c
index c5d2196bda34..9e3dbe9ae054 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -598,7 +598,7 @@ static int fit_handle_decompression(struct device_node *image,
 	ret = uncompress_buf_to_buf(*data, *data_len, &uc_data,
 				    fit_uncompress_error_fn);
 	if (ret < 0) {
-		pr_err("data couldn't be decompressed\n");
+		pr_err("%s data couldn't be decompressed\n", compression);
 		return ret;
 	}
 
diff --git a/lib/uncompress.c b/lib/uncompress.c
index 11f55c8f9fd1..0aaeb066b674 100644
--- a/lib/uncompress.c
+++ b/lib/uncompress.c
@@ -131,7 +131,7 @@ int uncompress(unsigned char *inbuf, long len,
 		break;
 #endif
 	default:
-		err = basprintf("cannot handle filetype %s",
+		err = basprintf("unsupported compression filetype \"%s\"",
 				  file_type_to_string(ft));
 		error_fn(err);
 		free(err);
-- 
2.39.5




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

* Re: [PATCH] FIT: improve error message when uncompressing non-compressed files
  2024-10-09 13:05 [PATCH] FIT: improve error message when uncompressing non-compressed files Ahmad Fatoum
@ 2024-10-14 12:21 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-10-14 12:21 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: uol, ejo


On Wed, 09 Oct 2024 15:05:46 +0200, Ahmad Fatoum wrote:
> If due to user error, an uncompressed kernel is added into a FIT image,
> but compression = "gzip" is specified, a quite cryptic message results:
> 
>   ERROR: FIT: cannot handle filetype ARM aarch64 Linux image
>   ERROR: FIT: data couldn't be decompressed
>   ERROR: Loading dtb image failed with: Function not implemented
> 
> [...]

Applied, thanks!

[1/1] FIT: improve error message when uncompressing non-compressed files
      https://git.pengutronix.de/cgit/barebox/commit/?id=22e42e849896 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-10-14 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-09 13:05 [PATCH] FIT: improve error message when uncompressing non-compressed files Ahmad Fatoum
2024-10-14 12:21 ` Sascha Hauer

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