From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: uol@pengutronix.de, ejo@pengutronix.de,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] FIT: improve error message when uncompressing non-compressed files
Date: Wed, 9 Oct 2024 15:05:46 +0200 [thread overview]
Message-ID: <20241009130546.3913672-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2024-10-09 13:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 13:05 Ahmad Fatoum [this message]
2024-10-14 12:21 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241009130546.3913672-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=ejo@pengutronix.de \
--cc=uol@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox