diff mbox series

[v2,08/17] android: boot: boot image header v3, v4 do not support recovery DTBO

Message ID 20230126160506.1026643-9-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:04 p.m. UTC
android_image_get_dtbo() is used to get recovery DTBO via abootimg cmd.
This is not supported in boot image header v3 and v4. Thus, we print an
error message when v1,v2 header version are not used.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
---
 boot/image-android.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass Jan. 27, 2023, 12:54 a.m. UTC | #1
On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
>
> android_image_get_dtbo() is used to get recovery DTBO via abootimg cmd.
> This is not supported in boot image header v3 and v4. Thus, we print an
> error message when v1,v2 header version are not used.
>
> Signed-off-by: Safae Ouajih <souajih@baylibre.com>
> ---
>  boot/image-android.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

log_err() might be better


>
> diff --git a/boot/image-android.c b/boot/image-android.c
> index a6e7a7abb0..d797270a32 100644
> --- a/boot/image-android.c
> +++ b/boot/image-android.c
> @@ -316,8 +316,8 @@ bool android_image_get_dtbo(ulong hdr_addr, ulong *addr, u32 *size)
>                 goto exit;
>         }
>
> -       if (hdr->header_version < 1) {
> -               printf("Error: header_version must be >= 1 to get dtbo\n");
> +       if (hdr->header_version != 1 && hdr->header_version != 2) {
> +               printf("Error: header version must be >= 1 and <= 2 to get dtbo\n");
>                 ret = false;
>                 goto exit;
>         }
> --
> 2.34.1
>
Mattijs Korpershoek Feb. 1, 2023, 8:37 a.m. UTC | #2
On Thu, Jan 26, 2023 at 17:54, Simon Glass <sjg@chromium.org> wrote:

> On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
>>
>> android_image_get_dtbo() is used to get recovery DTBO via abootimg cmd.
>> This is not supported in boot image header v3 and v4. Thus, we print an
>> error message when v1,v2 header version are not used.
>>
>> Signed-off-by: Safae Ouajih <souajih@baylibre.com>
>> ---
>>  boot/image-android.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> log_err() might be better
>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

>
>>
>> diff --git a/boot/image-android.c b/boot/image-android.c
>> index a6e7a7abb0..d797270a32 100644
>> --- a/boot/image-android.c
>> +++ b/boot/image-android.c
>> @@ -316,8 +316,8 @@ bool android_image_get_dtbo(ulong hdr_addr, ulong *addr, u32 *size)
>>                 goto exit;
>>         }
>>
>> -       if (hdr->header_version < 1) {
>> -               printf("Error: header_version must be >= 1 to get dtbo\n");
>> +       if (hdr->header_version != 1 && hdr->header_version != 2) {
>> +               printf("Error: header version must be >= 1 and <= 2 to get dtbo\n");
>>                 ret = false;
>>                 goto exit;
>>         }
>> --
>> 2.34.1
>>
diff mbox series

Patch

diff --git a/boot/image-android.c b/boot/image-android.c
index a6e7a7abb0..d797270a32 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -316,8 +316,8 @@  bool android_image_get_dtbo(ulong hdr_addr, ulong *addr, u32 *size)
 		goto exit;
 	}
 
-	if (hdr->header_version < 1) {
-		printf("Error: header_version must be >= 1 to get dtbo\n");
+	if (hdr->header_version != 1 && hdr->header_version != 2) {
+		printf("Error: header version must be >= 1 and <= 2 to get dtbo\n");
 		ret = false;
 		goto exit;
 	}