[PATCH 1/1] boot/image-fit: improve 'No Image' message
Simon Glass
sjg at chromium.org
Wed Apr 30 17:00:35 CEST 2025
Hi Heinrich,
On Wed, 30 Apr 2025 at 08:34, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> On 30.04.25 15:54, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Wed, 30 Apr 2025 at 01:16, Heinrich Schuchardt
> > <heinrich.schuchardt at canonical.com> wrote:
> >>
> >> If an initrd is invalid, we see output like
> >>
> >> No Unknown OS RISC-V RAMDisk Image Image
> >> Ramdisk image is corrupt or invalid
> >>
> >> As most image type descriptions end on Image, we should not repeat that
> >> word.
> >
> > Instead of that, remove the 'Image' from all the types and reduce the
> > size of U-Boot by 200+ bytes.
>
> There are more places where genimg_get_type_name() is called. We would
> have to consider all of these.
We just don't need the word 'Image' at the end
>
> >
> >> Instead of misleading 'No' we should write 'Invalid' here.
> >>
> >> Invalid Unknown OS RISC-V RAMDisk Image
> >> Ramdisk image is corrupt or invalid
> >
> > What this is actually saying is that the image is not of the requested
> > type. It may be a valid image but it doesn't match the requested
> > image_type. So calling it invalid is going to be very confusing.
> > People might then start trying to figure out whether the image was
> > created incorrectly, etc.
>
> "No foo image" means there is no image of type "foo image" at all.
Yes and that is the situation we have, isn't it?
>
> "Invalid foo image" clearly expresses that it is not an image that can
> be interpreted as "foo image".
>
> No clue what confuses you here.
'Invalid' means the image is invalid, not that it cannot be
interpreted in some way.
Perhaps x is not of type y ?
>
> Best regards
>
> Heinrich
>
> >
> >>
> >> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> >> ---
> >> boot/image-fit.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/boot/image-fit.c b/boot/image-fit.c
> >> index 41ab1f552b0..856de6b731a 100644
> >> --- a/boot/image-fit.c
> >> +++ b/boot/image-fit.c
> >> @@ -2196,7 +2196,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
> >> */
> >> if ((!type_ok || !os_ok) && image_type != IH_TYPE_LOADABLE) {
> >> fit_image_get_os(fit, noffset, &os);
> >> - printf("No %s %s %s Image\n",
> >> + printf("Invalid %s %s %s\n",
> >> genimg_get_os_name(os),
> >> genimg_get_arch_name(arch),
> >> genimg_get_type_name(image_type));
> >> --
> >> 2.48.1
> >>
Regards,
Simon
More information about the U-Boot
mailing list