diff mbox series

[v2,14/17] drivers: fastboot: zImage flashing is not supported for v3, v4

Message ID 20230126160506.1026643-15-souajih@baylibre.com
State Changes Requested
Delegated to: Simon Glass
Headers show
Series Support android boot image v3/v4 | expand

Commit Message

Safae Ouajih Jan. 26, 2023, 4:05 p.m. UTC
Print an error message when the boot image header version is
greater than 2 as this is not supported for v3 and v4.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
---
 drivers/fastboot/fb_mmc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Simon Glass Jan. 27, 2023, 12:55 a.m. UTC | #1
Hi Safae,

On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
>
> Print an error message when the boot image header version is
> greater than 2 as this is not supported for v3 and v4.

But why is is not supported? Please add this here.

>
> Signed-off-by: Safae Ouajih <souajih@baylibre.com>
> ---
>  drivers/fastboot/fb_mmc.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
> index 086e5f7843..9fb2ab3820 100644
> --- a/drivers/fastboot/fb_mmc.c
> +++ b/drivers/fastboot/fb_mmc.c
> @@ -370,6 +370,14 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
>                 return -1;
>         }
>
> +       /* Check if boot image header version is 2 or less */
> +       if (hdr->header_version > 2) {
> +               pr_err("zImage flashing supported only for boot images v2 and less\n");
> +               fastboot_fail("zImage flashing supported only for boot images v2 and less",
> +                             response);
> +               return -1;

That is not an error message. Perhaps -ENOTSUPP ?

> +       }
> +
>         /* Check if boot image has second stage in it (we don't support it) */
>         if (hdr->second_size > 0) {
>                 pr_err("moving second stage is not supported yet\n");
> --
> 2.34.1
>

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 086e5f7843..9fb2ab3820 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -370,6 +370,14 @@  static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
 		return -1;
 	}
 
+	/* Check if boot image header version is 2 or less */
+	if (hdr->header_version > 2) {
+		pr_err("zImage flashing supported only for boot images v2 and less\n");
+		fastboot_fail("zImage flashing supported only for boot images v2 and less",
+			      response);
+		return -1;
+	}
+
 	/* Check if boot image has second stage in it (we don't support it) */
 	if (hdr->second_size > 0) {
 		pr_err("moving second stage is not supported yet\n");