[PATCH 1/1] boot/image-fit: improve 'No Image' message

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Wed Apr 30 16:34:39 CEST 2025


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.

> 
>> 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.

"Invalid foo image" clearly expresses that it is not an image that can 
be interpreted as "foo image".

No clue what confuses you here.

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